Skip to content

Commit

Permalink
Added FAST_RAM usage correctness check
Browse files Browse the repository at this point in the history
  • Loading branch information
DieHertz committed May 23, 2018
1 parent d8dd6f2 commit ed72803
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.sh
Expand Up @@ -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 $?
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Expand Up @@ -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

Expand Down

0 comments on commit ed72803

Please sign in to comment.