2018-07-14 11:50 AM
Hello All;
I am using STM32f429 ; my device should wakeup every 10 seconds to check the battery . We noticed that the time need after reset before going to the Main routine is about 17ms ! we found every time teh CYCCNT is 274683 cycle at 16MHZ internal osc just excuting the
SystemInit routine . also I can see it on oscolliscope. how can I reduce this time using the internal osc. ? Thank you in advanced
void SystemInit(void)
{ /* FPU settings ------------------------------------------------------------*/ // &sharpif (__FPU_PRESENT == 1) && (__FPU_USED == 1) SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */ // &sharpendif /* Reset the RCC clock configuration to the default reset state ------------*/ /* Set HSION bit */ RCC->CR |= (uint32_t)0x00000001;/* Reset CFGR register */
RCC->CFGR = 0x00000000;/* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF;/* Reset PLLCFGR register */
RCC->PLLCFGR = 0x24003010;/* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF;/* Disable all interrupts */
RCC->CIR = 0x00000000; /* Configure the Vector Table location add offset address ------------------*/&sharpifdef VECT_TAB_SRAM SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */&sharpelse SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */&sharpendif}//----------------------
#systeminit-stm32f4292018-07-14 01:11 PM
I don't see any code there that would contribute any cycles to that sort of total.
The processor should run at 16 MHz without doing anything else. The FPU will need enabling, but VTOR should be zero and viable.
2018-07-14 01:12 PM
'
about 17ms
'
it sounds too long. unfortunately you didn't provide enough information to help others help you.
1) you do you determine that it is 17ms?
2) what does the start-up file look like? you may have used some custom start-up routines - as you didn't say.
3) what does the reset circuitry look like?
...
2018-07-15 03:15 AM
Hello , thank you for repleis ;
here is the assembly code in s file
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]IMPORT SystemInitIMPORT __mainLDR R0, =SystemInit
BLX R0LDR R0, =__mainBX R0ENDPwhen I put break point on LDR R0=_main I can see the cycle count is just 60 and that the systemInit routine cyle but when I passed to BX R0 the cycle counter changes
from 60 to274683 ! ,
2018-07-15 04:01 AM
after debug in the assembly i found that the software goes to main scatterload ,
what does it main ? and how can i delete it ?
2018-07-15 08:00 AM
The scatter loader copies and zeros global RAM data.
Try to use auto variables instead of global where possible.
If arrays and other large use doesn't change, consider using 'static const' to keep it in flash.
If stuff isn't important put it in a 'NOINIT' section.
Consider having SystemInit() speed up the processor, if it runs quicker the copy will take less time. Would need to quantify time to lock PLL.
Consider having code in Reset_Handler manage wake/sleep efficiently so you only start your full application when you need it.