Early Access Program News

CLion 2021.3 EAP: Multi-threaded FreeRTOS Debugging, Ninja as Default CMake Generator, and More

CLion 2021.3 EAP was launched last week with an impressive list of things to try out:

  • New type hints in the editor
  • New debugger UI
  • Parallel Stacks view
  • Enhancements in toolchain and environment configuration
  • Improvements to DFA and MISRA checks

If you haven’t yet downloaded and installed the 2021.3 EAP, now is a good time to do so! Today we are announcing the second EAP build.

Build 213.4293.2 is available from our website via the Toolbox App, or as a snap package (if you are using Ubuntu). Note that if you are on macOS, there is a separate build for Apple silicon (M1 chip).

DOWNLOAD CLION 2021.3 EAP

Here are the main highlights:

Multi-threaded FreeRTOS debugging

FreeRTOS thread view was introduced in CLion 2021.2. We’re continuing to work on bringing more useful information to this view. We have now added the following information to the view:

  • Task table shows a list of tasks with status information.
  • Queue table shows currently active queues, semaphores, and mutexes.
  • Timer table lists the software timers.
  • Heap Usage table shows the current heap usage and memory block allocation.

These tables are located in two new tabs in the debug toolwindow:
FreeRTOS views in debugger

These views depend neither on the debug probe being used, nor on the debug configuration, but GDB is required. For it to work correctly, several definitions should be present in FreeRTOSConfig.h:

  • configUSE_TRACE_FACILITY needs to be set to 1, to display task numbers and queue types.
  • configMAX_TASK_NAME_LEN needs to be greater than zero, to display the task name properly.
  • configRECORD_STACK_HIGH_ADDRESS needs to be set to 1, to display the task stack info.
  • Both configUSE_TRACE_FACILITY and configGENERATE_RUN_TIME_STATS need to be set to 1 to collect runtime info (runtime column of the task table).
  • Use configQUEUE_REGISTRY_SIZE greater than zero and vQueueAddToRegistry() to assign a name to a queue, semaphore, or mutex. This is useful as queues have no name by default, unlike tasks (which get a name at creation time).
  • Heap info for the scheme from configUSE_HEAP_SCHEME is taken from FreeRTOS/Source/portable/MemMang/heap_N.c.

FreeRTOS Objects view:
Object View

FreeRTOS Heap view:
Heap view

Ninja as a default generator in CMake

Ninja is one of the most popular and effective CMake generators currently used, so we decided to switch our defaults from Makefile to Ninja. If you are using CMake 3.20 or higher, CLion will use Ninja as its default generator. You can still specify your own generator in the CMake profile settings (Settings/Preferences | Build, Execution, Deployment | CMake) if you wish.

To simplify the usage, we’ve bundled Ninja v1.10.2 into CLion. The bundled version is used if all of these are true:

  • Ninja is selected as a generator in CMake profile.
  • The project is not on WSL or in the remote mode. For Ninja set explicitly or as a default generator in CMake, CLion won’t use the bundled version.
  • You don’t have -DCMAKE_MAKE_PROGRAM set in the CMake options.

System Toolchain on Windows

On Windows, the selection of toolchain options included MinGW, Cygwin, Visual Studio, WSL, and Remote toolchain. Now, there is also the System toolchain. Similar to Linux and macOS, it allows configuring CMake, compilers, and debuggers executables, without selecting a predefined environment. You can still load the environment via script in this toolchain. You might need it for the ARM toolchain or other embedded toolchains on Windows.
System Toolchain

There is an interesting use case you might want to try with the System toolchain on Windows – the new IntelLLVM compiler. To configure it on Windows you’ll need to do the following:

  1. Create the System toolchain.
  2. Source the Intel environment script by setting the corresponding setting in the toolchain to something like C:\Program Files (x86)\Intel\oneAPI\setvars.bat.
  3. Select icx compilers in the toolchain settings for C and C++.

An important note! We are not stating that the IntelLLVM compiler works in CLion. We’ve only managed to configure and make it work in several cases on our side. If you are eager to try the brand-new Intel compiler with CLion, we’d greatly appreciate it if you shared your feedback with us. Let us know here or in the comments section below.

Clangd on WSL

With the WSL toolchain set up for your project, you can build your project and compilers from Linux, and run/debug on WSL, without leaving CLion on your Windows machine. With many language features in CLion working via the Clangd-based engine, we realized that running clangd on Windows for projects on WSL is not effective. The performance could be much better if we ran clangd directly on WSL where the project is. In CLion 2021.3 EAP it now does so for CMake and compilation database projects (for Makefile projects, the change is coming later).

Auto-import fix

Finally, CLion addressed an annoying auto-import issue. Now "" is used instead of <> for header files belonging to the project (part of the CPP-5501).

The full release notes are available here.

DOWNLOAD CLION 2021.3 EAP

Your CLion team
JetBrains
The Drive to Develop