JLink + Embedded debug ... toolchain setting?

Answered

I am trying to get my debugging up and running for a C project in CLion for an embedded target.

The issue, as far as I can tell, is that CLion has no knowledge of what the "toolchain" is associated with the project.

The project does build fine, but notably, the `CMakeLists.txt` is configured to specify the toolchain directly:

# Use this to build with arm-gcc on a specific path. Otherwise, comment it out and whatever PATH supplies is used.
SET(GCC_ARM_PATH /usr/local/gcc-arm-none-eabi-7-2017-q4-major/bin/)

# specify cross compilers and tools
SET(CMAKE_C_COMPILER_WORKS 1)
SET(CMAKE_C_COMPILER ${GCC_ARM_PATH}arm-none-eabi-gcc)
SET(CMAKE_CXX_COMPILER_WORKS 1)
SET(CMAKE_CXX_COMPILER ${GCC_ARM_PATH}arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER ${GCC_ARM_PATH}arm-none-eabi-gcc)
set(CMAKE_AR ${GCC_ARM_PATH}arm-none-eabi-ar)
set(CMAKE_OBJCOPY ${GCC_ARM_PATH}arm-none-eabi-objcopy)
set(CMAKE_OBJDUMP ${GCC_ARM_PATH}arm-none-eabi-objdump)
set(SIZE ${GCC_ARM_PATH}arm-none-eabi-size)

That follows a template that was generated from the STM32CubeMX integration, wherein I generated a CLion project / CMakeLists.txt file from a basic MCU project and then manually adapted it to my existing code base.

I do have an "arm-gcc 7.x" toolchain defined in Preferences >> Build, Execution, Deployment >> Toolchains.

In `Edit Configurations...`, I added an `Embedded GDB Server` configuration, selected the ELF target and executable and set the GDB params that I know work.

BUT, when I select this configuration and do "Debug" (only button available), I get the error:

    Error running 'myapp.elf': Debugger executable not specified

So it seems like that build configuration has no knowledge that it should be using my defined `arm-gcc 7.x` toolchain.
I cannot see an option anywhere to select that association... ?

I get the sense that I will need to do something with "Custom Build Targets" ... but the standard default built target already works fine, and I have no clue how to set up a "Custom Build Target" to reproduce the standard basic build-from-the-CMakeLists.txt build step.

Is there any way to get this to work?

0
3 comments

Hello!

Please try manually specifying ARM compilers and ARM debugger in your toolchain (File | Settings | Build, Execution, Deployment | Toolchains). After that do Tools | CMake | Reset Cache and Reload Project.

Does it help?

0

I don't think that helps.
For toolchains, I have `default`, `arm_gcc 7.x`, and `arm-gcc 9.x`.

I don't want to change the default toolchain, since I also do a lot of host-side coding using CLion.

As far as I can tell, I want to associate the `arm_gcc 7.x` toolchain with my project, but I cannot see how to do that.

0

Please sign in to leave a comment.