summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-06-02 17:59:43 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-06-02 17:59:43 +0200
commitdbcaa670d97b6676e5f0f357ff2de76dd497420b (patch)
treee781e95d122cff8096f8b240f00d94c67b28aee0 /nuttx/arch/arm/src/stm32
parentae4a2c022ed4f01a14afa422f2cd62b7c5aef73f (diff)
parent80a7f76152acab6d864047925069516eebea6543 (diff)
downloadpx4-nuttx-dbcaa670d97b6676e5f0f357ff2de76dd497420b.tar.gz
px4-nuttx-dbcaa670d97b6676e5f0f357ff2de76dd497420b.tar.bz2
px4-nuttx-dbcaa670d97b6676e5f0f357ff2de76dd497420b.zip
Merge branch 'stack_check' into integration
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-rw-r--r--nuttx/arch/arm/src/stm32/Make.defs4
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_start.c16
2 files changed, 20 insertions, 0 deletions
diff --git a/nuttx/arch/arm/src/stm32/Make.defs b/nuttx/arch/arm/src/stm32/Make.defs
index cb979957d..3b210a833 100644
--- a/nuttx/arch/arm/src/stm32/Make.defs
+++ b/nuttx/arch/arm/src/stm32/Make.defs
@@ -54,6 +54,10 @@ CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c
CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c
CMN_CSRCS += up_svcall.c up_stackcheck.c up_vfork.c
+ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
+CMN_CSRCS += up_stackcheck.c
+endif
+
ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
CMN_ASRCS += up_exception.S
CMN_CSRCS += up_vectors.c
diff --git a/nuttx/arch/arm/src/stm32/stm32_start.c b/nuttx/arch/arm/src/stm32/stm32_start.c
index a2f82f7b2..add226b07 100644
--- a/nuttx/arch/arm/src/stm32/stm32_start.c
+++ b/nuttx/arch/arm/src/stm32/stm32_start.c
@@ -77,6 +77,16 @@
#endif
/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_ARMV7M_STACKCHECK
+/* we need to get r10 set before we can allow instrumentation calls */
+
+void __start(void) __attribute__ ((no_instrument_function));
+#endif
+
+/****************************************************************************
* Name: stm32_fpuconfig
*
* Description:
@@ -183,6 +193,12 @@ void __start(void)
const uint32_t *src;
uint32_t *dest;
+#ifdef CONFIG_ARMV7M_STACKCHECK
+ /* Set the stack limit before we attempt to call any functions */
+
+ __asm__ volatile ("sub r10, sp, %0" : : "r" (CONFIG_IDLETHREAD_STACKSIZE - 64) : );
+#endif
+
/* Configure the uart so that we can get debug output as soon as possible */
stm32_clockconfig();