From ed72803858ac2f3711dff0ea5555aa89bfb9c001 Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Tue, 22 May 2018 11:11:42 +0300 Subject: [PATCH] Added FAST_RAM usage correctness check --- .travis.sh | 1 + Makefile | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/.travis.sh b/.travis.sh index 1be2465df8c..7e5d7808315 100755 --- a/.travis.sh +++ b/.travis.sh @@ -68,6 +68,7 @@ elif [ $TARGET ] ; then elif [ $GOAL ] ; then if [ "test" == "$GOAL" ] ; then $MAKE check-target-independence || exit $? + $MAKE check-fastram-usage-correctness || exit $? fi $MAKE $GOAL || exit $? diff --git a/Makefile b/Makefile index d939fb3db31..80595b78dc3 100644 --- a/Makefile +++ b/Makefile @@ -485,6 +485,21 @@ check-target-independence: fi; \ done +check-fastram-usage-correctness: + $(V1) NON_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM_ZERO_INIT\W.*=.*" src/main/ | grep -Ev "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \ + if [ "$${NON_TRIVIALLY_INITIALIZED}" != "" ]; then \ + echo "Non-trivially initialized FAST_RAM_ZERO_INIT variables found, use FAST_RAM instead:"; \ + echo "$${NON_TRIVIALLY_INITIALIZED}"; \ + exit 1; \ + fi; \ + TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM\W.*;" src/main/ | grep -v "="); \ + EXPLICITLY_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM\W.*;" src/main/ | grep -E "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \ + if [ "$${TRIVIALLY_INITIALIZED}$${EXPLICITLY_TRIVIALLY_INITIALIZED}" != "" ]; then \ + echo "Trivially initialized FAST_RAM variables found, use FAST_RAM_ZERO_INIT instead to save FLASH:"; \ + echo "$${TRIVIALLY_INITIALIZED}\n$${EXPLICITLY_TRIVIALLY_INITIALIZED}"; \ + exit 1; \ + fi; + # rebuild everything when makefile changes $(TARGET_OBJS) : Makefile