From 41d6465e1cc9de38f7d572eae11960adba350372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Derkacz?= Date: Mon, 7 May 2018 11:22:12 +0200 Subject: [PATCH] rebuild.sh: Handle RAM/Flash overflow error. --- rebuild.sh | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/rebuild.sh b/rebuild.sh index 7c9584fd..8412c18e 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -1,7 +1,5 @@ #!/bin/bash -set -e - ./clean.sh list=$(find egroot/src -type d) @@ -10,10 +8,14 @@ for p in $list; do if [ -n "$(find $p -maxdepth 1 -type f -name '*.go' |egrep -v '/_|/os|linux')" ]; then cd $p printf "%-44s " ${p#*/*/} - if egc $@; then - echo OK + result=$(egc $@ 2>&1) + if [ "$result" ]; then + echo "Error:" + echo + echo "$result" + echo else - echo Err + echo OK fi cd - >/dev/null fi @@ -25,12 +27,23 @@ for p in $list; do if [ -n "$(find $p -maxdepth 1 -type f -name '*.go' |grep -v '/_')" ]; then cd $p if [ -x ../build.sh ]; then - rm -f *.elf *.bin *.sizes printf "%-44s " ${p#*/*/} - if ../build.sh $@; then - echo OK + result=$(../build.sh $@ 2>&1) + if [ "$result" ]; then + overflow=$( + echo $result |grep "region \`.*' overflowed by .* bytes" \ + |sed "s/.*region \`\(.*\)' overflowed by \(.*\) b.*/\1 overflow: \2 B/g" + ) + if [ "$overflow" ]; then + echo "$overflow" + else + echo "Error:" + echo + echo "$result" + echo + fi else - echo Err + echo OK fi fi cd - >/dev/null