Skip to content

Commit

Permalink
rebuild.sh: Handle RAM/Flash overflow error.
Browse files Browse the repository at this point in the history
  • Loading branch information
michalderkacz committed May 7, 2018
1 parent 9338b92 commit 41d6465
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions rebuild.sh
@@ -1,7 +1,5 @@
#!/bin/bash

set -e

./clean.sh

list=$(find egroot/src -type d)
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 41d6465

Please sign in to comment.