aboutsummaryrefslogtreecommitdiff
path: root/makefiles/toolchain_gnu-arm-eabi.mk
diff options
context:
space:
mode:
Diffstat (limited to 'makefiles/toolchain_gnu-arm-eabi.mk')
-rw-r--r--makefiles/toolchain_gnu-arm-eabi.mk33
1 files changed, 26 insertions, 7 deletions
diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk
index d38ef645f..512ceab2a 100644
--- a/makefiles/toolchain_gnu-arm-eabi.mk
+++ b/makefiles/toolchain_gnu-arm-eabi.mk
@@ -80,13 +80,31 @@ ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \
-march=armv7-m \
-mfloat-abi=soft
-ARCHINSTRUMENTATIONDEFINES_CORTEXM4F = -finstrument-functions \
- -ffixed-r10
-
-ARCHINSTRUMENTATIONDEFINES_CORTEXM4 = -finstrument-functions \
- -ffixed-r10
+#
+# Tool to test a Nuttx Config value from config.h
+#
-ARCHINSTRUMENTATIONDEFINES_CORTEXM3 =
+NUTTX_CONFIG_H=$(WORK_DIR)nuttx-export/include/nuttx/config.h
+define check_nuttx_config
+$(strip $(shell $(GREP) -q $1 $2;echo -n $$?;))
+endef
+nuttx_config_true:="0"
+nuttx_config_2true:="0 0"
+
+#
+# Enabling stack checks if OS was build with them
+#
+
+ENABLE_STACK_CHECKS=$(call check_nuttx_config ,"CONFIG_ARMV7M_STACKCHECK 1", $(NUTTX_CONFIG_H))
+ifeq ("$(ENABLE_STACK_CHECKS)",$(nuttx_config_true))
+ARCHINSTRUMENTATIONDEFINES_CORTEXM4F = -finstrument-functions -ffixed-r10
+ARCHINSTRUMENTATIONDEFINES_CORTEXM4 = -finstrument-functions -ffixed-r10
+ARCHINSTRUMENTATIONDEFINES_CORTEXM3 =
+else
+ARCHINSTRUMENTATIONDEFINES_CORTEXM4F =
+ARCHINSTRUMENTATIONDEFINES_CORTEXM4 =
+ARCHINSTRUMENTATIONDEFINES_CORTEXM3 =
+endif
# Pick the right set of flags for the architecture.
#
@@ -105,7 +123,7 @@ ARCHDEFINES += -DCONFIG_ARCH_BOARD_$(CONFIG_BOARD)
# optimisation flags
#
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \
- -g \
+ -g3 \
-fno-strict-aliasing \
-fno-strength-reduce \
-fomit-frame-pointer \
@@ -318,3 +336,4 @@ define BIN_TO_OBJ
--rename-section .data=.rodata
$(Q) $(REMOVE) $2.c $2.c.o
endef
+