diff --git a/furi/core/check.c b/furi/core/check.c index 00c20575a..cf1b790e8 100644 --- a/furi/core/check.c +++ b/furi/core/check.c @@ -24,7 +24,8 @@ PLACE_IN_SECTION("MB_MEM2") uint32_t __furi_check_registers[12] = {0}; : \ : "memory"); -// Restore registers and halt MCU +#ifdef FURI_DEBUG +// Restore registers and halt MCU with bkpt mcu debug state #define RESTORE_REGISTERS_AND_HALT_MCU() \ asm volatile("ldr r12, =__furi_check_registers \n" \ "ldm r12, {r0-r11} \n" \ @@ -35,6 +36,18 @@ PLACE_IN_SECTION("MB_MEM2") uint32_t __furi_check_registers[12] = {0}; : \ : \ : "memory"); +#else +// Restore registers and halt MCU for release builds without bkpt instruction +#define RESTORE_REGISTERS_AND_HALT_MCU() \ + asm volatile("ldr r12, =__furi_check_registers \n" \ + "ldm r12, {r0-r11} \n" \ + "loop%=: \n" \ + "wfi \n" \ + "b loop%= \n" \ + : \ + : \ + : "memory"); +#endif extern size_t xPortGetTotalHeapSize(void); extern size_t xPortGetFreeHeapSize(void);