From ac8673cb3f8f351f8588fdb3d2747b668e1f12b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 16 Oct 2015 13:03:04 +0200 Subject: [PATCH] Add quick script to estimate ROM footprint --- scripts/footprint.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 scripts/footprint.sh diff --git a/scripts/footprint.sh b/scripts/footprint.sh new file mode 100755 index 0000000000..a11844ff2f --- /dev/null +++ b/scripts/footprint.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +set -eu + +CONFIG_H='include/mbedtls/config.h' + +if [ -r $CONFIG_H ]; then :; else + echo "$CONFIG_H not found" >&2 + exit 1 +fi + +if grep -i cmake Makefile >/dev/null; then + echo "Not compatible with CMake" >&2 + exit 1 +fi + +doit() +{ + NAME="$1" + FILE="$2" + + echo "$NAME:" + + cp $CONFIG_H ${CONFIG_H}.bak + cp "$FILE" include/mbedtls/config.h + + { + scripts/config.pl unset MBEDTLS_NET_C || true + scripts/config.pl unset MBEDTLS_TIMING_C || true + scripts/config.pl unset MBEDTLS_FS_IO || true + } >/dev/null 2>&1 + + CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld \ + CFLAGS='-Wa,--noexecstack -Os -march=armv7-m -mthumb' \ + make clean lib >/dev/null + + OUT="size-${NAME}.txt" + arm-none-eabi-size -t library/libmbed*.a > "$OUT" + head -n1 "$OUT" + tail -n1 "$OUT" + + cp ${CONFIG_H}.bak $CONFIG_H +} + +# creates the yotta config +yotta/create-module.sh >/dev/null + +doit default include/mbedtls/config.h.bak +doit yotta yotta/module/mbedtls/config.h +doit thread configs/config-thread.h +doit ecc configs/config-suite-b.h +doit psk configs/config-ccm-psk-tls1_2.h