nrf52: add stackcheck support
This commit is contained in:
parent
c33040f0cf
commit
e5200d4af9
@ -209,6 +209,7 @@ config ARCH_CHIP_NRF52
|
||||
bool "Nordic NRF52"
|
||||
select ARCH_CORTEXM4
|
||||
select ARCH_HAVE_TICKLESS
|
||||
select ARMV7M_HAVE_STACKCHECK
|
||||
#select ARCH_HAVE_MPU
|
||||
#select ARM_HAVE_MPU_UNIFIED
|
||||
select ARCH_HAVE_SPI_BITORDER
|
||||
|
@ -80,6 +80,10 @@ ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||
CMN_CSRCS += arm_checkstack.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
|
||||
CMN_CSRCS += arm_stackcheck.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_copyarmstate.c
|
||||
|
@ -81,6 +81,12 @@
|
||||
* Private 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
|
||||
|
||||
#ifdef CONFIG_STACK_COLORATION
|
||||
static void go_nx_start(void *pv, unsigned int nbytes)
|
||||
__attribute__ ((naked, no_instrument_function, noreturn));
|
||||
@ -231,6 +237,13 @@ 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
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
|
||||
__asm__ __volatile__ ("\tcpsid i\n");
|
||||
|
Loading…
Reference in New Issue
Block a user