AnsweredAssumed Answered

Usage Flash and SRAM

Question asked by cho.young_sang on Feb 4, 2016
Hello

I'm using the IAR compiler.
As you know, I can get the usage of Flash and SRAM inside of ST32f429 from "Map" file.
But I need to get those value on the my source code.
Is there any solution to get usage when compile time.
Here is my code but it didn't get right usage value.

#pragma segment=".text"
#pragma segment=".rodata"
#pragma segment="HEAP"
VOID MakeFreeInfo(VOID)
{
     unsigned int end_of_prog_text;
     unsigned int end_of_prog_rodata;
     unsigned int end_of_data;
          
     /* Get end of program address */
     end_of_prog_rodata = ((U32) __sfe(".rodata") + 4) & 0xFFFFFFFC;       
     end_of_prog_text = ((U32) __sfe(".text") + 4) & 0xFFFFFFFC;
     if (end_of_prog_rodata > end_of_prog_text)
       {
          USAGE_FLASH = end_of_prog_rodata - Addr_ROM;
       }
     else
       {
          USAGE_FLASH  = end_of_prog_text - Addr_ROM;
       }
.
.
.
}

Thank you,
Young

Outcomes