blob: a11844ff2f634ca6c44d44cc97e8f0df66b3383c [file] [log] [blame]
Manuel Pégourié-Gonnardac8673c2015-10-16 13:03:04 +02001#!/bin/sh
2
3set -eu
4
5CONFIG_H='include/mbedtls/config.h'
6
7if [ -r $CONFIG_H ]; then :; else
8 echo "$CONFIG_H not found" >&2
9 exit 1
10fi
11
12if grep -i cmake Makefile >/dev/null; then
13 echo "Not compatible with CMake" >&2
14 exit 1
15fi
16
17doit()
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
46yotta/create-module.sh >/dev/null
47
48doit default include/mbedtls/config.h.bak
49doit yotta yotta/module/mbedtls/config.h
50doit thread configs/config-thread.h
51doit ecc configs/config-suite-b.h
52doit psk configs/config-ccm-psk-tls1_2.h