Minimal bootloader

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
willrow
Level 1
Level 1
First question asked Welcome!

Hello,

I have followed the example to create a bootloader and configured it for UART communication and removed the blue LED. I can build upload and run the project - everything works great!

My question is can the bootloader be optimised for size? Currently I am using 5397 bytes on the bootloader and my application is approaching 10000 bytes not leaving much overhead for the development I am still to do. The total flash size is 16384 bytes. It feels a bit off to me that the bootloader should take almost one third of available flash. Any advice or recommendations here would be greatly appreciated.

Thanks!

Will

0 Likes
1 Solution
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

You can change the size by changing the optimization build setting.

Open your project in Creator, then:
Project tab, Build Settings..., ARM GCC, expand Compiler, Optimization.  In the Optimization window, change the setting for Optimization Level to Size.  You need to click your mouse next to the word on the right (usually shows the word None  as default).  This will activate a down arrow for a drop down menu.

You can try different Optimization settings to find the smallest build.

Also, when you build the bootloader, from Creator screen, choose Release instead of Debug.  Yes, this will stop your debugging capability, but it will also give you a smaller memory footprint.  Do this after you've debugged the code if you're running short of FLASH space.

In Bootloader component datasheet, 5LP bootloader should be around 4600 bytes for I2C bootloading.  But, not mentioned for UART bootloading.

Hope this helps.
Good luck with your project.

edit: Judging by the FLASH size of your bootloader, I suspect you've already optimized the build settings.

edit: In application note AN68272, a section called Memory Requirement for Bootloader, gives details of how to reduce FLASH size.
1) Remove Bootloader optional commands by unchecking the boxes in Bootloader component configuration
2) In .cydwr System tab, set Device Configuration Mode to Compressed.

View solution in original post

0 Likes
1 Reply
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

You can change the size by changing the optimization build setting.

Open your project in Creator, then:
Project tab, Build Settings..., ARM GCC, expand Compiler, Optimization.  In the Optimization window, change the setting for Optimization Level to Size.  You need to click your mouse next to the word on the right (usually shows the word None  as default).  This will activate a down arrow for a drop down menu.

You can try different Optimization settings to find the smallest build.

Also, when you build the bootloader, from Creator screen, choose Release instead of Debug.  Yes, this will stop your debugging capability, but it will also give you a smaller memory footprint.  Do this after you've debugged the code if you're running short of FLASH space.

In Bootloader component datasheet, 5LP bootloader should be around 4600 bytes for I2C bootloading.  But, not mentioned for UART bootloading.

Hope this helps.
Good luck with your project.

edit: Judging by the FLASH size of your bootloader, I suspect you've already optimized the build settings.

edit: In application note AN68272, a section called Memory Requirement for Bootloader, gives details of how to reduce FLASH size.
1) Remove Bootloader optional commands by unchecking the boxes in Bootloader component configuration
2) In .cydwr System tab, set Device Configuration Mode to Compressed.

0 Likes