2023-10-31 07:02 AM
I guess I have found a Bug in the G473RC debug launch script:
I have a STM32G473RC MCU with 128k RAM and 256k Flash.
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 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!
Solved! Go to Solution.
2023-11-02 06:25 AM
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 ...
2023-10-31 10:00 AM
in this similar topic:
@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?
2023-11-01 01:47 AM
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
2023-11-02 06:25 AM
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 ...
2024-01-07 02:44 AM
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!
2024-03-18 02:54 AM
Same problem on board STWINBX1.
This solution doesn't work for me.
2024-03-18 03:01 AM
no wonder that solution does not work for you, because it is a hotfix, only for the STM32G473RC MCU. The STWINBX1 has a STM32U585AI on it.
What you could do:
compare the hotfix for the STM32G473RC with the original file for this MCU and try to apply the same logic to your MCU. This means you had to edit DB File for your MCU. But I can't help you with the MCU ID ...
2024-03-18 03:11 AM
Ok, thanks for help
2024-03-18 05:47 AM
Something worked for me (STWINBX1) :
- Open CubeProgrammer
- Go to erase & programming and perform a Full chip erase
- Flash your firmware again from cubeIDE
2024-03-19 09:23 AM
edit:
This solution doesnt seems to work long term as I had to redo the operation several times today