Closed hacki11 closed 3 years ago
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
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
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!
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?
like:
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
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!
Will close this issue and label this as question as there are no changes made.
Hi, having my Board as mega 2560 everything is fine. All compilers are found and perfectly used. But now i have burned Optiboot onto my mega and selected the optiboot2560 board.
Now it searches avr-gcc and avr-g++ in paths where no binary is located. avr-gcc and avrg++ are available via Path. I have added CMAKE_CXX_COMPILER and CMAKE_C_COMPILER but no success.
Can you give me any pointers where i could possibly look? I can't tell if the optiboot files are wrong or there is something with arduino toolchain.
Board from Optiboot
set(ARDUINO_BOARD "avr.optiboot2560") # Optiboot on Mega2560
CMakeError.log