cancel
Showing results for 
Search instead for 
Did you mean: 

Firmware size

sirpak
Associate II

Dear Sirs,

Is there a method to calculate the firmware size?

I am using STM32F103R8T6

My flash memory is divided in three blocks:

- Custom boot loader block

- Main application block

- Data block

When the main application is running, it needs to calculate its own size in terms of quantity of bytes in flash.

This is needed in order to calculate the CRC of the firmware.

Some pages at the end of main application block range might not have been erased, so I think I cannot count on 0xFFFFFF presence. Furthermore the firmware might finish with 0xFF.

Maybe the .hex file starts with the program counter initialization, followed by some useful information??

 

Thanks,

Marco

2 REPLIES 2

Can't you use some Linker Script symbols to scope the image size?

Covered on the forum previously. Can also place size in one of the slack vectors in the table so tools can recover. 

Can determine also from object file structures, ie LOADBITS and via what the .HEX touches

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

@sirpak wrote:

This is needed in order to calculate the CRC of the firmware


Why?

Why not just calculate the CRC over the entire region of memory dedicated to the application?