cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the size of Firmware and copy it ?

simoBen47
Associate III

Hey everyone,

I need to do some operations on Firmware, and i am asking on how to recover its size and store it ?

I am using STM32F401RE.

Simo

11 REPLIES 11
simoBen47
Associate III

text data bss dec hex filename

34660 556 74860 110076 1adfc taskN_dev.elf

"text" represents the firmware ? its size is 34k, is that right ?

The size in flash is going to combine text+data

Depending on the linker script symbols, the end address will be

_sidata + (_edata - _sdata)

You could even add your own symbol beyond the end of the data packed in the FLASH

For the hash, you have 32768 bytes, not 8192, and you could hash in situ.

SHA256Reset(&ctx);

SHA256Input(&ctx, (const uint8_t *) BASE_ADDR_SECTOR_0, 32768); // 0x08000000..0x08007FFF

SHA256Result(&ctx, msg_digest);

SHA256Reset(&ctx);

SHA256Input(&ctx, (const uint8_t *) BASE_ADDR_SECTOR_0, 16384);

SHA256Input(&ctx, (const uint8_t *) BASE_ADDR_SECTOR_1, 16384);

SHA256Result(&ctx, msg_digest);

Not sure the point of the data_store variables, and adding things to it.

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