element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Using CLion for Easier Coding with Pi Pico and C/C++
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shabaz
  • Date Created: 20 Jul 2022 8:05 PM Date Created
  • Views 69315 views
  • Likes 12 likes
  • Comments 30 comments
Related
Recommended
  • coding
  • c/c++
  • ide
  • raspberry pi pico
  • pico
  • pico_eurocard
  • clion
  • pi pico

Using CLion for Easier Coding with Pi Pico and C/C++

shabaz
shabaz
20 Jul 2022

Table of Contents

  • 2024 Update
  • Introduction
  • Some CLion Highlights
    • Code Navigation
    • SSH and Command Line Windows
    • Code Inspection
    • Git and GitHub
  • Working with Pico: Installing Pre-Requisites (Pico C SDK, Pico Examples, and CLion)
  • Opening Projects with CLion
  • Building a Project
  • Running the Project
  • Working with Picoprobe
  • Summary

2024 Update

Note that in 2024, there is now a new Pico SDK, version 2.0.0, and a new RP2350 processor (used in the Pico 2), and CLion has seen many releases since the blog post was originally written! If you're following this blog post in 2024, then you'll need to bear the following in mind:

(1) Ensure you have installed Visual Studio, since you need a Windows compiler. There are other options, but you may as well install Visual Studio since it is free. I used Visual Studio 2022.

(2) Install the latest Pico Setup for Windows even  if the version is different to the Pico SDK that you wish to use. For instance, I wished to use the latest pico SDK 2.0.0, but the latest Pico Setup for Windows was version 1.5.

(3) Install an ARM GNU toolchain the file you need is called something like arm-gnu-toolchain-13.3.rel1-mingw-w64-i686-arm-none-eabi.zip but use the latest. In my case, it got installed to C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\13.3 rel1

(4) Install the pico-sdk somewhere (I chose to do this in a folder called c:\development\pico), by typing (in a Windows PowerShell or Command Prompt):

git clone -b master https://github.com/raspberrypi/pico-sdk.git
cd .\pico-sdk\
git submodule update --init
cd ..
git clone https://github.com/raspberrypi/pico-extras.git
git clone https://github.com/raspberrypi/pico-playground.git
git clone https://github.com/raspberrypi/pico-examples.git

(5) Either build picotool, or obtain the zip file containing the executable. Place the executable and associated .dll file into a location of your choice (I chose a folder called c:\development\pico\win_tools, so that when extracted, a folder called picotool was created, and inside there was a picotool.exe file and a libusb-1.0.dll file.

If you're building from scratch, you'll need to git clone https://github.com/raspberrypi/picotool.git and then you'll also need the latest libusb-1.0 binary fromhttps://github.com/libusb/libusb/releases (it will be called something like libusb-1.0.27.7z and you'll need 7-zip to extract it all). I extracted to a folder called c:\development\pico\libusb-win and then create a Windows environment variable called LIBUSB_ROOT with the value C:\development\pico\libusb-win and then, in the cloned picotool folder, type:

mkdir build
cd build
cmake -G "NMake Makefiles" ..
nmake

Once it is built (it will be a file called build/picotool.exe), copy across that executable into a folder of your choice, mine was called c:\development\pico\libusb-win\picotool (make sure the folder is called picotool) and in there was the picotool.exe file. Place the libusb-1.0.dll file from C:\development\pico\libusb-win\VS2022\MS32\dll into that folder too.

(6) In CLion, go to File->Settings->Build,Execution,Deployment->Toolchains and configure as shown. To do this, click on the '+' button highlighted in red, and select "System". 

image

When finished, click Apply.

(7) Now repeat step (6) but when you click '+', select "Visual Studio" and configure as shown here, and again click on Apply when finished:

image

It is important that both the ARM toolchain, and the Visual Studio toolchain, are both configured. This is because the build scripts try to build picotool.exe normally, and that's a Windows executable.

(8) Go to File->Settings->Build,Execution,Deployment->CMake and configure as shown here; notice that the Toolchain called Visual Studio is selected, and not ARM.

In the CMake Options text box, this should be typed:



-G Ninja -DCMAKE_C_COMPILER="C:\ARM_TOOLCHAIN\14.2_rel1\bin\arm-none-eabi-gcc.exe" -DCMAKE_CXX_COMPILER="C:\ARM_TOOLCHAIN\14.2_rel1\bin\arm-none-eabi-g++.exe

In the Environment text box, type:

PICO_SDK_PATH=c:\development\pico\pico-sdk

If you're using PICO-EXTRAS then use this line instead:

PICO_SDK_PATH=c:\development\pico\pico-sdk;PICO_EXTRAS_PATH=c:\development\pico\pico-extras

image

Click Apply/OK.

(8) Now you're done! If you have a project open, test it by manually deleting whatever build folder exists (it may be called something like cmake-build-debug-visual-studio and then click on Tools->CMake->Reset Cache and Reload Project, and then hit the hammer icon to perform the build. If you get an error stating that something like "\A" is not found, then you need to do that Reset Cache and Reload Project and the error should disappear.

(9) You may have noticed that picotool was built as part of the project. This is not ideal, it wastes time, and it doesn't make use of the picotool.exe that was installed or created in step (5). I have created an issue here, but in the meantime, to solve this, I had to do the following steps:

(9.1) Edit the pico-sdk\tools\Findpicotool.cmake file, and near the top, immediately after the line stating cmake_minimum_required(VERSION 3.17) type the following:

# if PICOTOOL_OVERRIDE_DIR system environment variable is set,
# then use that as the folder for the picotool executable
if (DEFINED ENV{PICOTOOL_OVERRIDE_DIR})
    message("PICOTOOL_OVERRIDE_DIR env var is set to '$ENV{PICOTOOL_OVERRIDE_DIR}'")
    add_executable(picotool IMPORTED GLOBAL)
    set_property(TARGET picotool PROPERTY IMPORTED_LOCATION $ENV{PICOTOOL_OVERRIDE_DIR}/picotool)
    # check the picotool version:
    execute_process(COMMAND $ENV{PICOTOOL_OVERRIDE_DIR}/picotool version
                    OUTPUT_VARIABLE PICOTOOL_VERSION
                    OUTPUT_STRIP_TRAILING_WHITESPACE)
    string(REGEX MATCH "^picotool v${picotool_VERSION_REQUIRED}" PICOTOOL_VERSION_MATCH ${PICOTOOL_VERSION})
    if (NOT PICOTOOL_VERSION_MATCH)
        message("picotool version response was: ${PICOTOOL_VERSION}")
        message(FATAL_ERROR "PICOTOOL_OVERRIDE_DIR is set to '$ENV{PICOTOOL_OVERRIDE_DIR}', but the version of picotool found is not ${picotool_VERSION_REQUIRED}")
    endif()
endif ()

(9.2) Create a Windows System Environment Variable (not a Windows User Environment Variable) called PICOTOOL_OVERRIDE_DIR set to C:/development/pico/win_tools/picotool 

(9.3) Close and restart CLion, so that the system environment variable is detected by CLion

(9.4) Now you could redo step (8) and see that the prebuilt picotool.exe is used. If it is successful, there should be a .uf2 file built in the  cmake-build-debug-visual-studio (or similar-ish named) folder.

Introduction


When coding for the Pi Pico, I usually use a hybrid environment: all my code that I’m working on, plus the Pico C/C++ SDK, reside on a small Linux machine in a corner of the home, and then I connect to it remotely from my laptop using a couple of applications called Visual Studio Code and SecureCRT. It’s a great combination; I’ll write it up if there is any interest.   

However, I recently tried a different approach, which I believe is equally flexible, but has a few interesting advantages. These are:

  1. All-in-one, no need for multiple applications
  2. Reduced effort to set up and use
  3. Excellent code browsing and editing capabilities

Of the three, perhaps the most powerful feature from my perspective is the ease of code browsing and code editing. CLion is pretty much world-class at that, and it is a significant benefit because if one can navigate code easily, and if the tool helps you write better code as you go, then it can save days and weeks of time coding and troubleshooting.

So, if you want to save time and stress then read on : ) The steps below are specific for Windows, but Mac and Linux are possible too (if you try it on those systems, please write a blog, or comment below with screenshots if possible where things are different to the Windows screenshots, to help everyone).

image

This blog post will first discuss some CLion highlights, followed by how to use CLion with the Pi Pico.

Some CLion Highlights


CLion was developed by a company called JetBrains. Google’s Android Studio is also based on a JetBrains product, and it has a very similar look and feel to CLion. If you like Android Studio, then you’ll like CLion.

Code Navigation

The screenshot below shows what the environment looks like while coding. The top-left pane shows the file names in the project, and double-clicking on a name will display the code in the right pane; that’s pretty standard.

I like that for each function call, CLion will display the description of the parameter as shown with the red arrows.

Another powerful feature is the Structure pane (go to View->Tool Windows->Structure to open it). It shows a kind of summary of what’s in the code file. I frequently look at that while coding, to recall the names of (say) global variables, or functions and their parameter types. It’s a huge time-saver.

image


A super-powerful keypress is Ctrl-B. If your text cursor is in any function or variable name in the code, pressing Ctrl-B will immediately either highlight where the variable was defined, or it will open up the file containing that function or variable in a separate tab. You can quickly drill down through nested functions in this way.

SSH and Command Line Windows

Another neat feature (useful if your code resides on a separate Linux machine for instance) is the built-in SSH terminal capability. It’s possible to have a whole range of tabs opened up, including Windows command prompts, and they all appear in a pane at the bottom of the CLion window. To use SSH, go to Tools->Start SSH Session, or alternatively go to File->Settings->Tools->SSH Configurations first. Terminals can be collapsed out of the way while you’re using the code editor, by clicking on the indicator named Terminal at the bottom of the display.

image

Code Inspection

The code inspection (select Code->Inspect Code) looks interesting; I have not used it much yet:

image

Git and GitHub

Git and GitHub integration is built-in, and from what I tried, it is well executed. I’ll just comment on some basics, good enough for individual projects. If you’re working on large projects with many contributors, then it’s good to read up on the subject further.

image


You can set up your GitHub credentials from File->Settings->Version Control.


As soon as CLion starts, there are three buttons and the VCS one (it’s short for Version Control System) allows you to select that you want to open an existing project from GitHub.

image

Select your project as shown in the example below and click Clone (which just makes a copy of the content on GitHub, onto your PC, so that you can work with the code locally):

image

Now you can edit any files in the project, and once you’re happy that the code is functioning and ready for transferring to GitHub, the buttons shown highlighted in the screenshot below can be used; they are from left to right:

  1. Update Project
  2. Commit
  3. Push

image


Ordinarily, nine times out of ten, you’ll just push these buttons in sequence, left-to-right, and it’s that easy. However, if someone has modified the code on GitHub while you were working on the code, and they happened to work in the precisely same part of the code as you, then a window will appear where you can select whose work was right for that section of code : )

The first button is used to update your project local copy with any changes made in the version on GitHub behind your back by others (technically it's not behind your back if it's your own repository of course, since you'll have received an e-mail requesting your approval!).

image

The second button is called Commit and you can do that whenever you’re happy with your code; you can do it repeatedly so that you can progressively add your code improvements. For instance, if you need to add a function, you could add it, press Commit, and then later if you edit further and improve its performance, you could press Commit again.

The last button is called Push and it will send all the committed stuff to GitHub, so everyone can view it.

The rest of this blog post covers how to prepare the PC to work with the Pi Pico, and how to use CLion for Pi Pico projects.

Working with Pico: Installing Pre-Requisites (Pico C SDK, Pico Examples, and CLion)

Note: In 2024 onward, you don't need to manually install multiple items as the rest of this section mentions. Instead, do the following:

(a) Install the latest release of Pico setup for Windows. In my case, it was a file called pico-setup-windows-x64-standalone.exe that was run. Install it with all options including installing the examples. It will take a few minutes to install and then automatically compile the examples. The examples will be in a folder called C:\Users\<your_username>\Documents\Pico-v1.5.1

(b) In CLion, go to the File->Settings, and navigate to Build,Execution,Deployment->Toolchains, click on the '+' icon, and select System. Then, populate as follows (you may need to tweak your paths if you have a more recent Pico setup installed and apply it or click OK ):

image

(c) In the settings, go to CMake and type as shown here, and click apply or OK:

image

(d) If you have a project already open, then click on Tools->CMake->Reset Cache and Reload Project and then click on the hammer icon to build the project!

 

Old information pre-2024:

To save repeating stuff unnecessarily, a few things from an existing blog post called Working with the Raspberry Pi Pico with Windows and C/C++ can be followed, specifically the sections with these headings:

  • Install CMake
  • Install Python 3, Git, and ARM GCC Compiler
  • Get Code

After you have followed those steps, you’ll end up with a Pico-ready machine. You’ll have a folder called c:\development\pico, and inside there will be a sub-folder called pico-sdk, and another called pico-examples.

Next, if you have not already done so, download and install CLion (it is available for Windows, Linux and Mac). You can follow the steps on the CLion website.

Now you’re ready to open up projects with CLion, and edit them and build them. The pico-example projects will be discussed next.

Opening Projects with CLion

Start up CLion, and a window appears. Click on Open, navigate to the pico-examples folder, and then click OK.

image

After you click OK, the windows shown below will appear; it is the main CLion window in the background and an Open Project Wizard on top.

The purpose of this popup window is to set up how you want files to be compiled and joined together into a single executable firmware image file that you can later transfer to the Pi Pico. You can set up multiple configurations (for instance, you might create one that has slightly different capabilities for debugging/troubleshooting) but for now, a single configuration is sufficient; you can see that the configuration has a friendly name of Debug, and a folder name called cmake-build-debug in faint grey, which is a folder that CLion will automatically create. It’s a reasonable default so you don’t need to type anything there. A red highlighted area does need to be filled in, however, as discussed next:

image


There is one tiny bit of configuration that is needed, which is the text entry field called Environment, indicated with a red box in the screenshot above. It needs to be populated with this text:


PICO_SDK_PATH=c:\development\pico\pico-sdk


Once you have done that, click OK.

CLion has an I am busy type of area in the lower right part of the main window. You’ll see a progress bar there:

image

You’ll need to wait around a minute initially (less if you’ve got a fast PC, or more if it’s slow!), until there are no more progress bars in that area. During this time CLion is building up indices of the code contents for all of the Pico examples, and so on.

You’re now ready to go! Building any project is just seconds away with a couple of mouse clicks.


Building a Project


The pico-examples folder contains a lot of projects. You can select a project of interest by clicking on the triangle in a drop-down selection box at the top of the window. The screenshot below shows where to click to select an example called blink.

image

To explore the code, expand the file tree pane that is on the left side. Double-clicking on a file will display its contents in the right pane, as shown in the screenshot below. Click on the highlighted hammer icon at any time, to build the code!

image

When you click the hammer icon, the lower half of the CLion window will start displaying progress text, and the I am busy section will show progress bars.

image



A good indication that everything was successful is shown below.

image


Running the Project

The built project will be in the pico-examples/cmake-build-debug/blink folder.

image



If you can’t see the suffixes like .uf2, then in the Explorer options, remove the check-mark for Hide extensions for known file types so that it looks like as shown below:

image



To run the code, hold down the button that is present on the Pi Pico, and insert the USB connector into your PC.

image



Release the button after a few seconds, and you’ll see a window appear on the PC:

image


Drag the blink.uf2 file to the file area shown in red above, or to the drive letter.

image



That’s it – the LED on the Pico should be blinking because that’s what the code does.

Working with Picoprobe

The Picoprobe is a Serial Wire Debug (SWD) tool made from a Pi Pico (or any other RP2040 board). It can be used to accelerate development. You can use it to step through the code line-by-line, observe variable values, and you can also use it to upload code to the RP2040 more smoothly; no need to press the BOOTSEL button. The Picoprobe in the background works with GNU software called GDB, which should be installed as part of your GNU ARM GCC compiler installation.

First off, install prerequisite software called OpenOCD, which will talk to GDB. You need a special build of OpenOCD that supports the Picoprobe. If you're using Windows, then there are pre-built versions here:  https://github.com/shabaz123/rp2040tools

Place the software in a convenient location, for instance in a folder called c:\development, such that the path to openocd.exe is c:\development\openocd_rp2040\bin\openocd.exe

There are two different USB interface types of Picoprobe, and the next OpenOCD step differs depending on what type of Picoprobe is being used. If you're using the newer "CMSIS-DAP" type, then skip to the sub-section titled CMSIS-DAP Picoprobe.

Earlier non-CMSIS-DAP Picoprobe

Locate a folder called board (its path may be c:\development\openocd_rp2040\tcl\board or C:\development\myopenocdbuild\scripts\board (depending on where you got the OpenOCD software from), and there will be a file there called rp2040.cfg

Make a copy of that file, called (say) rp2040_clion.cfg  and prepend the following two lines at the beginning of this new file:


adapter driver picoprobe
adapter speed 5000

In CLion click File->Settings and select Embedded Development on the left of the pane that appears. Then, configure the full path and filename to OpenOCD (C:\development\openocd_rp2040\bin\openocd.exe if the OpenOCD steps earlier were followed).


Click Test and a green success box should appear. Click Apply and OK.

image

Once your CLion project is open, click on Run->Edit Configurations, then click the + symbol at the top-left, and select OpenOCD Download & Run.
Create a configuration, and name it to something memorable like myOpenOCD. For the Board config file setting, select the rp2040_clion.cfg file. You can click on the Assist button alongside the configuration box, so that it is populated correctly. Once everything else is configured as shown in the screenshot below, click on OK.

image

Note: in recent versions of CLion (2024 onward) I had to specifically set the project name as follows:

image

The CLion configuration is now complete for debugging purposes. As with other IDEs, once you’re ready to debug your application, click on the little bug icon:

image

Note that if youre using a version of CLion 2024 or onward, set to the 'new UI' mode, then you may see a view as shown here:

image

Here are some useful things to explore and click on when using the CLion and Picoprobe setup:

image

CMSIS-DAP Picoprobe

If you're using the newer CMSIS-DAP type of Picoprobe, then do everything in the Earlier non-CMSIS-DAP Picoprobe sub-section above, but instead of selecting the rp2040.cfg file (and renaming and editing that to rp2040_clion.cfg), just directly use the file called rp2040_cmsis_dap_clion.cfg, which is in the OpenOCD zip file available at https://github.com/shabaz123/rp2040tools. 


Summary


Creating C/C++ projects with the Pi Pico can actually be a lot of fun if the coding and testing experience is smooth. CLion provides a lot of benefits in that area, and it’s easy to get going with it.

There is no single "best" development environment, and with almost any solution that you use, you can customise things to your own liking through plugins, scripts and settings, and so on. I found CLion useful, so I wrote this blog. If you prefer a different IDE for working with the Pi Pico, it would be great to hear about it.

CLion currently costs £69 + tax for a permanent license, including upgrades for a year, and there is also a 30-day free trial. Personally, I think it’s worth it, but there are free options too. One is Eclipse, which I have not used with the Pico, so I cannot comment on it in detail, however, I have used Eclipse with other microcontrollers, and it’s competent, it is also very feature-rich. 

Another is Visual Studio Code, which I often use, and it’s excellent, but probably more so for frequent users of it, because newcomers may initially find it confusing, and it derives its strength from add-on extensions (and there are thousands of them!), whereas CLion, while it also supports plug-ins, offers a lot for C/C++ developers already built-in as shown in this blog. The CLion plugins are available in a Marketplace – there’s even a vim emulation plugin.

Thanks for reading!

  • Sign in to reply
  • rockethm
    rockethm 6 months ago in reply to shabaz

    Tried a few things over here but nothing. Guess I'll have to spend some time with jetbrains. Thanks for the help and the blog post!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz 6 months ago in reply to rockethm

    Latest Pico SDK and latest CLion have both made things difficult; it used to be easy.

    Here are the settings that are working for me (click them to zoom in):

    image

    image

    If you've got similar settings but it still isn't working for you, I'd strongly suggest raising a case with JetBrains. They do respond, and they did help me although it required lots of ping-ponging with screenshots for whatever they requested. Please post here your findings, to help others. It is very annoying that JetBrains do not have a config documented anywhere for working with Pi Pico. If you do contact them, you should point them to this blog to let them know there are CLion users with Pi Pico, and that they don't feel the config is straightforward any more, as evidenced by the length of the blog post!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • rockethm
    rockethm 6 months ago

    Hi, I've tried this on two separate windows machines and can't get it working. When I hit reload project it gives me the following:

    C:\Users\Andre\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/Users/Andre/AppData/Local/Programs/CLion/bin/ninja/win/x64/ninja.exe -G Ninja "-DCMAKE_C_COMPILER=C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\13.3 rel1\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER=C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\13.3 rel1\bin\arm-none-eabi-g++.exe" -S C:\Users\Andre\CLionProjects\untitled -B C:\Users\Andre\CLionProjects\untitled\cmake-build-debug
    -- The C compiler identification is GNU 13.3.1
    -- The CXX compiler identification is GNU 13.3.1
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - failed
    -- Check for working C compiler: C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/13.3 rel1/bin/arm-none-eabi-gcc.exe
    -- Check for working C compiler: C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/13.3 rel1/bin/arm-none-eabi-gcc.exe - broken
    CMake Error at C:/Users/Andre/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message):
      The C compiler

        "C:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/13.3 rel1/bin/arm-none-eabi-gcc.exe"

      is not able to compile a simple test program.

      It fails with the following output:

        Change Dir: 'C:/Users/Andre/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-kxnyro'
        
        Run Build Command(s): C:/Users/Andre/AppData/Local/Programs/CLion/bin/ninja/win/x64/ninja.exe -v cmTC_8436a
        [1/2] C:\PROGRA~2\ARMGNU~1\133167~1.3RE\bin\AR19DD~1.EXE   -fdiagnostics-color=always -o CMakeFiles/cmTC_8436a.dir/testCCompiler.c.obj -c C:/Users/Andre/CLionProjects/untitled/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-kxnyro/testCCompiler.c
        [2/2] C:\windows\system32\cmd.exe /C "cd . && C:\PROGRA~2\ARMGNU~1\133167~1.3RE\bin\AR19DD~1.EXE   CMakeFiles/cmTC_8436a.dir/testCCompiler.c.obj -o cmTC_8436a.exe -Wl,--out-implib,libcmTC_8436a.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
        FAILED: cmTC_8436a.exe
        C:\windows\system32\cmd.exe /C "cd . && C:\PROGRA~2\ARMGNU~1\133167~1.3RE\bin\AR19DD~1.EXE   CMakeFiles/cmTC_8436a.dir/testCCompiler.c.obj -o cmTC_8436a.exe -Wl,--out-implib,libcmTC_8436a.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
        C:/PROGRA~2/ARMGNU~1/133167~1.3RE/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
        C:/PROGRA~2/ARMGNU~1/133167~1.3RE/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
        collect2.exe: error: ld returned 1 exit status
        ninja: build stopped: subcommand failed.
        
        

     

      CMake will not be able to correctly generate this project.
    Call Stack (most recent call first):
      CMakeLists.txt:2 (project)


    -- Configuring incomplete, errors occurred!

    [Finished]


    I have no idea what I should do to make it work

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz 11 months ago in reply to Jan Cumps

    Hm, I take it back. Seems 13.3rel1 is working. Don't know where I went wrong last night.

    image

    image

    The default CMake options are (unpasteable as text! only visible by hovering over):

    image

    image

    I don't know where I was going wrong with it yesterday, but glad it's functioning!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps 11 months ago in reply to shabaz

    Is it possible to show what all the options are in the section CMake options?

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube