Skip to content

Commit 158786a

Browse files
committed
cmake: Add support for Arduino Nano with old bootloader
The old bootloader is using 57600 instead of 115200 baud.
1 parent e448949 commit 158786a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@ if (config_h_lines)
1616
set(ARDUINO_AVR_MEGA_MENU_CPU_ATMEGA2560 TRUE)
1717
else(config_h_lines)
1818
set(ARDUINO_BOARD "Arduino Nano [avr.nano]")
19-
set(ARDUINO_AVR_NANO_MENU_CPU_ATMEGA328 TRUE)
19+
20+
option(OLD_BOOTLOADER "Arduino Nano uses old bootloader (57600 baud)" OFF)
21+
if (OLD_BOOTLOADER)
22+
set(ARDUINO_AVR_NANO_MENU_CPU_ATMEGA328OLD TRUE)
23+
else (OLD_BOOTLOADER)
24+
set(ARDUINO_AVR_NANO_MENU_CPU_ATMEGA328 TRUE)
25+
endif (OLD_BOOTLOADER)
2026
endif(config_h_lines)
27+
set(ARDUINO_PROGRAMMER "Arduino as ISP [avr.arduinoasisp]")
2128

2229
cmake_minimum_required(VERSION 3.7.0)
2330
project(Pedelec_Controller C CXX)

docs/README_cmake.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ Note: Linux only for now. Windows support is untested.
1212
cd build
1313
cmake ../
1414

15+
Most likely you will have to give the Arduino install path:
16+
cmake -DARDUINO_INSTALL_PATH=/tmp ../
17+
18+
If you have a FC before 2.x and the Arduino Nano uses
19+
the old bootloader (57600 baud), use this option:
20+
21+
cmake cmake -DARDUINO_INSTALL_PATH=/tmp -DOLD_BOOTLOADER=ON ../
22+
1523
2. Compile
1624

1725
cd build
@@ -20,4 +28,4 @@ Note: Linux only for now. Windows support is untested.
2028
3. Upload
2129

2230
cd build
23-
make pcontroller-upload
31+
make upload-pcontroller SERIAL_PORT=/dev/ttyUSB0

0 commit comments

Comments
 (0)