Skip to main content
JChan.0
Associate II
June 17, 2020
Solved

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

  • June 17, 2020
  • 4 replies
  • 899 views

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.

    This topic has been closed for replies.
    Best answer by TDK

    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.

    4 replies

    TDK
    TDKBest answer
    June 17, 2020

    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""."
    Tesla DeLorean
    Guru
    June 18, 2020

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

    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
    Visitor II
    June 18, 2020

    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.