cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G473RC - Error in Launch Sequence - when Flash File > 128kB

CBerg
Associate III

I guess I have found a Bug in the G473RC debug launch script:

I have a STM32G473RC MCU with 128k RAM and 256k Flash.

memory.png

As long as the Flash File stays below the size of 128k all works fine. I can develop, test and debug with CubeIDE. As soon as the flash file becomes larger than 128k, I can no longer debug the Software, because the Launch of the debugger exits with an error message:

error dialogerror dialog

The complete output in the console is:

STMicroelectronics ST-LINK GDB server. Version 7.4.0
Copyright (c) 2023, STMicroelectronics. All rights reserved.

Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled

Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
-------------------------------------------------------------------
STM32CubeProgrammer v2.14.0
-------------------------------------------------------------------

Log output file: C:\Users\CBerg\AppData\Local\Temp\STM32CubeProgrammer_a09660.log
ST-LINK SN : 48FF6D064884534942320687
ST-LINK FW : V2J42S7
Board : --
Voltage : 3.30V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x469
Revision ID : Rev X
Device name : STM32G47x/G48x
Flash size : 256 KBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0xD5
Debug in Low Power mode enabled

Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a09660.srec
File : ST-LINK_GDB_server_a09660.srec
Size : 128.99 KB
Address : 0x08000000

Erasing memory corresponding to segment 0:
Error: Operation exceeds memory limits

Error: failed to erase memory
Encountered Error when opening C:\ST\STM32CubeIDE_1.13.2\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.0.202305091550\tools\bin\STM32_Programmer_CLI.exe
Error in STM32CubeProgrammer

Shutting down...
Exit.

 

I have checked the MCU on the PCB: it IS a G473RC. I have checked the connection with Cube Programmer, it says the device has 256k Flash. The Linker Script is correct (128k RAM, 256k Flash) - it is orignal as CubeMX created it, i did not change it. The MCU in the CubeIDE Project is G473RC. The Project compiles without errors and warnings. So far all seems to be correct, which brings me to the asumption, that there might be a bug in the startup script.

How can I solve this? This is URGENT because this prevents me effectively from developing this project. Can I hack the startup scripts or something? Where can I find these? Thanks a lot!

What leads me to the conclusion, that this might be a bug in the IDE / the drivers / the setup script is, that when the size of the flash file is below 128k, the console output is:

Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 63]
Download in Progress:

As i have some experience with Flash memory, i asume there could be some wrong entries about the sector or cluster size. Where can I find those information, so i can hack them in order to get it running again? Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Status Update:

this behaviour is confirmed as a bug in one the Cube Programmer MCU Descriptor files. The internal case ID is 00191651

There is a workaround availiable - for CubeIDE 1.13.2

This "hotfix" is provided "as is" - without any waranty.

Usage:

1) create a backup of the file C:\ST\STM32CubeIDE_1.13.2\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.0.202305091550\tools\Data_Base\STM32_Prog_DB_0x469.xml - just in case 😉

2) replace that file with the workaround version from the ZIP-file in the attachment

For me it did the trick. Thanks again to ST for the quick response, that saved my project!

 

@Aziz BRIGUI FYI ...

View solution in original post

4 REPLIES 4
CBerg
Associate III

 

in this similar topic:

CubeProgrammer 2.12 - Operation exceeds memory limits

@Aziz BRIGUI mentions a workaround would be:




A workaround for this would be to perform a full chip erase (EEPROM is not included by default), than to skip the erase before programming :

>STM32_Programmer_CLI -c port=USB1 -e all
>STM32_Programmer_CLI -c port=USB1 -d myHex.hex --skipErase

can anyone tell me, how to do this in CubeIDE 1.13.x for ST-Link V2?

Aziz BRIGUI
ST Employee

Hello @CBerg,

Thanks for bringing this to our attention,

I can confirm that this issue is different than the one discussed here Solved: CubeProgrammer 2.12 - Operation exceeds memory lim... - STMicroelectronics Community. That issue is specific to targets containing EEPROM (which is not the case for STM32G473RC) and happens when connecting via a bootloader interface (which is not the case here).

I will try to reproduce the issue and will get back to you if I need any further details on your setup.

Aziz

Status Update:

this behaviour is confirmed as a bug in one the Cube Programmer MCU Descriptor files. The internal case ID is 00191651

There is a workaround availiable - for CubeIDE 1.13.2

This "hotfix" is provided "as is" - without any waranty.

Usage:

1) create a backup of the file C:\ST\STM32CubeIDE_1.13.2\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.0.202305091550\tools\Data_Base\STM32_Prog_DB_0x469.xml - just in case 😉

2) replace that file with the workaround version from the ZIP-file in the attachment

For me it did the trick. Thanks again to ST for the quick response, that saved my project!

 

@Aziz BRIGUI FYI ...

CBerg
Associate III

The Bug is back with the latest Update of CubeIDE (1.14.0 Build 19471_20231121_1200)

The Workaround still works, but the Database is now in

 

>C:\ST\[...]\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.100.202311100844

 

Could someone at ST please escalate this, so we can get a permanent fix? Thank you!