Skip to main content
simoBen47
Associate III
August 9, 2018
Question

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

  • August 9, 2018
  • 11 replies
  • 4013 views

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

This topic has been closed for replies.

11 replies

Tesla DeLorean
Guru
August 23, 2018

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..