Skip to content

Commit 731a70f

Browse files
committed
Add script for recording the object sizes of mbed-client built on armcc
This script will collect the module size information of the mbed-client and its current dependencies. Each module will get a separate txt-file under results -directory. Note: the numbers need to be taken with grain of salt, as the end result of binary depends on the client, as if it does not call some paths, the linker is free to remove them from the end binary. So, in practice these numbers represent the worst case scenario.
1 parent c19fd7f commit 731a70f

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

get_sizes.sh

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
# Copyright (c) 2016 ARM Limited. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
# Licensed under the Apache License, Version 2.0 (the License); you may
5+
# not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# * http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
echo
17+
echo "Build mbed Client API for executable size collection"
18+
echo
19+
20+
BUILD_TARGET="frdm-k64f-armcc"
21+
22+
yt target $BUILD_TARGET
23+
yt build
24+
25+
SIZE_CMD="size --totals"
26+
27+
OUTPUT_PATH="results/"
28+
OUTPUT_FILE_POSTFIX="_${BUILD_TARGET}_size.txt"
29+
30+
MAIN_MODULE_NAME="mbed-client"
31+
32+
# yotta dependencies
33+
YOTTA_DEPS=(
34+
'cmsis-core'
35+
'cmsis-core-k64f'
36+
'core-util'
37+
'dlmalloc'
38+
'greentea-client'
39+
'mbed-client-c'
40+
'mbed-client-mbed-os'
41+
'mbed-client-mbedtls'
42+
'mbed-drivers'
43+
'mbed-hal'
44+
'mbed-hal-frdm-k64f'
45+
'mbed-hal-k64f'
46+
'mbed-hal-ksdk-mcu'
47+
'mbedtls'
48+
'mbed-trace'
49+
'minar'
50+
'minar-platform-mbed'
51+
'nanostack-libservice'
52+
'sal'
53+
'sal-driver-lwip-k64f-eth'
54+
'sal-iface-eth'
55+
'sal-stack-lwip'
56+
'sockets'
57+
'ualloc'
58+
'uvisor-lib'
59+
)
60+
61+
62+
# yotta dummy dependencies, which have different naming
63+
YOTTA_DUMMY_DEPS=(
64+
'cmsis-core-freescale'
65+
'compiler-polyfill'
66+
'mbed-hal-freescale'
67+
'minar-platform'
68+
)
69+
70+
71+
echo "Writing object file size informations to ${OUTPUT_PATH}"
72+
73+
# the "main" module is in build/<target>/source/<module>.ar
74+
${SIZE_CMD} ./build/${BUILD_TARGET}/source/${MAIN_MODULE_NAME}.ar >${OUTPUT_PATH}${MAIN_MODULE_NAME}${OUTPUT_FILE_POSTFIX}
75+
76+
# these are the direct deps, found as build/<target>/ym/<module>/source/<module>.ar
77+
for MODULE in "${YOTTA_DEPS[@]}"
78+
do
79+
${SIZE_CMD} ./build/${BUILD_TARGET}/ym/${MODULE}/source/${MODULE}.ar >${OUTPUT_PATH}${MODULE}${OUTPUT_FILE_POSTFIX}
80+
done
81+
82+
# dummy libs, which are named with different logic
83+
for MODULE in "${YOTTA_DUMMY_DEPS[@]}"
84+
do
85+
# on paths the "-" char needs to be converted to "_"
86+
MODULE_PATH=${MODULE//-/_}
87+
${SIZE_CMD} ./build/${BUILD_TARGET}/ym/${MODULE}/yotta_dummy_lib_${MODULE_PATH}/${MODULE}.ar >${OUTPUT_PATH}${MODULE}${OUTPUT_FILE_POSTFIX}
88+
done

0 commit comments

Comments
 (0)