summaryrefslogtreecommitdiff
path: root/.github/workflows/getSize.sh
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/getSize.sh')
-rwxr-xr-x.github/workflows/getSize.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/.github/workflows/getSize.sh b/.github/workflows/getSize.sh
new file mode 100755
index 00000000..52a86132
--- /dev/null
+++ b/.github/workflows/getSize.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Requires environment variables from docker/build.sh
+
+set -e
+
+SIZE_BIN="$TOOLS_DIR/$GCC_ARM_PATH/bin/arm-none-eabi-size"
+[ ! -x "$SIZE_BIN" ] && exit 1
+
+[ -z "$1" ] && exit 1
+SIZE_OUTPUT=$($SIZE_BIN "$1" | tail -n1)
+
+TEXT_SIZE=$(echo "$SIZE_OUTPUT" | cut -f 1 |tr -d '[:blank:]')
+DATA_SIZE=$(echo "$SIZE_OUTPUT" | cut -f 2 |tr -d '[:blank:]')
+BSS_SIZE=$(echo "$SIZE_OUTPUT" | cut -f 3 |tr -d '[:blank:]')
+
+echo "text_size=$TEXT_SIZE"
+echo "data_size=$DATA_SIZE"
+echo "bss_size=$BSS_SIZE"