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.
JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

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})
    add_custom_target(${name}
            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
            COMMAND rm -rf compile_commands.json
            COMMAND /home/julian/.local/bin/compiledb -n make ${default_opt} ${ARGN}
            COMMAND make ${default_opt} ${ARGN})
endmacro()

add_target(masterf7)

rastro
Posts: 1
Joined: Thu May 14, 2020 9:05 pm

Re: Howto: CLion and ChibiOS

Postby rastro » Thu May 14, 2020 9:27 pm

Same time ago I found this: https://github.com/ObKo/stm32-cmake . In general it's cmake toolchain for STM32, but also support chibios.
So, jetbrains still promise to add support to the makefile. However I lost hope.

JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

Re: Howto: CLion and ChibiOS

Postby JSStabl » Fri May 15, 2020 8:55 am

I'm in contact with them. They promised to have a beta some time this year :)

Interesting project, not entirely sure how that works yet, since chibiOS is makefile based :)

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Howto: CLion and ChibiOS

Postby Giovanni » Fri May 15, 2020 9:01 am

ChibiOS can be compiled with anything, we just use make for convenience, it is always available and well understood.

Giovanni

JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

Re: Howto: CLion and ChibiOS

Postby JSStabl » Fri May 15, 2020 10:24 am

Yes of course, but all the submodules conviently provide .mk files that can simply be included from the master Makefile. If I use CMake I have to rewrite those or finde some other ways to only compile the needed modules.


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 3 guests