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

1 ACCEPTED SOLUTION

Accepted Solutions
MB_Inv
Associate III

I just solved the issue...

It turned out that the linker setting "-Wl,--cref" (Add symbol cross reference table to map file) was missing. Checking the corresponding box in the linker settings, debugging now also works also with ST-Link in CubeIDE!

0690X000008j2alQAA.jpg

Kind regards,

Markus

View solution in original post

33 REPLIES 33
MB_Inv
Associate III

When I use e.g.

x Load image

Use project binary

x Load symbols

Use project binary

and under "Run commands":

--

set *0xe000ed08 = 0xC000

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

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

set *0xE0042004 = (*0xE0042004) | 0x7

tbreak main

continue

---

the binary is flashed correctly to the MCU, but then the (ST-Link V2) debugger connection is lost:

---

Download verified successfully

Error! Failed to read target status

Debugger connection lost.

Shutting down...

---

Any ideas?

Kind regards,

Markus

Legacy member
Not applicable

Is this a new project in STM32CubeIDE or migrated?

Maybe you can consider adding in the scripts line by line and see which one causes your connection to crap out?

MB_Inv
Associate III

Hello,

this is a project from Atollic TrueStudio migrated to STM32CubeIDE.

I will try adding the scripts line by line.

Kind regards,

Markus

MB_Inv
Associate III

It seems setting stack pointer and program counter makes problems:

Failed to execute MI command:

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

Error message from debugger back end:

Selected thread is running.

Failed to execute MI command:

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

Error message from debugger back end:

Selected thread is running.

So my question is how I can make these settings with the STM32CubeIDE dialog.

Kind regards,

Markus

Legacy member
Not applicable

set *0xe000ed08 = 0xC000

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

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

I have the above 3 commands in my initialization commands and it seems to run fine.

  • Can I check that if you don't have any of your initialization commands, your debugger connection is ok?
  • If you just put in the above 3 commands only, do you still face the same connection problem?

Hello,

I now put these commands in the "Initialization Commands" field (previously used the "Run commands" field) and now I don't get the error messages any more. So thanks for the hint!

However, now execution is always trapped in "Default_Reset_Handler" and doesn't get out of the loop

for(pulDest = &_sdata; pulDest < &_edata; )

 {

   *(pulDest++) = *(pulSrc++);

 }

Trying to figure out what is missing here...

Kind regards,

Markus

Legacy member
Not applicable

Glad to help. :)

MB_Inv
Associate III

Using the SEGGER J-Link, it works.

For some reason, using the same startup settings, it doesn't work with the ST-Link v2 showing the followin error:

---

Download verified successfully

Error! Failed to read target status

Debugger connection lost.

Shutting down...

---

Kind regards,

Markus

Legacy member
Not applicable

Your initial posts include some speed settings. I didn't have to do any speed settings for ST-Link to work.

Did you choose the Debug probe to be ST-Link?