Howto: CLion and ChibiOS

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
Posts: 30
Joined: Tue Feb 25, 2020 4:06 pm
Been thanked: 1 time

Howto: CLion and ChibiOS

Postby JSStabl » Mon Mar 02, 2020 3:56 pm

Since CLion supports OpenOCD it's rather easy to use with ChibiOS. I'm using WSL for the compiler. CLion only accepts CMake Projects as of now, so I'm using a CMake Macro and a compileDB to get Clion to work.

Simply add a CMakeLists.txt to the directory. Setup WSL as a compiler (or mingw, cygwin). And then add a OpenOCD Launch Configuration pointing to the elf file. Debugging works too, it doesn't have the stack analyzer that ChibiStudio supports but I like having a modern IDE more :)

Content of the CMakeLists.txt:

Code: Select all

cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project( VERSION )

macro (add_target name)
    set(default_opt BUILD_DIR=${CMAKE_BINARY_DIR}/${name})
            COMMAND rm -rf compile_commands.json
            COMMAND /home/julian/.local/bin/compiledb -n make ${default_opt} ${ARGN}
            COMMAND make ${default_opt} ${ARGN})


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 2 guests