Comments (7)
I tried compiling for the Optiboot on Mega2560 here, and it seems to be working well.
From the above error message, it looks like the toolchain expects the compiler inside /usr/share/arduino/hardware/tools/avr
(Location of Arduino installation), but could not find. So it tries to find alternative package manager path in /home/hacki/git/homeduino/_pkg_mgr/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7
and could not find there as well (Since package manager is not enabled). Toolchain never looks for the compiler from PATH (It is not as per the specification). Where is it located in your installation, that may provide a clue?
You may try providing the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER paths in the the generated ArduinoSystem.cmake in the build directory. However this file can get overwritten whenever BoardOptions.cmake is changed and is not a reliable solution.
Alternatively, you may try using package manager, as given below, which downloads the compiler and uses, if not found in the expected locations.
cmake -D CMAKE_TOOLCHAIN_FILE=/path/to/Arduino-toolchain.cmake -D ARDUINO_BOARD_MANAGER_URL=https://github.com/Optiboot/optiboot/releases/download/v8.0/package_optiboot_optiboot-additional_index.json /path/to/Examples/01_hello_world
from arduino-cmake-toolchain.
hacki@lx-hacki:~/git/homeduino$ locate avr-g++
/usr/bin/avr-g++
/usr/share/arduino/hardware/tools/avr/bin/avr-g++
acki@lx-hacki:~/git/homeduino$ locate avr-gcc
/usr/bin/avr-gcc
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc
If i change avr-gcc and avr-g++ executables in ArduinoSystem.cmake and add the path /usr/share/arduino/hardware/tools/avr/bin to ARDUINO_FIND_ROOT_PATH
it will work.
Using the BOARD_MANAGER_URL leads to the same issue. Seems there is a dependency to exactly this compiler:
acki@lx-hacki:~/git/homeduino$ cmake -DCMAKE_TOOLCHAIN_FILE=~/git/Arduino-CMake-Toolchain/Arduino-toolchain.cmake -D ARDUINO_BOARD_MANAGER_URL=https://github.com/Optiboot/optiboot/releases/download/v8.0/package_optiboot_optiboot-additional_index.json --debug -D CMAKE_VERBOSE_MAKEFILE=VERBOSE .
ARDUINO_INSTALL_PATH:/usr/share/arduino
ARDUINO_PACKAGE_PATH:/home/hacki/.arduino15
ARDUINO_PREFERENCE_FILE:/home/hacki/.arduino15/preferences.txt
ARDUINO_SKETCHBOOK_PATH:/home/hacki/Arduino
-- Found Arduino package /home/hacki/git/homeduino/_pkg_mgr/package_optiboot_optiboot-additional_index.json
-- Found Arduino package /home/hacki/.arduino15/package_index.json
-- Found Arduino package /usr/share/arduino/hardware/package_index_bundled.json
-- Found Arduino Platform: /home/hacki/git/homeduino/_pkg_mgr/packages/Optiboot/hardware/avr/0.8.0
-- Selected Arduino Board: Optiboot on Mega2560 [avr.optiboot2560]
-- Platform dependency Optiboot 8.0 => 'Arduino AVR Boards' from 'Arduino'
-- Platform dependency Optiboot 8.0 => 'Arduino AVR Boards' from 'Arduino'
-- Tool dependency Optiboot 8.0 => 'avr-gcc (7.3.0-atmel3.6.1-arduino7)' from 'Arduino'
-- Tool dependency Optiboot 8.0 => 'avrdude (6.3.0-arduino17)' from 'Arduino'
-- Tool dependency Optiboot 8.0 => 'arduinoOTA (1.3.0)' from 'Arduino'
-- Tool dependency Optiboot 8.0 => 'avrdude (6.0.1-arduino5)' from 'Arduino'
-- Tool dependency Optiboot 8.0 => 'avr-gcc (7.3.0-atmel3.6.1-arduino7)' from 'Arduino'
-- Tool dependency Optiboot 8.0 => 'avrdude (6.3.0-arduino17)' from 'Arduino'
-- Tool dependency Optiboot 8.0 => 'arduinoOTA (1.3.0)' from 'Arduino'
_rule_cmd:/home/hacki/git/homeduino/_pkg_mgr/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc
from arduino-cmake-toolchain.
- removed anything of optiboot from ~/.arduino15/
- updated "Arduino AVR Boards" in Boardmanager in Arduino IDE
- added optiboot package json Arduino additional board manager urls
- installed Optiboot 8.0 in Boardmanager in Arduino IDE
now it will find the right compiler!
Edit: Wow, there is even an upload network task in my jetbrains clion ide. thanks for the effort you put in this project, it's awesome!
from arduino-cmake-toolchain.
if i understood upload-network cmake target correctly, if have to create an additional make call with the required environment variables to the upload-network target, right?
from arduino-cmake-toolchain.
Good to know that it worked after you refreshed your Arduino Installation. I still wonder why the alternative package manager did not work for you. In case you need this, you may try with a new build directory, and post the full error logs for analysis.
Network upload depends on the way you achieved network connectivity to the board. Some possible options that may work are
- esp-link in which case you may want to look at the Arduino specific comments there. upload-network arguments take these parameters. Be aware of the need of 5V/3.3V voltage conversion between Mega and ESP.
- ArduinoOTA if you are using some Ethernet/WiFi shield. If you copy the platform.local.txt as instructed, and then invoke the clean CMake build. upload-network parameters should change appropriately (taking only IP address, port and password).
from arduino-cmake-toolchain.
I took option 2.
Had to copy my platform.local.txt
to /home/hacki/.arduino15/packages/Optiboot/hardware/avr/0.8.0
.
Then i can use the following make file run configuration with just NETWORK_IP, NETWORK_PASSWORD and TARGET like you said:
Works:
Connecting to board ... done
Uploading sketch ... done
Flashing sketch ... done
Sketch uploaded successfully
Built target upload-network
Thanks again, great work!
from arduino-cmake-toolchain.
Will close this issue and label this as question as there are no changes made.
from arduino-cmake-toolchain.
Related Issues (20)
- Linking error when compiling stm32duino project HOT 2
- [Question/Bug] target_link_arduino_libraries - possible bug HOT 3
- Sketch (ino) support broken HOT 5
- Prebuild command not execuded before cmake compiler check. HOT 1
- Dependency on the Arduino IDE
- 'Arduino Uno WiFi Rev2' support
- Can't find pins_arduino.h on Attiny85
- Arduino Nano 33 BLE: undefined reference to `main'
- platform.local.txt not supported
- Esp32 tests fail HOT 1
- Upload fails on avr:leonardo HOT 2
- No compiler warnings? Can compiler flags be set on a by-target basis? HOT 2
- `CMAKE_`Lang`_STANDARD`(`_REQUIRED`)? (i.e. `CMAKE_CXX_STANDARD_REQUIRED`) is ignored.
- Support building with clang
- Maintained version HOT 1
- undefined reference to `setup()' HOT 19
- Toolchain build fails on Mac OS with ESP32 Platform v2.x.x HOT 2
- build.opt not found HOT 1
- Query: do you know if this works with the Arduino setup on Mac OS? HOT 4
- Constants not defined during compilation HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-cmake-toolchain.