Manuel Pégourié-Gonnard | ac8673c | 2015-10-16 13:03:04 +0200 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -eu |
| 4 | |
| 5 | CONFIG_H='include/mbedtls/config.h' |
| 6 | |
| 7 | if [ -r $CONFIG_H ]; then :; else |
| 8 | echo "$CONFIG_H not found" >&2 |
| 9 | exit 1 |
| 10 | fi |
| 11 | |
| 12 | if grep -i cmake Makefile >/dev/null; then |
| 13 | echo "Not compatible with CMake" >&2 |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
| 17 | doit() |
| 18 | { |
| 19 | NAME="$1" |
| 20 | FILE="$2" |
| 21 | |
| 22 | echo "$NAME:" |
| 23 | |
| 24 | cp $CONFIG_H ${CONFIG_H}.bak |
| 25 | cp "$FILE" include/mbedtls/config.h |
| 26 | |
| 27 | { |
| 28 | scripts/config.pl unset MBEDTLS_NET_C || true |
| 29 | scripts/config.pl unset MBEDTLS_TIMING_C || true |
| 30 | scripts/config.pl unset MBEDTLS_FS_IO || true |
| 31 | } >/dev/null 2>&1 |
| 32 | |
| 33 | CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld \ |
| 34 | CFLAGS='-Wa,--noexecstack -Os -march=armv7-m -mthumb' \ |
| 35 | make clean lib >/dev/null |
| 36 | |
| 37 | OUT="size-${NAME}.txt" |
| 38 | arm-none-eabi-size -t library/libmbed*.a > "$OUT" |
| 39 | head -n1 "$OUT" |
| 40 | tail -n1 "$OUT" |
| 41 | |
| 42 | cp ${CONFIG_H}.bak $CONFIG_H |
| 43 | } |
| 44 | |
| 45 | # creates the yotta config |
| 46 | yotta/create-module.sh >/dev/null |
| 47 | |
| 48 | doit default include/mbedtls/config.h.bak |
| 49 | doit yotta yotta/module/mbedtls/config.h |
| 50 | doit thread configs/config-thread.h |
| 51 | doit ecc configs/config-suite-b.h |
| 52 | doit psk configs/config-ccm-psk-tls1_2.h |