cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f429 start up code time

ASSAAD.ASSAAD
Associate II
Posted on July 14, 2018 at 20:50

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-stm32f429
5 REPLIES 5
Posted on July 14, 2018 at 22:11

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
henry.dick
Senior II
Posted on July 14, 2018 at 22:12

'

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?

...

ASSAAD.ASSAAD
Associate II
Posted on July 15, 2018 at 12:15

Hello , thank you for repleis ; 

here is the assembly code in s file 

Reset_Handler PROC

EXPORT Reset_Handler [WEAK]

IMPORT SystemInit

IMPORT __main

LDR R0, =SystemInit

BLX R0

LDR R0, =__main

BX R0

ENDP

when 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 to 

274683 ! , 

ASSAAD.ASSAAD
Associate II
Posted on July 15, 2018 at 13:01

after debug in the assembly i found that the software goes to main scatterload , 

what  does it main ? and how can i delete it ? 

Posted on July 15, 2018 at 15:00

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..