Open rafaelgov95 opened 7 years ago
It is because the 'Mega' board has multiple architectures it can operate on.
As such, you should manually specify the architecture being used by adding the following line to your CMakeLists.txt file:
set(mega.build.mcu atmega2560)
Note that some other boards such as the 'Nano' also have this "limitation", and therefore should be manually defined. However, every board has a different ID, and possibly a different architecture, thus have to be defined differently, according to the following pattern:
set(BOARD_ID.build.mcu ARCHITECTURE)
Serial
will be resolved afterwards, even without including the HardwareSerial
header file.
Put the indicated line but did not do it, continue with the error.
Try to reset CMake's cache instead of just reloading it, should solve the issue.
Do you have any design you can share? I think it's a problem in the project!
OK, here is a very basic CMakeLists.txt file that I've to test again the Nano board, which also has multiple cpu architectures.
cmake_minimum_required(VERSION 3.7)
set(CMAKE_TOOLCHAIN_FILE cmake/ArduinoToolchain.cmake)
set(ARDUINO_1_5 True)
set(CMAKE_CXX_STANDARD 11)
project(Blink)
set(SOURCE_FILES blink.cpp)
set(${CMAKE_PROJECT_NAME}_SRCS ${SOURCE_FILES})
set(${CMAKE_PROJECT_NAME}_BOARD nano)
# Explicity define board's properties
set(nano.build.mcu atmega328p)
set(nano.upload.speed 57600)
GENERATE_ARDUINO_FIRMWARE(${CMAKE_PROJECT_NAME})
set(ARDUINO_1_5 True)
should be defined only if your used SDK version is bigger than 1.5 (Today's most recent version found in the official site is 1.8.2)set(nano.build.mcu atmega328p)
is the one you need. Remember to change nano to mega in your configuration. Also note that the p letter after the processor architecture is not mandatory, and can be omitted.set(nano.upload.speed 57600)
is defined to explicitly set avrdude's uploading speed. The value is taken from the boards.txt
file located in the Arduino SDK, and is currently required to upload something to the connected board. Do note that each board has its own unique baud rate (value).An official resurrection of the project exist, including a complete fix to this issue! Please see #180 :)
When running upload, it gives the following error
/exemple/CMakeLists.txt
/exemple/exemple.cpp
n cpp the Serial function turns red without a library
I need grateful help!