cancel
Showing results for 
Search instead for 
Did you mean: 

How to use STM Cubeprogrammer and stling server for debugging in other IDE than cube IDE

Zainka
Associate III

Hi. I try to use an external IDE, code::blocks in this case, but have some issues attaching to target. First, i took the gnutools and ST Link GDB server from CubeIDE 1.5.0 etc. (Since i know some needs to ask why I wont't use CubeIDE, the answser i simple, I simply do not like eclipse and eclipse does not like me)

When initializing a debug session from CubeIDE, it runs the Cubeprogrammer after the debugger is attached and which loads the memory

But it referees to a .srec file I do not find (ST-LINK_GDB_server_bwMwVC.srec)

What and where is this file?

I also try to find the command parameters sent to the cubeprogrammer, but Have no luck so far.

Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_bwMwVC.srec
  File          : ST-LINK_GDB_server_bwMwVC.srec
  Size          : 264405 Bytes
  Address       : 0x08000000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 2]
Download in Progress:
 
 
File download complete
Time elapsed during download operation: 00:00:04.866
 
 
 
Verifying ..

For now I am only able to start the ST LINK gdb server and to start the gdb, I may run the code and pause it, but no breakpoints are loaded and I may not see the code since the above part is still missing in my code::blocks setup.

I need to figure out the parameters sent to the cube-programmer to load memory etc. the same way cubeide does it.

EDIT:

I managed to copy the .srec intermediate file from temp folder while it existed. But I do not understand why CubeIDE must create a Motorola S record file to load the device? Shouldn't the cubeprogrammer be able to use other formats like hex, bin and elf?

I have also played with the cube programmer parametres, but I have dificulties attaching to stlink using the -c option. For usb, which port to use. I have tried several but the target is not found. Below example is the last one i tested to se if port usb could be used as an input for the programmer to find any device connected to usb, which is a methode used by other debuggers, but to no help.

STM32_Programmer_CLI -c port=usb

2 REPLIES 2
Zainka
Associate III

For those interested

Found which options that CubeIDE used as input to STM32_Programmer_CLI

Now I am able to debug using code::block. I may not use SVD files at the moment but there exists a plugin somewhere that will enable this feature.

The following is the commands executed before gdb connects to the server and target.

killall ST-LINK_gdbserv
./STM32_Programmer_CLI --connect port=SWD mode=UR reset=hwRst --download Z045.srec --verify --quietmode
./ST-LINK_gdbserver -c ./config.txt &
sleep 1

I have gained one new issue though after getting rid of eclipse, this is an unexpected crash at a certain point in my code. The strange thing is that the code compiles exatly the same both in CubeIDE and when using the self-sustained makefile (build flags and linking are the same). When debugging using CubeIDE, the very same code does not crash the MCU

;179:	      c = *pC;
0x8032ad6	ldr	r3, [r7, #32]    <----- Crashes
0x8032ad8	ldrb	r3, [r3, #0]
0x8032ada	strb	r3, [r7, #22]

To figure out what may cause this is my next project.

T J
Lead

I find it much easier to use Visual Studio.

using the GPDSC toolchain option in the project manager