From 1b6e933176cf0e011f9f8a720b9007654997e082 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 28 Aug 2018 15:04:48 -0700 Subject: [PATCH] Make.defs.in:Runtime Stack Checking in Nuttx Build Use CONFIG_ARMV7M_STACKCHECK to add the instrumentation for runtime stack checking --- platforms/nuttx/nuttx-configs/Make.defs.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platforms/nuttx/nuttx-configs/Make.defs.in b/platforms/nuttx/nuttx-configs/Make.defs.in index f85a7ef17f..dc0ec85fdf 100644 --- a/platforms/nuttx/nuttx-configs/Make.defs.in +++ b/platforms/nuttx/nuttx-configs/Make.defs.in @@ -64,7 +64,12 @@ ifeq ($(WINTOOL),y) MKDEP = $(TOPDIR)/tools/mknulldeps.sh endif -CFLAGS = -Os -g2 ${CMAKE_C_FLAGS} $(ARCHINCLUDES) \ +# enable precise stack overflow tracking +ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) + INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10 +endif + +CFLAGS = -Os -g2 ${CMAKE_C_FLAGS} $(ARCHINCLUDES) $(INSTRUMENTATIONDEFINES) \ -Wno-bad-function-cast \ -Wno-cpp \ -Wno-float-equal \ @@ -82,7 +87,7 @@ CFLAGS = -Os -g2 ${CMAKE_C_FLAGS} $(ARCHINCLUDES) \ -Wno-sign-compare \ -Wno-type-limits -CXXFLAGS = -Os -g2 ${CMAKE_CXX_FLAGS} $(ARCHXXINCLUDES) \ +CXXFLAGS = -Os -g2 ${CMAKE_CXX_FLAGS} $(ARCHXXINCLUDES) $(INSTRUMENTATIONDEFINES) \ -fcheck-new \ -fno-builtin \ -Wno-double-promotion \