From 15be0eeae4df6dffc15efc3931d0b2acf9a29939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 20 Sep 2019 10:25:29 +0200 Subject: [PATCH 1/2] baremetal.sh: extract ROM reporting to a function --- scripts/baremetal.sh | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/scripts/baremetal.sh b/scripts/baremetal.sh index 813307a9c..cde0d9001 100755 --- a/scripts/baremetal.sh +++ b/scripts/baremetal.sh @@ -67,6 +67,17 @@ fi date=$( date +%Y-%m-%d-%H-%M-%S ) +print_rom_report() +{ + echo "ROM statistics written to:" + echo "* $ROM_OUT_FILE" + echo "* $ROM_OUT_SYMS" + + cat $ROM_OUT_FILE | grep "libmbedtls.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' + cat $ROM_OUT_FILE | grep "libmbedcrypto.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' + cat $ROM_OUT_FILE | grep "libmbedx509.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' +} + baremetal_build_gcc() { echo "Cleanup..." @@ -102,14 +113,7 @@ baremetal_build_gcc() echo "Generate symbol statistics..." ./scripts/extract_codesize_stats.sh --info "gcc_${gcc_ver}" --name $NAME --syms > $ROM_OUT_SYMS - echo "ROM statistics written to:" - echo "* $ROM_OUT_FILE" - echo "* $ROM_OUT_SYMS" - - # Print summary - cat $ROM_OUT_FILE | grep "libmbedtls.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedcrypto.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedx509.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' + print_rom_report } baremetal_build_armc5() @@ -149,14 +153,7 @@ baremetal_build_armc5() echo "Generate symbol statistics..." ./scripts/extract_codesize_stats.sh --info "armc5_${armc5_ver}" --name $NAME --syms > $ROM_OUT_SYMS - echo "ROM statistics written to:" - echo "* $ROM_OUT_FILE" - echo "* $ROM_OUT_SYMS" - - # Print summary - cat $ROM_OUT_FILE | grep "libmbedtls.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedcrypto.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedx509.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' + print_rom_report } baremetal_build_armc6() @@ -194,14 +191,7 @@ baremetal_build_armc6() echo "Generate symbol statistics..." ./scripts/extract_codesize_stats.sh --info "armc6_${armc6_ver}" --name $NAME --syms > $ROM_OUT_SYMS - echo "ROM statistics written to:" - echo "* $ROM_OUT_FILE" - echo "* $ROM_OUT_SYMS" - - # Print summary - cat $ROM_OUT_FILE | grep "libmbedtls.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedcrypto.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedx509.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' + print_rom_report } # 32-bit host-build of library, tests and example programs, From d2c24869ae10479a922f5322c229323f819d4f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 20 Sep 2019 10:29:29 +0200 Subject: [PATCH 2/2] baremetal.sh: include total in ROM report --- scripts/baremetal.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/baremetal.sh b/scripts/baremetal.sh index cde0d9001..53ccedbb0 100755 --- a/scripts/baremetal.sh +++ b/scripts/baremetal.sh @@ -73,9 +73,10 @@ print_rom_report() echo "* $ROM_OUT_FILE" echo "* $ROM_OUT_SYMS" - cat $ROM_OUT_FILE | grep "libmbedtls.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedcrypto.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' - cat $ROM_OUT_FILE | grep "libmbedx509.a" | awk '{printf( "%15s: %s Bytes\n", $4, $5)}' + <$ROM_OUT_FILE awk '$4 ~ /libmbedcrypto/ {printf("%15s: %5s Bytes\n", $4, $5)}' + <$ROM_OUT_FILE awk '$4 ~ /libmbedx509/ {printf("%15s: %5s Bytes\n", $4, $5)}' + <$ROM_OUT_FILE awk '$4 ~ /libmbedtls/ {printf("%15s: %5s Bytes\n", $4, $5)}' + <$ROM_OUT_FILE awk '$4 ~ /libmbed/ {sum += $5} END {printf("%15s: %5d Bytes\n", "total", sum)}' } baremetal_build_gcc()