This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

source: ps/trunk/build/premake/premake5/contrib/mbedtls/scripts/footprint.sh

Last change on this file was 20366, checked in by Itms, 7 years ago

Alpha 12 version of Premake 5, including prebuilt binary for Windows.
Directly taken from https://premake.github.io/.

Refs #3729.

File size: 2.3 KB
Line 
1#!/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 echo "This script needs to be run from the root of" >&2
10 echo "a git checkout or uncompressed tarball" >&2
11 exit 1
12fi
13
14if grep -i cmake Makefile >/dev/null; then
15 echo "Not compatible with CMake" >&2
16 exit 1
17fi
18
19if which arm-none-eabi-gcc >/dev/null 2>&1; then :; else
20 echo "You need the ARM-GCC toolchain in your path" >&2
21 echo "See https://launchpad.net/gcc-arm-embedded/" >&2
22 exit 1
23fi
24
25ARMGCC_FLAGS='-Os -march=armv7-m -mthumb'
26OUTFILE='00-footprint-summary.txt'
27
28log()
29{
30 echo "$@"
31 echo "$@" >> "$OUTFILE"
32}
33
34doit()
35{
36 NAME="$1"
37 FILE="$2"
38
39 log ""
40 log "$NAME ($FILE):"
41
42 cp $CONFIG_H ${CONFIG_H}.bak
43 if [ "$FILE" != $CONFIG_H ]; then
44 cp "$FILE" $CONFIG_H
45 fi
46
47 {
48 scripts/config.pl unset MBEDTLS_NET_C || true
49 scripts/config.pl unset MBEDTLS_TIMING_C || true
50 scripts/config.pl unset MBEDTLS_FS_IO || true
51 } >/dev/null 2>&1
52
53 CC=arm-none-eabi-gcc AR=arm-none-eabi-ar LD=arm-none-eabi-ld \
54 CFLAGS="$ARMGCC_FLAGS" make clean lib >/dev/null
55
56 OUT="size-${NAME}.txt"
57 arm-none-eabi-size -t library/libmbed*.a > "$OUT"
58 log "$( head -n1 "$OUT" )"
59 log "$( tail -n1 "$OUT" )"
60
61 cp ${CONFIG_H}.bak $CONFIG_H
62}
63
64# truncate the file just this time
65echo "(generated by $0)" > "$OUTFILE"
66echo "" >> "$OUTFILE"
67
68log "Footprint of standard configurations (minus net.c, timing.c, fs_io)"
69log "for bare-metal ARM Cortex-M3/M4 microcontrollers."
70
71VERSION_H="include/mbedtls/version.h"
72MBEDTLS_VERSION=$( sed -n 's/.*VERSION_STRING *"\(.*\)"/\1/p' $VERSION_H )
73if git rev-parse HEAD >/dev/null; then
74 GIT_HEAD=$( git rev-parse HEAD | head -c 10 )
75 GIT_VERSION=" (git head: $GIT_HEAD)"
76else
77 GIT_VERSION=""
78fi
79
80log ""
81log "mbed TLS $MBEDTLS_VERSION$GIT_VERSION"
82log "$( arm-none-eabi-gcc --version | head -n1 )"
83log "CFLAGS=$ARMGCC_FLAGS"
84
85# creates the yotta config
86yotta/create-module.sh >/dev/null
87
88doit default include/mbedtls/config.h
89doit yotta yotta/module/mbedtls/config.h
90doit thread configs/config-thread.h
91doit suite-b configs/config-suite-b.h
92doit psk configs/config-ccm-psk-tls1_2.h
93
94zip mbedtls-footprint.zip "$OUTFILE" size-*.txt >/dev/null
Note: See TracBrowser for help on using the repository browser.