arduino-cmake icon indicating copy to clipboard operation
arduino-cmake copied to clipboard

Doesn't find any board configuration

Open narrowtux opened this issue 10 years ago • 8 comments
trafficstars

I have a very simple project configuration, posted on this Gist.

As you can see, I reconfigured the example config a bit but everything else is still at the same place (toolchain and Arduino.cmake files in cmake/...).

When I execute cmake from the build/ directory with cmake .., it will throw this error:

Scarecrow:build tux$ cmake ..
--
-- Generating testtesttest
CMake Error at cmake/Platform/Arduino.cmake:830 (message):
  Invalid Arduino board ID (uno), aborting.
Call Stack (most recent call first):
  cmake/Platform/Arduino.cmake:1071 (get_arduino_flags)
  cmake/Platform/Arduino.cmake:516 (setup_arduino_target)
  testtesttest/CMakeLists.txt:8 (generate_arduino_firmware)


-- Configuring incomplete, errors occurred!
See also "/Users/tux/Downloads/arduino-cmake-master/build/CMakeFiles/CMakeOutput.log".
See also "/Users/tux/Downloads/arduino-cmake-master/build/CMakeFiles/CMakeError.log".

As you can see, it can't find the configuration for the Arduino Uno. In fact, it doesn't have any configuration for any other board (since you can see print_board_list() doesn't list anything.

I dug a bit with cmake --trace .. and saw that register_hardware_platform(${ARDUINO_SDK_PATH}/hardware/arduino/) is never executed.

Can I change something in my configuration so it will load the boards.txt file?

narrowtux avatar Apr 10 '15 10:04 narrowtux

This happens because the master branch is currently not compatible with the Arduino SDK 1.5/1.6.

I had more luck with: https://github.com/blemasle/arduino-cmake But you need to set ARDUINO_1_5 to True.

Honestly, Ardunio development is a huge mess right now ... It all needs to settle down a bit.

hanikesn avatar Apr 10 '15 10:04 hanikesn

Thanks, that worked :)

narrowtux avatar Apr 10 '15 10:04 narrowtux

For the sake of people still having a problem with this, I have found that changing set(${PROJECT_NAME}_BOARD pro) to set(${PROJECT_NAME}_BOARD uno) or any other board fails unless I comment out set(ARDUINO_CPU 16MHzatmega328). It appears that setting the CPU causes problems if the board doesn't support multiple CPUs

murray-lang avatar Feb 01 '17 06:02 murray-lang

I think the issue is caused by the folder structure of the arduino sdk. The boards.txt is located in your_path_to_sdk/hardware/arduino/avr. However, in the CMakeLists.txt, the path where the boards.txt file is required to be is: your_path_to_sdk/hardware/arduino. Changing this worked for me. I am using arduino sdk 1.8.6.

axelbr avatar Sep 07 '18 18:09 axelbr

The issue mentioned by @axelbr can be solved by adding register_hardware_platform(${ARDUINO_SDK_PATH}/hardware/arduino/avr) to your CMakeLists.txt (so you shouldn't even patch arduino-cmake itself). I know it's an old thread, but I found this page by googling the error message, so I wanted to share this solution for other people landing here.

maartendemunck avatar Dec 13 '18 20:12 maartendemunck

Thank you @maartendemunck. That worked for me.

nnarain avatar Jun 13 '19 13:06 nnarain

I came across this issue looking for a solution with the Clion arduino plugin on arch linux. The solution here was to create a soft link for the arduino hardware platform path which is usually /usr/share/arduino/hardware/archlinux-arduino/avr and should be /usr/share/arduino/hardware/arduino/avr. It was also necessary to recreate the Clion arduino project. With an existing project which I imported from my old linux environment it didn't worked due to register_hardware_platform(${ARDUINO_SDK_PATH}/hardware/arduino/avr) was never called. Im currently not sure why it works with a new created Clion arduino project but anyway it works :smile:

schlegel11 avatar May 21 '20 15:05 schlegel11

Thanks @schlegel11. I had to recreate the project as well after ln -s /usr/share/arduino/hardware/archlinux-arduino/ /usr/share/arduino/hardware/arduino

gsilvan avatar May 30 '20 09:05 gsilvan