Skip to main content
Apand.1
Associate
February 1, 2023
Solved

Problems with programming STM32 mcu with stm32cubeIDE (failed to erase memory)

Hello,

I am using STM32G030F6P6 in one of my projects. I am using STM32 CubeMx as my IDE.

In the datasheet I can see that it has 64KB of flash. However IDE perceives this as 32KB and I can not upload my code. This is what I read from the console. Does anyone know how to fix this issue.

Thanks

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_a02624.srec

 File     : ST-LINK_GDB_server_a02624.srec

 Size     : 47.18 KB 

 Address    : 0x08000000 

Erasing memory corresponding to segment 0:

Error: Operation exceeds memory limits.

This topic has been closed for replies.
RomainR.
RomainR.Best answer
ST Employee
February 1, 2023

Hello @Apand.1 (Community Member)

DS12991 Rev 4 in Table 2. STM32G030x6/x8 family device features and peripheral counts.

STM32G030F6P6 has 32kb of flash memory and 8kb of SRAM.

Your code executable cannot fit in the memory, try to optimize your code and with compiler for size or use 64kb device such STM32G031F8 or 051F8.

Best regards,

Romain,

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

4 replies

RomainR.
RomainR.Best answer
ST Employee
February 1, 2023

Hello @Apand.1 (Community Member)

DS12991 Rev 4 in Table 2. STM32G030x6/x8 family device features and peripheral counts.

STM32G030F6P6 has 32kb of flash memory and 8kb of SRAM.

Your code executable cannot fit in the memory, try to optimize your code and with compiler for size or use 64kb device such STM32G031F8 or 051F8.

Best regards,

Romain,

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Apand.1
Apand.1Author
Associate
February 2, 2023

Tanks for you clarifications.

Javier1
Principal
February 1, 2023

STM32G030F6P6

That 6 means 32K flash memory https://www.digikey.com/en/maker/blogs/2020/understanding-stm32-naming-conventions

If you want your code to fit your flash, the lazy way is to play with the compiler options in CubeIDE, as an example , the "release" build will be smaller in size than the "debug" build

hit me up in https://www.linkedin.com/in/javiermuñoz/
Apand.1
Apand.1Author
Associate
February 2, 2023

thank you @Javier Muñoz​