6 years ago.

How can I use mbed 1768 on CLion?

I want to use mbed 1768 on CLion(https://www.jetbrains.com/clion/). But couldn't find dependencies to use that.

1 Answer

5 years, 12 months ago.

Hi there,

You can open your Mbed OS LPC1768 project in CLion by exporting your project to the CMake-GCC-ARM toolchain within the online compiler or Mbed CLI. For example, import the mbed-os-example-blinky project into your online compiler. Make sure you have selected the LPC1768 as your target in the top right hand corner. If you do not see the LPC1768, add it to your online compiler from it's board page here.

Then, right click on your project's name in the online compiler and select "Export program...". Then make sure your export target is the LPC1768 and your export toolchain is "CMake-GCC-ARM". Then click "Export" and download the .zip file to your computer.

You will need to have the GCC ARM toolchain installed to your computer: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm

Extract the .zip file somewhere on your computer. Then open up CLion and create a new project by "Import Project from Sources" and select the extracted Mbed OS project folder on your computer. Make sure you do not let CLion override your existing CMakeLists.txt file.

You may need to add full directory paths to your cmake compilers in the CMakeLists.txt file, for example these paths look like the following on my Macbook on line 15 of the CMakeLists.txt file:

SET(CMAKE_ASM_COMPILER    "/Users/jenplu01/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc")
SET(CMAKE_C_COMPILER      "/Users/jenplu01/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc")
SET(CMAKE_CXX_COMPILER    "/Users/jenplu01/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-g++")
SET(ELF2BIN               "/Users/jenplu01/opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-objcopy")

Please let me know if you have any questions!

- Jenny, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

I using Windows10, so wrote belows...

# force cmake compilers
SET(CMAKE_ASM_COMPILER    "D:\\Apps\\GCC\\7 2017-q4-major\\bin\\arm-none-eabi-gcc")
SET(CMAKE_C_COMPILER      "D:\\Apps\\GCC\\7 2017-q4-major\\bin\\arm-none-eabi-gcc")
SET(CMAKE_CXX_COMPILER    "D:\\Apps\\GCC\\7 2017-q4-major\\bin\\arm-none-eabi-g++")
SET(ELF2BIN               "D:\\Apps\\GCC\\7 2017-q4-major\\bin\\arm-none-eabi-objcopy")

but I catches parse error. How to fix this?

CMake Error at cmake-build-debug/CMakeFiles/3.10.3/CMakeCCompiler.cmake:1 (set):
  Syntax error in cmake code at

    D:/Repository/Square_pants/cmake-build-debug/CMakeFiles/3.10.3/CMakeCCompiler.cmake:1

  when parsing string

    D:\Apps\GCC\7 2017-q4-major\bin\arm-none-eabi-gcc

  Invalid character escape '\A'.
posted by Json Jon 26 Apr 2018

Hi, try changing your cmake compiler paths to use different slashes.

posted by Jenny Plunkett 27 Apr 2018

Dear Jenny Specifically, how do I fix this error?

posted by Json Jon 30 Apr 2018

Try paths such as: D:/Apps/GCC/7 2017-q4-major/bin/arm-none-eabi-gcc

- Jenny, team Mbed

posted by Jenny Plunkett 30 Apr 2018

I changed it like that, but the same error is thrown.

posted by Json Jon 01 May 2018

Please try reverting to the paths to what they were originally then, I apologize for the confusion.

posted by Jenny Plunkett 01 May 2018

hmm... can't fix it... Also, I tried removing blanks, but it did not improve.

posted by Json Jon 01 May 2018

Anyone help me?

posted by Json Jon 17 May 2018

Is there any similar way when using ARMC6 compiler instead of GCC?

posted by Bojan Potocnik 11 Aug 2018