xref: /ArduinoCore-samd/platform.txt (revision 429bee85)
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
22name=Arduino SAMD (32-bits ARM Cortex-M0+) Boards
23version=1.8.6
24
25# Compile variables
26# -----------------
27
28compiler.warning_flags=-w
29compiler.warning_flags.none=-w
30compiler.warning_flags.default=
31compiler.warning_flags.more=-Wall -Wno-expansion-to-defined
32compiler.warning_flags.all=-Wall -Wextra -Wno-expansion-to-defined
33
34# EXPERIMENTAL feature: optimization flags
35#  - this is alpha and may be subject to change without notice
36compiler.optimization_flags=-Os
37compiler.optimization_flags.release=-Os
38compiler.optimization_flags.debug=-Og -g3
39
40compiler.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
41compiler.c.cmd=arm-none-eabi-gcc
42compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.optimization_flags} {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
43compiler.c.elf.cmd=arm-none-eabi-g++
44compiler.c.elf.flags={compiler.optimization_flags} -Wl,--gc-sections -save-temps
45compiler.S.cmd=arm-none-eabi-gcc
46compiler.S.flags=-c -g -x assembler-with-cpp -MMD
47compiler.cpp.cmd=arm-none-eabi-g++
48compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.optimization_flags} {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
49compiler.ar.cmd=arm-none-eabi-ar
50compiler.ar.flags=rcs
51compiler.objcopy.cmd=arm-none-eabi-objcopy
52compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
53compiler.elf2hex.bin.flags=-O binary
54compiler.elf2hex.hex.flags=-O ihex -R .eeprom
55compiler.elf2hex.cmd=arm-none-eabi-objcopy
56compiler.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
57compiler.size.cmd=arm-none-eabi-size
58compiler.define=-DARDUINO=
59compiler.readelf.cmd=arm-none-eabi-readelf
60
61# this can be overriden in boards.txt
62build.extra_flags=
63
64# These can be overridden in platform.local.txt
65compiler.c.extra_flags=
66compiler.c.elf.extra_flags=
67#compiler.c.elf.extra_flags=-v
68compiler.cpp.extra_flags=
69compiler.S.extra_flags=
70compiler.ar.extra_flags=
71compiler.elf2hex.extra_flags=
72
73compiler.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/"
74compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math
75
76compiler.libraries.ldflags=
77
78# USB Flags
79# ---------
80build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
81
82# Default usb manufacturer will be replaced at compile time using
83# numeric vendor ID if available or by board's specific value.
84build.usb_manufacturer="Unknown"
85
86# Compile patterns
87# ----------------
88
89## Compile c files
90recipe.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} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
91
92## Compile c++ files
93recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
94
95## Compile S files
96recipe.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} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
97
98## Create archives
99# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value
100archive_file_path={build.path}/{archive_file}
101recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
102
103## Combine gc-sections, archives, and objects
104recipe.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} -lm "{build.path}/{archive_file}" -Wl,--end-group
105
106## Create output (bin file)
107recipe.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"
108
109## Create output (hex file)
110recipe.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"
111
112build.preferred_out_format=bin
113
114## Save hex
115recipe.output.tmp_file={build.project_name}.{build.preferred_out_format}
116recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format}
117
118## Compute size
119recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
120recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).*
121recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).*
122
123# Upload/Debug tools
124# ------------------
125
126#
127# AVRDUDE
128#
129tools.avrdude.path={runtime.tools.avrdude.path}
130tools.avrdude.cmd={path}/bin/avrdude
131tools.avrdude.config.path={path}/etc/avrdude.conf
132
133tools.avrdude.upload.params.verbose=-v -v
134tools.avrdude.upload.params.quiet=-q -q
135tools.avrdude.upload.params.noverify=-V
136tools.avrdude.upload.pattern="{cmd}" "-C{config.path}" {upload.verbose} -p{build.emu.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
137
138tools.avrdude_remote.upload.pattern="openocd --version 2>&1 | grep 2016 && if opkg update; then opkg upgrade openocd; exit 1; else echo 'Please connect your board to the Internet in order to upgrade tools' >&2; exit 1; fi || /usr/bin/run-avrdude /tmp/sketch.hex"
139
140tools.avrdude.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
141tools.avrdude.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
142
143#
144# BOSSA
145#
146tools.bossac.path={runtime.tools.bossac-1.7.0-arduino3.path}
147tools.bossac.cmd=bossac
148tools.bossac.cmd.windows=bossac.exe
149
150tools.bossac.upload.params.verbose=-i -d
151tools.bossac.upload.params.quiet=
152tools.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
153
154tools.bossac_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R
155
156tools.bossac.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
157tools.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
158
159#
160# BOSSA (ignore binary size)
161#
162tools.bossacI.path={runtime.tools.bossac-1.7.0-arduino3.path}
163tools.bossacI.cmd=bossac
164tools.bossacI.cmd.windows=bossac.exe
165
166tools.bossacI.upload.params.verbose=-i -d
167tools.bossacI.upload.params.quiet=
168tools.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
169
170tools.bossacI_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R
171
172tools.bossacI.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
173tools.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
174
175
176#
177# OpenOCD sketch upload
178#
179
180tools.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}
181tools.openocd.cmd=bin/openocd
182tools.openocd.cmd.windows=bin/openocd.exe
183
184tools.openocd.upload.params.verbose=-d2
185tools.openocd.upload.params.quiet=-d0
186tools.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"
187
188tools.openocd.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
189tools.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
190
191# Program flashes the binary at 0x0000, so use the linker script without_bootloader
192tools.openocd.program.params.verbose=-d2
193tools.openocd.program.params.quiet=-d0
194tools.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"
195
196tools.openocd.erase.params.verbose=-d3
197tools.openocd.erase.params.quiet=-d0
198tools.openocd.erase.pattern=
199
200tools.openocd.bootloader.params.verbose=-d2
201tools.openocd.bootloader.params.quiet=-d0
202tools.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"
203
204#
205# OpenOCD sketch upload - version with configurable bootloader size
206# FIXME: this programmer is a workaround for default options being overwritten by uploadUsingPreferences
207#
208
209tools.openocd-withbootsize.path={runtime.tools.openocd-0.10.0-arduino7.path}
210tools.openocd-withbootsize.cmd=bin/openocd
211tools.openocd-withbootsize.cmd.windows=bin/openocd.exe
212
213tools.openocd-withbootsize.upload.params.verbose=-d2
214tools.openocd-withbootsize.upload.params.quiet=-d0
215tools.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"
216
217# Program flashes the binary at 0x0000, so use the linker script without_bootloader
218tools.openocd-withbootsize.program.params.verbose=-d2
219tools.openocd-withbootsize.program.params.quiet=-d0
220tools.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"
221
222tools.openocd-withbootsize.erase.params.verbose=-d3
223tools.openocd-withbootsize.erase.params.quiet=-d0
224tools.openocd-withbootsize.erase.pattern=
225
226tools.openocd-withbootsize.bootloader.params.verbose=-d2
227tools.openocd-withbootsize.bootloader.params.quiet=-d0
228tools.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"
229
230#
231# GDB (Debugger)
232#
233# EXPERIMENTAL feature: debug.pattern
234#  - this is alpha and may be subject to change without notice
235
236tools.gdb.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
237tools.gdb.cmd=arm-none-eabi-gdb
238tools.gdb.cmd.windows=arm-none-eabi-gdb.exe
239tools.gdb.debug.pattern="{path}/{cmd}" --interpreter=mi2 -ex "set remotetimeout 5" -ex "set pagination off" -ex 'target extended-remote | "{tools.openocd.path}/{tools.openocd.cmd}" -s "{tools.openocd.path}/share/openocd/scripts/" --file "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "gdb_port pipe" -c "telnet_port 0"' "{build.path}/{build.project_name}.elf"