worst case analysis of stack usage (#7883)

* Makefile target "check_stack"
This commit is contained in:
Julien Lecoeur
2017-09-10 13:34:34 -04:00
committed by Daniel Agar
parent 24ed06156e
commit ceeae7587e
4 changed files with 422 additions and 0 deletions
+15
View File
@@ -363,6 +363,21 @@ cppcheck: posix_sitl_default
@cppcheck -i$(SRC_DIR)/src/examples --std=c++11 --std=c99 --std=posix --project=build_posix_sitl_default/compile_commands.json --xml-version=2 2> cppcheck-result.xml
@cppcheck-htmlreport --source-encoding=ascii --file=cppcheck-result.xml --report-dir=cppcheck --source-dir=$(SRC_DIR)/src/
check_stack: px4fmu-v3_default
@echo "Checking worst case stack usage with avstack.pl ..."
@echo " "
@cd build_px4fmu-v3_default/ && mkdir -p stack_usage && $(SRC_DIR)/Tools/stack_usage/avstack.pl `find . -name *.obj` > stack_usage/avstack_output.txt 2> stack_usage/avstack_errors.txt
@head -n 10 build_px4fmu-v3_default/stack_usage/avstack_output.txt | c++filt
@echo " "
@echo "Checking worst case stack usage with checkstack.pl ..."
@echo " "
@echo "Top 10:"
@cd build_px4fmu-v3_default/ && mkdir -p stack_usage && arm-none-eabi-objdump -d src/firmware/nuttx/firmware_nuttx | $(SRC_DIR)/Tools/stack_usage/checkstack.pl arm 0 > stack_usage/checkstack_output.txt 2> stack_usage/checkstack_errors.txt
@head -n 10 build_px4fmu-v3_default/stack_usage/checkstack_output.txt | c++filt
@echo " "
@echo "Symbols with 'main', 'thread' or 'task':"
@cat build_px4fmu-v3_default/stack_usage/checkstack_output.txt | c++filt | grep -E 'thread|main|task'
# Cleanup
# --------------------------------------------------------------------
.PHONY: clean submodulesclean distclean