Skip to main content
Graduate
August 27, 2024
Solved

Over flow flash memory

  • August 27, 2024
  • 3 replies
  • 1140 views

Dear All,

I'm using STM32G0 with 64KB of flash memory and 8KB of RAM

if optimization is OFF, its giving error as below

vchau2_0-1724778215817.png

 

and if optimization is ON Level-1 

its not giving any error

vchau2_1-1724778336673.png

So let me know what kind of error i'm facing 

Compiler - keil

 

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

    > Over flow flash memory

    > So let me know what kind of error i'm facing 

    You answered it yourself. The code is larger than the flash size you have available.

    Potential solutions:

    • Refactor the code to use less memory
    • Compile with optimizations on
    • Buy a chip with more flash

    3 replies

    Technical Moderator
    August 27, 2024

    Hello,

    Simply you are exceeding the flash memory size.

    In fact your application is at the limit of the flash size 64kB. If you enable the optimization your binary < 64kB and that fits in the Flash and if you disable the optimization, the binary > 64kB exceeding the memory size of the MCU.

    vchau.2Author
    Graduate
    August 28, 2024

    But when optimization is of level-1 than occupy flash size is 27KB only, how its possible to optimize the code size more than half 

    Technical Moderator
    August 28, 2024

    Hello,

    Maybe you need to contact ARM for such kind of behaviour over this link:

    https://community.arm.com/support-forums/f/keil-forum

    TDKAnswer
    Super User
    August 27, 2024

    > Over flow flash memory

    > So let me know what kind of error i'm facing 

    You answered it yourself. The code is larger than the flash size you have available.

    Potential solutions:

    • Refactor the code to use less memory
    • Compile with optimizations on
    • Buy a chip with more flash
    Graduate
    August 28, 2024

    My guess is: you are using trial/resrticted version of MDK-ARM with 32 KiB size limit.

    Solutions:

    1. Switch to STM32CubeIDE.

    or

    2. Enable STM32F0/G0 license. This will unlock the size limit but lock your MDK-ARM to F0/G0, so you won't be able to use it with any other microcontroller.