|  | 
|  | 1 | +# Copyright (c) 2014-2015 Arduino LLC.  All right reserved. | 
|  | 2 | +# | 
|  | 3 | +# This library is free software; you can redistribute it and/or | 
|  | 4 | +# modify it under the terms of the GNU Lesser General Public | 
|  | 5 | +# License as published by the Free Software Foundation; either | 
|  | 6 | +# version 2.1 of the License, or (at your option) any later version. | 
|  | 7 | +# | 
|  | 8 | +# This library is distributed in the hope that it will be useful, | 
|  | 9 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 10 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 
|  | 11 | +# See the GNU Lesser General Public License for more details. | 
|  | 12 | +# | 
|  | 13 | +# You should have received a copy of the GNU Lesser General Public | 
|  | 14 | +# License along with this library; if not, write to the Free Software | 
|  | 15 | +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
|  | 16 | + | 
|  | 17 | +# Arduino SAMD Core and platform. | 
|  | 18 | +# | 
|  | 19 | +# For more info: | 
|  | 20 | +# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification | 
|  | 21 | + | 
|  | 22 | +name=Adafruit SAMD (32-bits ARM Cortex-M0+ and Cortex-M4) Boards | 
|  | 23 | +version=1.5.14 | 
|  | 24 | + | 
|  | 25 | +# Compile variables | 
|  | 26 | +# ----------------- | 
|  | 27 | + | 
|  | 28 | +compiler.warning_flags=-w | 
|  | 29 | +compiler.warning_flags.none=-w | 
|  | 30 | +compiler.warning_flags.default= | 
|  | 31 | +compiler.warning_flags.more=-Wall -Wno-expansion-to-defined | 
|  | 32 | +compiler.warning_flags.all=-Wall -Wextra -Wno-expansion-to-defined | 
|  | 33 | + | 
|  | 34 | +compiler.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/ | 
|  | 35 | +compiler.c.cmd=arm-none-eabi-gcc | 
|  | 36 | +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD -D__SKETCH_NAME__="""{build.project_name}""" | 
|  | 37 | +compiler.c.elf.cmd=arm-none-eabi-g++ | 
|  | 38 | +compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps | 
|  | 39 | +compiler.S.cmd=arm-none-eabi-gcc | 
|  | 40 | +compiler.S.flags=-c -g -x assembler-with-cpp -MMD | 
|  | 41 | +compiler.cpp.cmd=arm-none-eabi-g++ | 
|  | 42 | +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -D__SKETCH_NAME__="""{build.project_name}""" | 
|  | 43 | +compiler.ar.cmd=arm-none-eabi-ar | 
|  | 44 | +compiler.ar.flags=rcs | 
|  | 45 | +compiler.objcopy.cmd=arm-none-eabi-objcopy | 
|  | 46 | +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 | 
|  | 47 | +compiler.elf2hex.bin.flags=-O binary | 
|  | 48 | +compiler.elf2hex.hex.flags=-O ihex -R .eeprom | 
|  | 49 | +compiler.elf2hex.cmd=arm-none-eabi-objcopy | 
|  | 50 | +compiler.ldflags=-mcpu={build.mcu} -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align | 
|  | 51 | +compiler.size.cmd=arm-none-eabi-size | 
|  | 52 | +compiler.define=-DARDUINO= | 
|  | 53 | +compiler.readelf.cmd=arm-none-eabi-readelf | 
|  | 54 | + | 
|  | 55 | +# this can be overriden in boards.txt | 
|  | 56 | +build.extra_flags= | 
|  | 57 | +build.cache_flags= | 
|  | 58 | +build.flags.optimize= | 
|  | 59 | +build.flags.maxspi= | 
|  | 60 | +build.flags.maxqspi= | 
|  | 61 | +build.flags.usbstack= | 
|  | 62 | +build.flags.debug= | 
|  | 63 | + | 
|  | 64 | +# These can be overridden in platform.local.txt | 
|  | 65 | +compiler.c.extra_flags= | 
|  | 66 | +compiler.c.elf.extra_flags= | 
|  | 67 | +#compiler.c.elf.extra_flags=-v | 
|  | 68 | +compiler.cpp.extra_flags= | 
|  | 69 | +compiler.S.extra_flags= | 
|  | 70 | +compiler.ar.extra_flags= | 
|  | 71 | +compiler.elf2hex.extra_flags= | 
|  | 72 | + | 
|  | 73 | +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.2.0.path}/CMSIS/Device/ATMEL/" | 
|  | 74 | +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math | 
|  | 75 | + | 
|  | 76 | +compiler.libraries.ldflags= | 
|  | 77 | + | 
|  | 78 | +# USB Flags | 
|  | 79 | +# --------- | 
|  | 80 | +build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON -DUSB_CONFIG_POWER={build.usb_power} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {build.flags.usbstack} {build.flags.debug} "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" | 
|  | 81 | + | 
|  | 82 | +# Default advertised device power setting in mA | 
|  | 83 | +build.usb_power=100 | 
|  | 84 | + | 
|  | 85 | +# Default usb manufacturer will be replaced at compile time using | 
|  | 86 | +# numeric vendor ID if available or by board's specific value. | 
|  | 87 | +build.usb_manufacturer="Unknown" | 
|  | 88 | + | 
|  | 89 | + | 
|  | 90 | +# Compile patterns | 
|  | 91 | +# ---------------- | 
|  | 92 | + | 
|  | 93 | +## Compile c files | 
|  | 94 | +## KH Add -DBOARD_NAME="{build.board}" | 
|  | 95 | +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.cache_flags}  {build.flags.debug} {build.flags.optimize} {build.flags.maxspi} {build.flags.maxqspi} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" | 
|  | 96 | + | 
|  | 97 | +##recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.cache_flags}  {build.flags.debug} {build.flags.optimize} {build.flags.maxspi} {build.flags.maxqspi} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" | 
|  | 98 | + | 
|  | 99 | +## Compile c++ files | 
|  | 100 | +## KH Add -DBOARD_NAME="{build.board}" | 
|  | 101 | +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.cache_flags} {build.flags.debug} {build.flags.optimize} {build.flags.maxspi} {build.flags.maxqspi} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" | 
|  | 102 | + | 
|  | 103 | +##recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.cache_flags} {build.flags.debug} {build.flags.optimize} {build.flags.maxspi} {build.flags.maxqspi} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" | 
|  | 104 | + | 
|  | 105 | +## Compile S files | 
|  | 106 | +## KH Add -DBOARD_NAME="{build.board}" | 
|  | 107 | +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.cache_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" | 
|  | 108 | + | 
|  | 109 | +##recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.cache_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" | 
|  | 110 | + | 
|  | 111 | +## Create archives | 
|  | 112 | +# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value | 
|  | 113 | +archive_file_path={build.path}/{archive_file} | 
|  | 114 | +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" | 
|  | 115 | + | 
|  | 116 | +## Combine gc-sections, archives, and objects | 
|  | 117 | +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}"  "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} -Wl,--start-group {compiler.arm.cmsis.ldflags} "-L{build.variant.path}" -lm "{build.path}/{archive_file}" -Wl,--end-group | 
|  | 118 | + | 
|  | 119 | +## Create output (bin file) | 
|  | 120 | +recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.bin.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" | 
|  | 121 | + | 
|  | 122 | +## Create output (hex file) | 
|  | 123 | +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" | 
|  | 124 | + | 
|  | 125 | +build.preferred_out_format=bin | 
|  | 126 | + | 
|  | 127 | +## Save hex | 
|  | 128 | +recipe.output.tmp_file={build.project_name}.{build.preferred_out_format} | 
|  | 129 | +recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format} | 
|  | 130 | + | 
|  | 131 | +## Compute size | 
|  | 132 | +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" | 
|  | 133 | +recipe.size.regex=\.text\s+([0-9]+).* | 
|  | 134 | + | 
|  | 135 | +# | 
|  | 136 | +# BOSSA | 
|  | 137 | +# | 
|  | 138 | +tools.bossac.path={runtime.tools.bossac-1.7.0-arduino3.path} | 
|  | 139 | +tools.bossac.cmd=bossac | 
|  | 140 | +tools.bossac.cmd.windows=bossac.exe | 
|  | 141 | + | 
|  | 142 | +tools.bossac.upload.params.verbose=-i -d | 
|  | 143 | +tools.bossac.upload.params.quiet= | 
|  | 144 | +tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R | 
|  | 145 | + | 
|  | 146 | +tools.bossac_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R | 
|  | 147 | + | 
|  | 148 | +tools.bossac.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA | 
|  | 149 | +tools.bossac.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b | 
|  | 150 | + | 
|  | 151 | +# v1.8.0 | 
|  | 152 | + | 
|  | 153 | +tools.bossac18.path={runtime.tools.bossac-1.8.0-48-gb176eee.path} | 
|  | 154 | +tools.bossac18.cmd=bossac | 
|  | 155 | + | 
|  | 156 | +tools.bossac18.upload.params.verbose=-i -d | 
|  | 157 | +tools.bossac18.upload.params.quiet= | 
|  | 158 | +tools.bossac18.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U -i --offset={upload.offset} -w -v "{build.path}/{build.project_name}.bin" -R | 
|  | 159 | + | 
|  | 160 | +tools.bossac18.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA | 
|  | 161 | +tools.bossac18.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b | 
|  | 162 | + | 
|  | 163 | +# | 
|  | 164 | +# BOSSA (ignore binary size) | 
|  | 165 | +# | 
|  | 166 | +tools.bossacI.path={runtime.tools.bossac-1.7.0-arduino3.path} | 
|  | 167 | +tools.bossacI.cmd=bossac | 
|  | 168 | +tools.bossacI.cmd.windows=bossac.exe | 
|  | 169 | + | 
|  | 170 | +tools.bossacI.upload.params.verbose=-i -d | 
|  | 171 | +tools.bossacI.upload.params.quiet= | 
|  | 172 | +tools.bossacI.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -I -U {upload.native_usb} -i -e -w "{build.path}/{build.project_name}.bin" -R | 
|  | 173 | + | 
|  | 174 | +tools.bossacI_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R | 
|  | 175 | + | 
|  | 176 | +tools.bossacI.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA | 
|  | 177 | +tools.bossacI.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b | 
|  | 178 | + | 
|  | 179 | + | 
|  | 180 | +# | 
|  | 181 | +# OpenOCD sketch upload | 
|  | 182 | +# | 
|  | 183 | + | 
|  | 184 | +tools.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path} | 
|  | 185 | +tools.openocd.cmd=bin/openocd | 
|  | 186 | +tools.openocd.cmd.windows=bin/openocd.exe | 
|  | 187 | + | 
|  | 188 | +tools.openocd.upload.params.verbose=-d2 | 
|  | 189 | +tools.openocd.upload.params.quiet=-d0 | 
|  | 190 | +tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.bin} verify reset 0x2000; shutdown" | 
|  | 191 | + | 
|  | 192 | +tools.openocd.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA | 
|  | 193 | +tools.openocd.upload.network_pattern={network_cmd} -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b | 
|  | 194 | + | 
|  | 195 | +# Program flashes the binary at 0x0000, so use the linker script without_bootloader | 
|  | 196 | +tools.openocd.program.params.verbose=-d2 | 
|  | 197 | +tools.openocd.program.params.quiet=-d0 | 
|  | 198 | +tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.elf} verify reset; shutdown" | 
|  | 199 | + | 
|  | 200 | +tools.openocd.erase.params.verbose=-d3 | 
|  | 201 | +tools.openocd.erase.params.quiet=-d0 | 
|  | 202 | +tools.openocd.erase.pattern= | 
|  | 203 | + | 
|  | 204 | +tools.openocd.bootloader.params.verbose=-d2 | 
|  | 205 | +tools.openocd.bootloader.params.quiet=-d0 | 
|  | 206 | +tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown" | 
|  | 207 | + | 
|  | 208 | +# | 
|  | 209 | +# OpenOCD sketch upload - version with configurable bootloader size | 
|  | 210 | +# FIXME: this programmer is a workaround for default options being overwritten by uploadUsingPreferences | 
|  | 211 | +# | 
|  | 212 | + | 
|  | 213 | +tools.openocd-withbootsize.path={runtime.tools.openocd-0.10.0-arduino7.path} | 
|  | 214 | +tools.openocd-withbootsize.cmd=bin/openocd | 
|  | 215 | +tools.openocd-withbootsize.cmd.windows=bin/openocd.exe | 
|  | 216 | + | 
|  | 217 | +tools.openocd-withbootsize.upload.params.verbose=-d2 | 
|  | 218 | +tools.openocd-withbootsize.upload.params.quiet=-d0 | 
|  | 219 | +tools.openocd-withbootsize.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.bin} verify reset {bootloader.size}; shutdown" | 
|  | 220 | + | 
|  | 221 | +# Program flashes the binary at 0x0000, so use the linker script without_bootloader | 
|  | 222 | +tools.openocd-withbootsize.program.params.verbose=-d2 | 
|  | 223 | +tools.openocd-withbootsize.program.params.quiet=-d0 | 
|  | 224 | +tools.openocd-withbootsize.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.elf} verify reset; shutdown" | 
|  | 225 | + | 
|  | 226 | +tools.openocd-withbootsize.erase.params.verbose=-d3 | 
|  | 227 | +tools.openocd-withbootsize.erase.params.quiet=-d0 | 
|  | 228 | +tools.openocd-withbootsize.erase.pattern= | 
|  | 229 | + | 
|  | 230 | +tools.openocd-withbootsize.bootloader.params.verbose=-d2 | 
|  | 231 | +tools.openocd-withbootsize.bootloader.params.quiet=-d0 | 
|  | 232 | +tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown" | 
0 commit comments