cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a function to find out how much flash memory the user application takes up?

JChan.0
Associate II

I am working on the Nucleo F429ZI, and I'm working on a dual bank configuration, and I have a function that erases the flash of the other bank and loads in a new user application. I'm wondering if there's an easy way, or available function call, to find out how much memory the user application in the other bank takes up before erasing it.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

There isn't a function that does this.

You can get the size of the flash and look for the last word that isn't 0xFFFFFFFF. This takes tens of milliseconds to do--pretty quick.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

There isn't a function that does this.

You can get the size of the flash and look for the last word that isn't 0xFFFFFFFF. This takes tens of milliseconds to do--pretty quick.

If you feel a post has answered your question, please click "Accept as Solution".

You could embedded as value in an unused vector table entry, allowing the linker to compute/place the value/symbol.

Should also consider signing the image with a CRC or HASH so the loader can validate the image before jumping into it. A signing tools could also embedded a size as part of the packaging process.

Basically you've got to facilitate the functionality you want.

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

The STM32CubeIDE does this by default (and shows static ram consumption). Look in the "Build Analyzer" window. Note it will only show you this after successful compilation.

hs2
Senior

What about erasing the size required by the new application which is usually known when installing ?

I‘m using signature data located right after fixed exception table reserved in linker script for image verification and ‚already installed‘ check.