This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Get maximal free flash size at runtime

Is it possible to determine the maximal free/usable flash size at runtime? Assuming a memory layout as shown here, is there a register that keeps the end boundary of the application? something like UICR.BOOTLOADERADDR.

Parents
  • Thanks for pointing me into the right direction.

    In Keil you can use these linker symbols to get location and length of the image.

    extern uint32_t Load$$LR$$LR_IROM1$$Base; // Address of the load region.
    extern uint32_t Load$$LR$$LR_IROM1$$Length; // Length of the load region in bytes.
    extern uint32_t Load$$LR$$LR_IROM1$$Limit; // Address of the byte beyond the end of the load region.
    
    uint32_t LROBase = (uint32_t)&Load$$LR$$LR_IROM1$$Base;
    uint32_t LROLength = (uint32_t)&Load$$LR$$LR_IROM1$$Length;
    uint32_t LROLimit = (uint32_t)&Load$$LR$$LR_IROM1$$Limit;
    
Reply
  • Thanks for pointing me into the right direction.

    In Keil you can use these linker symbols to get location and length of the image.

    extern uint32_t Load$$LR$$LR_IROM1$$Base; // Address of the load region.
    extern uint32_t Load$$LR$$LR_IROM1$$Length; // Length of the load region in bytes.
    extern uint32_t Load$$LR$$LR_IROM1$$Limit; // Address of the byte beyond the end of the load region.
    
    uint32_t LROBase = (uint32_t)&Load$$LR$$LR_IROM1$$Base;
    uint32_t LROLength = (uint32_t)&Load$$LR$$LR_IROM1$$Length;
    uint32_t LROLimit = (uint32_t)&Load$$LR$$LR_IROM1$$Limit;
    
Children
No Data
Related