hw/mcu/dialog: Add MSPLIM support
This adds support for hardware stack limiter available in ARMv8-M.
It enables stack checking for MSP since PSP is already handled in
generic os_arch.
CRG_TOP_SYS_STAT_REG_COM_IS_DOWN_Msk | \
CRG_TOP_SYS_STAT_REG_RAD_IS_DOWN_Msk)
+extern uint8_t __StackLimit;
+
void SystemInit(void)
{
#if MYNEWT_VAL(OS_SCHEDULING) && MYNEWT_VAL(MCU_DEEP_SLEEP)
int idx;
#endif
+ __asm__ volatile (".syntax unified \n"
+ " msr msplim, %[msplim] \n"
+ :
+ : [msplim] "r" (&__StackLimit)
+ :
+ );
+
/* TODO: Check chip version.
assert(CHIP_VERSION->CHIP_ID1_REG == '2');
assert(CHIP_VERSION->CHIP_ID2_REG == '5');
