Minimizing "boot" time ?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

geoffrey.brown
Posts: 34
Joined: Thu May 07, 2015 9:47 pm
Been thanked: 7 times

Minimizing "boot" time ?

Postby geoffrey.brown » Mon Jul 09, 2018 5:10 pm

If you use standby mode on the stm32l4 then every return from standby requires a "reboot" of ChibiOS. I'm curious how to configure ChibiOS to minimize this cost. I'm doing some things to keep stuff out of initialized memory, but I'm not sure I'm doing the best job. The only device drivers I need are SPI, I2C, and RTC.

Geoffrey

User avatar
Giovanni
Site Admin
Posts: 11025
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 354 times
Been thanked: 298 times
Contact:

Re: Minimizing "boot" time ?

Postby Giovanni » Mon Jul 09, 2018 7:18 pm

Hi,

Exiting from standby involves reinitializing the clock tree, the time is spent there waiting for PLLs, drivers initialization does not take much time. Reducing initialized memory helps for sure. Avoid those options that require memory manipulation, filling of stacks for example.

Giovanni

geoffrey.brown
Posts: 34
Joined: Thu May 07, 2015 9:47 pm
Been thanked: 7 times

Re: Minimizing "boot" time ?

Postby geoffrey.brown » Mon Jul 09, 2018 8:10 pm

Thanks ! Just using MSI so no PLLs. Which things might be expensive from memory manipulation besides filling stacks (is that always done ?).

User avatar
Giovanni
Site Admin
Posts: 11025
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 354 times
Been thanked: 298 times
Contact:

Re: Minimizing "boot" time ?

Postby Giovanni » Mon Jul 09, 2018 9:19 pm

Uninitialized variables need zeroing, initialized variables need initialization which is just a bit slower. Note that placing variables into an uninitialized RAM is a dubious advantage because you will still need to initialize them at some point, however it allows to defer initialization.

In general:
- Defer initializations of small variables where applicable but this will not give you huge advantages.
- Put large buffers in uninitialized areas, probably you don't need to clear those at all. The ChibiOS heap is an example, it is not initialized.
- Prefer automatic variables to static ones, static const variables to writable ones.
- In general make your DATA and BSS segments as small as possible.
- Do not initialize (and enable) drivers you don't need or defer the activation with xxxStart().

Giovanni

geoffrey.brown
Posts: 34
Joined: Thu May 07, 2015 9:47 pm
Been thanked: 7 times

Re: Minimizing "boot" time ?

Postby geoffrey.brown » Mon Jul 09, 2018 10:29 pm

Thanks again ! I think I'm doing most of those things, although I do need to systematically go through all the allocated variables to make sure.
Geoffrey

rew
Posts: 235
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 3 times

Re: Minimizing "boot" time ?

Postby rew » Tue Jul 17, 2018 7:48 pm

There is this trick that defeats some security mechanisms. You boot the processor, let it run for some number of microseconds and then halt the CPU. To recover the protected FLASH, you need to read SRAM memory, but in your case you should take note of the PC value. Now you have a profile of what costs a lot of time and what doesn't.... Doing performance improvements based on a measurement of the performance is much more effective than just guessing.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 2 guests