From 4b8feb03cfca89b18ca88a19079e796b44f6d216 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 20 Jan 2015 17:36:55 -1000 Subject: Match the OS build's CONFIG_ARMV7M_STACKCHECK setting by using actual setting in the exported nuttx config.h file to control each board build setting of ENABLE_STACK_CHECKS in toolchain_gnu-arm-eabi.mk --- makefiles/setup.mk | 1 + makefiles/toolchain_gnu-arm-eabi.mk | 9 +++++---- nuttx-configs/aerocore/nsh/Make.defs | 5 +++-- nuttx-configs/px4fmu-v1/nsh/Make.defs | 5 +++-- nuttx-configs/px4fmu-v2/nsh/Make.defs | 9 ++------- nuttx-configs/px4fmu-v2/nsh/defconfig | 2 +- nuttx-configs/px4io-v1/nsh/Make.defs | 5 +++++ nuttx-configs/px4io-v2/nsh/Make.defs | 5 +++++ 8 files changed, 25 insertions(+), 16 deletions(-) mode change 100644 => 100755 makefiles/setup.mk mode change 100644 => 100755 makefiles/toolchain_gnu-arm-eabi.mk mode change 100644 => 100755 nuttx-configs/aerocore/nsh/Make.defs mode change 100644 => 100755 nuttx-configs/px4fmu-v1/nsh/Make.defs mode change 100644 => 100755 nuttx-configs/px4fmu-v2/nsh/Make.defs mode change 100644 => 100755 nuttx-configs/px4fmu-v2/nsh/defconfig mode change 100644 => 100755 nuttx-configs/px4io-v1/nsh/Make.defs mode change 100644 => 100755 nuttx-configs/px4io-v2/nsh/Make.defs diff --git a/makefiles/setup.mk b/makefiles/setup.mk old mode 100644 new mode 100755 index 4bfa7a087..c932a6758 --- a/makefiles/setup.mk +++ b/makefiles/setup.mk @@ -80,6 +80,7 @@ export ECHO = echo export UNZIP_CMD = unzip export PYTHON = python export OPENOCD = openocd +export GREP = grep # # Host-specific paths, hacks and fixups diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk old mode 100644 new mode 100755 index 0d681cacc..d4d73fb84 --- a/makefiles/toolchain_gnu-arm-eabi.mk +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -80,11 +80,12 @@ ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \ -march=armv7-m \ -mfloat-abi=soft -# Enabling stack checks if requested +# Enabling stack checks if OS was build with them # -ENABLE_STACK_CHECKS ?= 0 -ifneq ($(ENABLE_STACK_CHECKS),0) -$(info Stack checks enabled) +TEST_FILE_STACKCHECK=$(WORK_DIR)nuttx-export/include/nuttx/config.h +TEST_VALUE_STACKCHECK=CONFIG_ARMV7M_STACKCHECK\ 1 +ENABLE_STACK_CHECKS=$(shell $(GREP) -q "$(TEST_VALUE_STACKCHECK)" $(TEST_FILE_STACKCHECK); echo $$?;) +ifeq ("$(ENABLE_STACK_CHECKS)","0") ARCHINSTRUMENTATIONDEFINES_CORTEXM4F = -finstrument-functions -ffixed-r10 ARCHINSTRUMENTATIONDEFINES_CORTEXM4 = -finstrument-functions -ffixed-r10 ARCHINSTRUMENTATIONDEFINES_CORTEXM3 = diff --git a/nuttx-configs/aerocore/nsh/Make.defs b/nuttx-configs/aerocore/nsh/Make.defs old mode 100644 new mode 100755 index c1f5a8ac4..3808fc1cf --- a/nuttx-configs/aerocore/nsh/Make.defs +++ b/nuttx-configs/aerocore/nsh/Make.defs @@ -62,8 +62,9 @@ ARCHCPUFLAGS = -mcpu=cortex-m4 \ # enable precise stack overflow tracking -INSTRUMENTATIONDEFINES = -finstrument-functions \ - -ffixed-r10 +ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) +INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10 +endif # pull in *just* libm from the toolchain ... this is grody LIBM = "${shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a}" diff --git a/nuttx-configs/px4fmu-v1/nsh/Make.defs b/nuttx-configs/px4fmu-v1/nsh/Make.defs old mode 100644 new mode 100755 index 5e28f2473..4e08d28a2 --- a/nuttx-configs/px4fmu-v1/nsh/Make.defs +++ b/nuttx-configs/px4fmu-v1/nsh/Make.defs @@ -62,8 +62,9 @@ ARCHCPUFLAGS = -mcpu=cortex-m4 \ # enable precise stack overflow tracking -INSTRUMENTATIONDEFINES = -finstrument-functions \ - -ffixed-r10 +ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) +INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10 +endif # pull in *just* libm from the toolchain ... this is grody LIBM = "${shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a}" diff --git a/nuttx-configs/px4fmu-v2/nsh/Make.defs b/nuttx-configs/px4fmu-v2/nsh/Make.defs old mode 100644 new mode 100755 index b2f05293d..5a1d5af2c --- a/nuttx-configs/px4fmu-v2/nsh/Make.defs +++ b/nuttx-configs/px4fmu-v2/nsh/Make.defs @@ -62,13 +62,8 @@ ARCHCPUFLAGS = -mcpu=cortex-m4 \ # enable precise stack overflow tracking -ENABLE_STACK_CHECKS ?= 0 -ifneq ($(ENABLE_STACK_CHECKS),0) -$(info Stack checks enabled) -INSTRUMENTATIONDEFINES = -finstrument-functions \ - -ffixed-r10 -else -INSTRUMENTATIONDEFINES = +ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) +INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10 endif # pull in *just* libm from the toolchain ... this is grody diff --git a/nuttx-configs/px4fmu-v2/nsh/defconfig b/nuttx-configs/px4fmu-v2/nsh/defconfig old mode 100644 new mode 100755 index 9030a1f02..dedebdfa0 --- a/nuttx-configs/px4fmu-v2/nsh/defconfig +++ b/nuttx-configs/px4fmu-v2/nsh/defconfig @@ -117,7 +117,7 @@ CONFIG_ARCH_HAVE_MPU=y # # CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI=y -CONFIG_ARMV7M_STACKCHECK=y +CONFIG_ARMV7M_STACKCHECK=n CONFIG_SERIAL_TERMIOS=y CONFIG_SDIO_DMA=y CONFIG_SDIO_DMAPRIO=0x00010000 diff --git a/nuttx-configs/px4io-v1/nsh/Make.defs b/nuttx-configs/px4io-v1/nsh/Make.defs old mode 100644 new mode 100755 index b4f5577ae..74f38c0cb --- a/nuttx-configs/px4io-v1/nsh/Make.defs +++ b/nuttx-configs/px4io-v1/nsh/Make.defs @@ -58,6 +58,11 @@ ARCHCPUFLAGS = -mcpu=cortex-m3 \ -mthumb \ -march=armv7-m +# enable precise stack overflow tracking +ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) +INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10 +endif + # use our linker script LDSCRIPT = ld.script diff --git a/nuttx-configs/px4io-v2/nsh/Make.defs b/nuttx-configs/px4io-v2/nsh/Make.defs old mode 100644 new mode 100755 index 51420eb23..287466db6 --- a/nuttx-configs/px4io-v2/nsh/Make.defs +++ b/nuttx-configs/px4io-v2/nsh/Make.defs @@ -58,6 +58,11 @@ ARCHCPUFLAGS = -mcpu=cortex-m3 \ -mthumb \ -march=armv7-m +# enable precise stack overflow tracking +ifeq ($(CONFIG_ARMV7M_STACKCHECK),y) +INSTRUMENTATIONDEFINES = -finstrument-functions -ffixed-r10 +endif + # use our linker script LDSCRIPT = ld.script -- cgit v1.2.3