Hi,
I'm trying to run an STM32F103 on as little power as possible. Most of the time, the processor is in Standby, waking up occasionally on a RTC alarm interrupt.
When the processor wakes, from the current consumption, it appears that it takes approximately 2ms before I get to the start of my c main() function - which seems like a long time to me.
The processor is fitted with an 8MHz external xtal, but I'm hoping to start up on the HSI clock (which appears to be the case if I check with the debugger).
I'm using the Keil microlib; I know it will take some time to initialise memory etc. - but 2ms seems rather long. According to the hardware manual, the HCI startup time is 2us.
Can anyone give me an idea about what I'm missing? What is the processor doing for 2ms before it gets to main()?
Thanks in advance,
Jon.
The stack size is usually defined in startup_stm32f10x.s, usually pretty small by default, 512 bytes?
The initialization code is pretty efficient, a tight assembler loop, but I'd still expect it to take 3-4 cycles per 32-bit word to zero, and a few more to copy.
Try not to have 8.5 KB of space to zero