cancel
Showing results for 
Search instead for 
Did you mean: 

how to launch stm32cubeide debugger from command line?

Achar1
Associate II

how to launch stm32cubeide debugger from command line?

1 ACCEPTED SOLUTION

Accepted Solutions
Achar1
Associate II

I am able to get the solution to this issue.

pl find the batch files contents attached.

main batch file

@setlocal

@set CUR_DIR=%CD%

start /B Connect_JLinkGDBServerCL.bat

start /B Start_GDB.bat %CUR_DIR%\SUITE_Objs\RTLSTagTest.elf

@endlocal

Connect_JLinkGDBServerCL.bat

 %STM_base_dir%\JLinkGDBServerCL.exe -port 2331 -s -device STM32L462RE -endian little -speed 4000 -if swd -swoport 2332 -telnetport 2333 -noreset -noir -localhostonly 1 - singlerun -strict -timout 0 -nogui  

Start_GDB.bat batch file

%GDB_DIR%\arm-none-eabi-gdb.exe --command=Gdb_StartUp.gdb %1

Gdb_StartUp.gdb file

target remote localhost:2331

load

break my_end

print coverage_data_pool

c

quit

with all connected batch file i am able to resolve this issue.

thanks for your support.

View solution in original post

7 REPLIES 7
Markus GIRDLAND
ST Employee

Hello there!

It will depend on what debug probe you are using. If you are using ST-Link GDB server then you can find all the commands available, and how to start the GDB server, at this link: UM2576

hi,

Thanks for your quick response

I have used the following command

set STM_base_dir=

C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE

@set gdb_server_dir=%STM_base_dir%\plugins\com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_2.0.0.202105311346\tools\bin\

@rem set cube_programmer_dir=%STM_base_dir%\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.0.0.202105311346\tools\bin

cmd /K %gdb_server_dir%\ST-LINK_gdbserver.exe -c config1.txt

pl find the cinfig1.txt is attached.

After execution I am getting error

C:\Venkatesh\CmdLine_Build_RTLSTag>cmd /K C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_2.0.0.202105311346\tools\bin\\ST-LINK_gdbserver.exe

-c config1.txt

STMicroelectronics ST-LINK GDB server. Version 5.9.1

Copyright (c) 2021, STMicroelectronics. All rights reserved.

Starting server with the following options:

Persistent Mode : Enabled

LogFile Name : debug.log

Logging Level : 31

Listen Port Number : 2331

Status Refresh Delay : 15s

Verbose Mode : Disabled

SWD Debug : Enabled

ST-Link enumeration failed

Error in initializing ST-LINK device.

Reason: ST-LINK DLL error.

Hello again Venkatesh,

Are you using J-Link or ST-Link GDB server? The error indicates that it can not find an ST-Link connected and the Port Number that is being listened to is 2331, which is the default for J-Link.

You can go into the debug configuration through the GUI of your application and see the exact command line that is being used by clicking on the button highlighted below:

0693W00000FDI9qQAH.png

Thanks so much or your support

If I execute from GUI everything is working fine

0693W00000FDIPoQAP.pngAs per your guild line, I have copied the command line pasted in to one batch file

set STM_base_dir=C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE

%STM_base_dir%\plugins\com.st.stm32cube.ide.mcu.externaltools.jlink.win32_2.0.0.202105051205\tools\bin\JLinkGDBServerCL.exe -port 2331 -s -device STM32L462RE -endian little -speed 4000 -if swd -vd

When I execute same command from command prompt, it will stuck

0693W00000FDIS4QAP.pngPlease give your inputs to resolve this issue.

Hello again!

It looks like everything is working as intended in the screenshot of the command prompt window. The launch has succeeded and it is now waiting for the GDB connection.

If you plan on using command line then you will need to change the GDB Connection Settings in your Debug Configuration from "Autostart local GDB server" to "Connect to remote GDB server".

Since you are using J-Link any additional commands will need to be found in the J-Link user manual and not the ST-Link GDB server one. However, you can find some additional information regarding debugging and the debug configuration in the STM32CubeIDE user manual, UM2609, in chapter 3.

As per your guide lines, I have selected "Connect to remote GDB server".

0693W00000FDNo0QAH.pngStill I am getting same error.

0693W00000FDNo5QAH.pngPlease give me inputs to resolve this issue.

Thanks in advance

Achar1
Associate II

I am able to get the solution to this issue.

pl find the batch files contents attached.

main batch file

@setlocal

@set CUR_DIR=%CD%

start /B Connect_JLinkGDBServerCL.bat

start /B Start_GDB.bat %CUR_DIR%\SUITE_Objs\RTLSTagTest.elf

@endlocal

Connect_JLinkGDBServerCL.bat

 %STM_base_dir%\JLinkGDBServerCL.exe -port 2331 -s -device STM32L462RE -endian little -speed 4000 -if swd -swoport 2332 -telnetport 2333 -noreset -noir -localhostonly 1 - singlerun -strict -timout 0 -nogui  

Start_GDB.bat batch file

%GDB_DIR%\arm-none-eabi-gdb.exe --command=Gdb_StartUp.gdb %1

Gdb_StartUp.gdb file

target remote localhost:2331

load

break my_end

print coverage_data_pool

c

quit

with all connected batch file i am able to resolve this issue.

thanks for your support.