I’ve continued evaluating the problem in the debugger by adding some debug variables. This shows why the assertion fails.
volatile uint32_t test3257 = 5;
volatile uint32_t test3258 = 6;
volatile uint32_t test3259 = 7;void vTaskStepTick( TickType_t xTicksToJump ) { TickType_t xUpdatedTickCount; traceENTER_vTaskStepTick( xTicksToJump ); /* Correct the tick count value after a period during which the tick * was suppressed. Note this does *not* call the tick hook function for * each stepped tick. */ test3257 = xTickCount; test3258 = xTicksToJump; xUpdatedTickCount = test3257 + test3258;// xUpdatedTickCount = xTickCount + xTicksToJump;
test3259 = xNextTaskUnblockTime; configASSERT( xUpdatedTickCount <= test3259 );// configASSERT( xUpdatedTickCount <= xNextTaskUnblockTime );
…
test3257 is set to a value of 20009FFF₁₆, which is the end of RAM and not the tick count. The other two test variables are correct. This triggers the exception.
the corresponding assembly is
4574 test3257 = xTickCount;
08005d60: ldr r3, [pc, #228] ; (0x8005e48 <prvIdleTask.lto_priv.55+636>) // load addr of variable test3257 to r3
08005d62: ldr r2, [r7, #0] //load value of xTickCount by de-referencing r7
08005d64: str r2, [r3, #0] //store
the line where r7 is set to the address of xTickCount is before entering/leaving sleep mode. Any idea if this might cause the problem?
Another strange thing is, this happens only on power-up / cold boot, not on reset. After a reset the values are correct and the system boots normally.