Cortex M0 startup time

I am using GCC on the STM32F070RB running at 48MHz, using FreeRTOS 9.0. I am trying to optimise startup time, so I can go back to power down mode as soon as possible. After power down the device is like it is reset, so I have to start FreeRTOS again. I was tracking down an issue with an initial vTaskDelay(1) taking > 300mS, but all subsequent calls were correct at 1mS. I started toggling a pin on the tick hook and noticed that the long delay was happening before the tick hook was being called. See attached picture to help explain (time division is 100mS and tick hook is accurately 1mS when started). So my question is, is this simply the minimum boot time? Or am I suffering from a bad set up that is causing these long initial delays? Thanks for your help.

Cortex M0 startup time

OK so I think I have tracked this down to the count value of the systick timer being higher than the reload value on initial boot. When I stepped through the timer setup I noticed the count value (SYSTCVR) was very high, so took a long time to count to 0 on the first run. After that SYSTRVR is set correctly so the timing is right. In portable/GCC/ARM_CM0/port.c if I add (portNVICSYSTICKCOUNT) = 0; to prvSetupTimerInterrupt function the problem goes away. Please see attached file for my changes. Is this a correct fix or am I not understanding the problem correctly?

Cortex M0 startup time

I’ve just noticed that this exact fix has been applied to the lastest version. I will upgrade to that and retest.

Cortex M0 startup time

Retested with 10.1.1 and problem is fixed. Sorry for the noise.

Cortex M0 startup time

Excellent – support requests that resolve themselves -thanks for reporting back :o)