cancel
Showing results for 
Search instead for 
Did you mean: 

CLion + ST-LINK_gdbserver: "Unknown MCU found on target" Error

EniRot99
Associate II

I am trying to use CLion to program STM32 MCUs as an alternative to other IDEs. For flashing and debugging, I want to use the Embedded GDB Server provided by ST, specifically ST-LINK_gdbserver.exe.

I prefer not to use OpenOCD because I have found it to be less stable for my use case.

 

The Problem:

I am struggling to find the correct configuration to make ST-LINK_gdbserver.exe work properly with CLion. I tried using a configuration I found in this GitHub issue:
Link: Official ST-LINK gdbserver support · Issue #354 · Marus/cortex-debug

However, when I try to run the GDB Server with this configuration:

EniRot99_0-1734417082837.png

I receive the following error:

 

C:\ST\STM32CubeIDE_1.13.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_2.2.0.202409170845\tools\bin\ST-LINK_gdbserver.exe -p 3333 -cp C:\ST\STM32CubeIDE_1.13.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.2.0.202409170845\tools\bin -k


STMicroelectronics ST-LINK GDB server. Version 7.9.0
Copyright (c) 2024, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 3333
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        InitWhile                  : Enabled

Target unknown MCU target

Error in initializing ST-LINK device.
Reason: Unknown MCU found on target.
GDB Server stopped, exit code 5

Process finished with exit code 0

 

 

My Setup:

  • Board: Nucleo STM32F411RE
  • Toolchain: CLion + ST-LINK GDB Server
  • Connection: The board is connected via USB, and the ST-LINK firmware is up to date.
  • Project: Set up for the STM32F411RE MCU

What I don't understand:

The error message "Unknown MCU found on target" is confusing because the project is explicitly set up for an STM32F411RE, and the board is correctly connected. I have tested the board with STM32CubeProgrammer, and it connects without any issues.

Question:

What is the correct configuration or setup to use ST-LINK_gdbserver.exe with CLion? Are there any additional arguments or steps I need to add to resolve this issue?

Any help or insight is greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
EniRot99
Associate II

To summarize, the key steps to resolve the problem were:

  1. Ensuring that the port number is set to 61234 (default) for both the Target Remote Args and the GDB Server Args.
  2. Adding the programming interface in the GDB Server Args using the --swd flag, which might have been missing initially.

These adjustments seem to have resolved the issue effectively. 

View solution in original post

1 REPLY 1
EniRot99
Associate II

To summarize, the key steps to resolve the problem were:

  1. Ensuring that the port number is set to 61234 (default) for both the Target Remote Args and the GDB Server Args.
  2. Adding the programming interface in the GDB Server Args using the --swd flag, which might have been missing initially.

These adjustments seem to have resolved the issue effectively.