Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Arduino SDK 1.6 compatibility #174

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8d19e10
Added Arduino SDK 1.6 compatibility
JonasProgrammer May 5, 2017
5bc8777
Merge branch 'feature/arduino16-compatibility' into n3-stable
JonasProgrammer May 5, 2017
b77542e
Fix SPI hardware library detection
JonasProgrammer May 9, 2017
3d3c4d4
Merge branch 'feature/arduino16-compatibility' into n3-stable
JonasProgrammer May 9, 2017
2bd93c3
Fix libraries, improve CMake compatibility
JonasProgrammer May 11, 2017
110921e
Merge branch 'feature/arduino16-compatibility' into n3-stable
JonasProgrammer May 11, 2017
1c6484a
Fix upload target for build paths containing spaces or special charac…
JonasProgrammer May 20, 2017
e28eb25
Merge branch 'feature/arduino16-compatibility' into n3-stable
JonasProgrammer May 20, 2017
39f80c4
Fixed Firmware-Size script possibly not executing on Windows systems.
MrPointer May 30, 2017
08ca0ee
Reformatted file to have basic indentations.
MrPointer May 30, 2017
de0097e
Added a valuable comment to a somewhat unclear intention in the 'REGI…
MrPointer May 31, 2017
8ae7de0
Added support for menu settings, compatible with the Arduino 1.6 SDK,…
MrPointer May 31, 2017
ae273d6
Added custom parse to the 'board.menu.cpu' sub-setting, creating a li…
MrPointer Jun 1, 2017
33c7a73
Updated documentation of the 'LOAD_ARDUINO_STYLE_SETTINGS' function w…
MrPointer Jun 1, 2017
a8e4faf
Updated .gitignore file to ignore CMake files as well as Jetbrains ID…
MrPointer Jun 1, 2017
ba408f6
Collapsed all functions into logical regions.
MrPointer Jun 1, 2017
c842cd6
Added a feature to automatically find and set board's upload speed in…
MrPointer Jun 2, 2017
4118c50
Added a feature to automatically find and set bootloader arguments in…
MrPointer Jun 2, 2017
2aa7b04
Merge pull request #2 from MrPointer/arduino16-board_settings
JonasProgrammer Jun 2, 2017
f548d26
Merge remote-tracking branch 'origin/arduino16-board_settings' into f…
MrPointer Jun 3, 2017
f58dae2
Merge remote-tracking branch 'origin/feature/arduino16-compatibility'…
MrPointer Jun 3, 2017
4ebd7a4
Added Arduino basic examples support.
MrPointer Jun 3, 2017
5a25fef
Extended support for basic built-in Arduino examples.
MrPointer Jun 4, 2017
a8ff121
Added support for all 'Example categories indices'.
MrPointer Jun 6, 2017
0a72486
Renamed 'ARDUINO_EXAMPLES' cached variable to 'ARDUINO_EXAMPLES_CATEG…
MrPointer Jun 6, 2017
f0c7f20
Modified a lot of the library setup procedure.
MrPointer Jun 10, 2017
2e7444f
Huge commit - resolved a tough issue regarding sketches.
MrPointer Jun 18, 2017
0aaa0b9
Fixed a small potential bug in the 'find_arduino_libraries' function …
MrPointer Jun 24, 2017
7e5bdd3
Fixed some bugs related to category parsing.
MrPointer Jun 24, 2017
749aaad
Merge remote-tracking branch 'origin/arduino_examples' into arduino_i…
MrPointer Jun 24, 2017
a689bea
Merge remote-tracking branch 'origin/arduino_libraries' into arduino_…
MrPointer Jun 24, 2017
b21b28a
Turned off *arduino_debug* messages, added an alternative (by comment…
MrPointer Jun 24, 2017
cadbd7f
Added case-insensitive support for category names as well as example …
MrPointer Jun 24, 2017
c97280f
Merge remote-tracking branch 'origin/arduino_examples' into arduino_i…
MrPointer Jun 24, 2017
dbacacb
Updated README.rst to be up-to-date with the fork
MrPointer Jun 24, 2017
2608e7b
Merge pull request #3 from MrPointer/arduino_improvements
JonasProgrammer Jun 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added a feature to automatically find and set bootloader arguments in…
… the Arduino 1.6 SDK.

Board's cpu architecture (mcu) must be defined through the variable 'board.build.mcu' for this feature to work.
MrPointer committed Jun 2, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 4118c50c4b7a7848a6a755c3f2a11cf9790504fe
94 changes: 64 additions & 30 deletions cmake/Platform/Arduino.cmake
Original file line number Diff line number Diff line change
@@ -780,6 +780,10 @@ macro(PARSE_GENERATOR_ARGUMENTS TARGET_NAME PREFIX OPTIONS ARGS MULTI_ARGS)
load_generator_settings(${TARGET_NAME} ${PREFIX} ${OPTIONS} ${ARGS} ${MULTI_ARGS})
endmacro()

macro(GET_MCU FULL_MCU_NAME OUTPUT_VAR)
string(REGEX MATCH "^.+[^p]" ${OUTPUT_VAR} "FULL_MCU_NAME" PARENT_SCOPE)
endmacro()


#=============================================================================#
# Load Functions
@@ -1326,33 +1330,40 @@ function(setup_arduino_bootloader_burn TARGET_NAME BOARD_ID PROGRAMMER PORT AVRD
return()
endif ()

# boards.txt file format changed in version 1.5 and greater
if (ARDUINO_SDK_VERSION VERSION_GREATER 1.0.5)

##
##
##
# TODO : manage menus
##
##
##
# look at bootloader.file
if (NOT ${BOARD_ID}.bootloader.file)
message("Missing ${BOARD_ID}.bootloader.file, not creating bootloader burn target ${BOOTLOADER_TARGET}.")
return()
# look at bootloader.file
set(BOOTLOADER_FOUND True)
if (NOT ${BOARD_ID}.bootloader.file)
set(BOOTLOADER_FOUND False)
# Bootloader is probably defined in the 'menu' settings of the Arduino 1.6 SDK
if (${BOARD_ID}.build.mcu)
GET_MCU(${${BOARD_ID}.build.mcu} BOARD_MCU)
if (NOT ${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.file)
message("Missing ${BOARD_ID}.bootloader.file, not creating bootloader burn target ${BOOTLOADER_TARGET}.")
return()
endif ()
set(BOOTLOADER_FOUND True)
set(${BOARD_ID}.bootloader.file ${${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.file)
endif ()
# build bootloader.path from bootloader.file...
string(REGEX MATCH "(.+/)*" ${BOARD_ID}.bootloader.path ${${BOARD_ID}.bootloader.file})
string(REGEX REPLACE "/" "" ${BOARD_ID}.bootloader.path ${${BOARD_ID}.bootloader.path})
# and fix bootloader.file
string(REGEX MATCH "/.(.+)$" ${BOARD_ID}.bootloader.file ${${BOARD_ID}.bootloader.file})
string(REGEX REPLACE "/" "" ${BOARD_ID}.bootloader.file ${${BOARD_ID}.bootloader.file})
endif ()

if (NOT ${BOOTLOADER_FOUND})
return()
endif ()

# build bootloader.path from bootloader.file...
string(REGEX MATCH "(.+/)*" ${BOARD_ID}.bootloader.path ${${BOARD_ID}.bootloader.file})
string(REGEX REPLACE "/" "" ${BOARD_ID}.bootloader.path ${${BOARD_ID}.bootloader.path})
# and fix bootloader.file
string(REGEX MATCH "/.(.+)$" ${BOARD_ID}.bootloader.file ${${BOARD_ID}.bootloader.file})
string(REGEX REPLACE "/" "" ${BOARD_ID}.bootloader.file ${${BOARD_ID}.bootloader.file})

foreach (ITEM unlock_bits high_fuses low_fuses path file)
if (NOT ${BOARD_ID}.bootloader.${ITEM})
message("Missing ${BOARD_ID}.bootloader.${ITEM}, not creating bootloader burn target ${BOOTLOADER_TARGET}.")
return()
# Try the 'menu' settings of the Arduino 1.6 SDK
if (NOT ${BOARD_ID}.menu.cpu.{BOARD_MCU}.bootloader.${ITEM})
message("Missing ${BOARD_ID}.bootloader.${ITEM}, not creating bootloader burn target ${BOOTLOADER_TARGET}.")
return()
endif ()
endif ()
endforeach ()

@@ -1366,19 +1377,42 @@ function(setup_arduino_bootloader_burn TARGET_NAME BOARD_ID PROGRAMMER PORT AVRD
list(APPEND AVRDUDE_ARGS "-e")

# Set unlock bits and fuses (because chip is going to be erased)
list(APPEND AVRDUDE_ARGS "-Ulock:w:${${BOARD_ID}.bootloader.unlock_bits}:m")

if (${BOARD_ID}.bootloader.unlock_bits)
list(APPEND AVRDUDE_ARGS "-Ulock:w:${${BOARD_ID}.bootloader.unlock_bits}:m")
else ()
# Arduino 1.6 SDK
list(APPEND AVRDUDE_ARGS
"-Ulock:w:${${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.unlock_bits}:m")
endif ()

if (${BOARD_ID}.bootloader.extended_fuses)
list(APPEND AVRDUDE_ARGS "-Uefuse:w:${${BOARD_ID}.bootloader.extended_fuses}:m")
elseif (${${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.extended_fuses})
list(APPEND AVRDUDE_ARGS
"-Uefuse:w:${${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.extended_fuses}:m")
endif ()
if (${BOARD_ID}.bootloader.high_fuses)
list(APPEND AVRDUDE_ARGS
"-Uhfuse:w:${${BOARD_ID}.bootloader.high_fuses}:m"
"-Ulfuse:w:${${BOARD_ID}.bootloader.low_fuses}:m")
else ()
list(APPEND AVRDUDE_ARGS
"-Uhfuse:w:${${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.high_fuses}:m"
"-Ulfuse:w:${${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.low_fuses}:m")
endif ()
list(APPEND AVRDUDE_ARGS
"-Uhfuse:w:${${BOARD_ID}.bootloader.high_fuses}:m"
"-Ulfuse:w:${${BOARD_ID}.bootloader.low_fuses}:m")

# Set bootloader image
list(APPEND AVRDUDE_ARGS "-Uflash:w:${${BOARD_ID}.bootloader.file}:i")

# Set lockbits
list(APPEND AVRDUDE_ARGS "-Ulock:w:${${BOARD_ID}.bootloader.lock_bits}:m")
if (${BOARD_ID}.bootloader.lock_bits)
list(APPEND AVRDUDE_ARGS "-Ulock:w:${${BOARD_ID}.bootloader.lock_bits}:m")
else ()
list(APPEND AVRDUDE_ARGS
"-Ulock:w:${${BOARD_ID}.menu.cpu.${BOARD_MCU}.bootloader.lock_bits}:m")
endif ()


# Create burn bootloader target
add_custom_target(${BOOTLOADER_TARGET}
@@ -1485,7 +1519,7 @@ function(setup_arduino_bootloader_args BOARD_ID TARGET_NAME PORT AVRDUDE_FLAGS O
list(FIND ${BOARD_ID}.SETTINGS menu MENU_SETTINGS)
# Determine upload speed based on the defined cpu architecture (mcu)
if (${BOARD_ID}.build.mcu)
string(REGEX MATCH "^.+[^p]" BOARD_MCU "${${BOARD_ID}.build.mcu}")
GET_MCU(${${BOARD_ID}.build.mcu} BOARD_MCU)
list(FIND ${BOARD_ID}.menu.CPUS ${BOARD_MCU} BOARD_MCU_INDEX)
if (BOARD_MCU_INDEX GREATER_EQUAL 0) # Matching mcu is found
set(UPLOAD_SPEED ${${BOARD_ID}.menu.cpu.${BOARD_MCU}.upload.speed})
@@ -1495,8 +1529,8 @@ function(setup_arduino_bootloader_args BOARD_ID TARGET_NAME PORT AVRDUDE_FLAGS O

list(APPEND AVRDUDE_ARGS
"-b${UPLOAD_SPEED}" # Baud rate
"-P${PORT}" # Serial port
"-D" # Dont erase
"-P${PORT}" # Serial port
"-D" # Dont erase
)

list(APPEND AVRDUDE_ARGS ${AVRDUDE_FLAGS})