cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE: How to enter commands in the debug configuration as in TrueStudio?

MB_Inv
Associate III

Hello,

I used the following "Target Software Startup Script" in the debug configuration in Atollic TrueStudio (this is necessary since we're using a bootloader and our application binary which I would like to debug is not placed at the beginning of the STM32 flash):

0690X000008iJtzQAE.jpg

How to enter this in STM32CubeIDE?

I would really need to debug my firmware, but can't figure out how to do the required settings...

Any ideas?

Kind regards,

Markus

33 REPLIES 33
MB_Inv
Associate III

Unfortunately, I can't debug my bootloader with CubeIDE since it has been developed with another IDE and its (closed) library...

Legacy member
Not applicable

Are you able to test your application without the bootloader? Which means you can use the default settings without this linker script? Think that will at least allow you to verify that your application can work with ST-Link?

MB_Inv
Associate III

Yes, debugging the non-shifted application works with ST-Link in CubeIDE.

So it's obviously a problem with the gdb commands needed for the shifted version...

Legacy member
Not applicable

Hmm, yea. Cause if the non-shifted version works, it means that your CubeIDE project is able to talk to ST-Link fine. I shall assume u updated the linker script accordingly for the shifted version from the non-shifted version?

I noticed your gdb commands have changed from your earlier posts? The offsets are different now?

Sorry, I just noticed your ST-Link execution hangs in Default_Reset_Handler? So it is different from your previous error? "Error! Failed to read target status"? So you are able to debug now but it get stuck in the Default_Reset_Handler?

MB_Inv
Associate III

I took the older linker script which I used with Atollic TrueStudio also in CubeIDE. Meanwhile I also tried using the linker script that was automatically created by CubeIDE and simply added my changes, but this didn't change the situation.

Yes, I originally had used the wrong flash addresses in the gdb commands (taken from an old linker script). Now I use the following initialization commands for J-Link:

---

set *0xe000ed08 = 0x08020000

set $sp = *(unsigned int*)0x08020000

set $pc = *(unsigned int*)0x08020004

---

Since it works this way with the J-Link, I assume that both the addresses and the linker script are ok and the only problem lies in the gdb commands.

I noticed ST-Link and J-Link use two different (custom) versions of the gdb server. So I guess maybe the ST gdb server needs some addtional command. Even in Atollic TrueStudio I had different startup scripts for ST-Link and J-Link.

For ST-Link I used:

0690X000008idyJQAQ.jpg

For J-Link I used:

0690X000008iJtzQAE.jpg

I tried to use the same in CubeIDE. The first problem was that I didn't know where to enter it. So now I know that part of it needs to go to the initialization commands, part of if can be set via the "runtime options". However, some commands don't work with CubeIDE any more (and comments don't work at all - as you well know as I've read on your other post). Removing them enables to start the debugging, but traps the application in the "Default_Reset_Handler" function.

I just noticed that TrueStudio and CubeIDE use different ST GDB server versions for ST-Link:

Atollic TrueStudio uses "STMicroelectronics ST-LINK GDB server. Version 5.1.0"

CubeIde uses "STMicroelectronics ST-LINK GDB server. Version 5.2.3"

Maybe all of the problems simply come from the difference in these versions (which probably have also caused comments to not work any more)...

Legacy member
Not applicable

In my project, I specified the addresses as offset rather than the actual address

set *0xe000ed08 = 0xC000

set $sp = *(unsigned int*)0xC000

set $pc = *(unsigned int*)0xC004

I wonder if you use offsets instead of actual address if it may help. 

MB_Inv
Associate III

I tried with the following initialization commands:

---

set host-charset CP1252

set target-charset CP1252

set *0xE000ED08 = 0x20000

set $sp = *(unsigned int*)0x20000

set $pc = *(unsigned int*)0x20004

tbreak main

continue

---

Now it worked - but only one time... And since that I get into the trapping again each time again...

Legacy member
Not applicable

If you only put the following for initialization commands

---

set *0xE000ED08 = 0x20000

set $sp = *(unsigned int*)0x20000

set $pc = *(unsigned int*)0x20004

---

and under Runtime Options, above Run Commands, you select

---

Set breakpoint at: main

Resume.

---

Does it help?

MB_Inv
Associate III

Yes, I have tried several times with this configuration (now once more), but to no avail...

I've just seen that there's an update of STM32CubeIDE available - so I will try with this as well...

By the way - thanks very much for your help and the many suggestions and input!!!

Kind regards,

Markus

MB_Inv
Associate III

No difference even with CubeIDE 1.0.1...