2026-05-06 2:42 AM
My code is as follows.
volatile uint8_t d_deadcode = 0U;
void sleepManagement(void)
{
if ((isIgnActive(IGN_1, getGpioInput(GPIO_IN_IGN_1))) ||
(isIgnActive(IGN_2, getGpioInput(GPIO_IN_IGN_2))))
{
return; /* ign sig exist */
}
if (isSleepSync())
{
sleepEntryHandler();
d_deadcode = 1U;
}
else
{
updateDateOld();
requestSleepSync();
}
}
static void sleepEntryHandler(void)
{
uint32_t rtcWakeup;
irqIsrDisable();
deinitApp();
if (ignOff1hrElapsed.state == OFF)
{
rtcWakeup = TIME_IGN_OFF_LOAD_60MIN - ignOff1hrElapsed.onTimer;
startRtc(rtcWakeup);
}
startWkpu();
enterStandby0();
}
void enterStandby0(void)
{
/*
* PD0(8KB): always retained, not programmable
* PD1(32KB): always lost in STANDBY0, not programmable
* PD2(56KB): retain in STANDBY0
*/
MC_PCU.PCONF2.B.STBY0 = ON;
if (SPCSetRunMode(SPC5_RUNMODE_STANDBY0) == CLOCK_FAILED)
{
SPC5_CLOCK_FAILURE_HOOK();
}
}I expected that when the device enters sleep mode and is woken up by the WKPU, a reset would occur and the crt0 routine would execute.
In reality, when I wake the device without a debugger connected and attach the T32 to check the d_deadcode value, it is 0.
However, when the device is woken up with the T32 connected, a breakpoint can be set at the line d_deadcode = 1U;, and an unintended hard fault occurs, causing it to fall into IVOR.
Does the debugger connection interfere with the device's low-power mode transition?