Skip to content

Commit 7f3fa8e

Browse files
author
rsora
committed
Extract getRecipe in upload command and start adding (broken) tests
1 parent e932bdc commit 7f3fa8e

File tree

8 files changed

+1132
-24
lines changed

8 files changed

+1132
-24
lines changed

Diff for: commands/upload/testdata/custom_hardware/ada-test/samd/boards.txt

+534
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name=Adafruit nRF52 Boards
2+
version=0.19.0
3+
4+
# Compile variables
5+
# -----------------
6+
7+
compiler.warning_flags=-w
8+
compiler.warning_flags.none=-w
9+
compiler.warning_flags.default=
10+
compiler.warning_flags.more=-Wall
11+
compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith
12+
13+
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
14+
compiler.c.cmd=arm-none-eabi-gcc
15+
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
16+
compiler.c.elf.cmd=arm-none-eabi-gcc
17+
compiler.c.elf.flags=-Ofast -Wl,--gc-sections -save-temps
18+
compiler.S.cmd=arm-none-eabi-gcc
19+
compiler.S.flags=-c -g -x assembler-with-cpp
20+
compiler.cpp.cmd=arm-none-eabi-g++
21+
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD
22+
compiler.ar.cmd=arm-none-eabi-ar
23+
compiler.ar.flags=rcs
24+
compiler.objcopy.cmd=arm-none-eabi-objcopy
25+
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
26+
compiler.elf2bin.flags=-O binary
27+
compiler.elf2bin.cmd=arm-none-eabi-objcopy
28+
compiler.elf2hex.flags=-O ihex
29+
compiler.elf2hex.cmd=arm-none-eabi-objcopy
30+
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align --specs=nano.specs --specs=nosys.specs
31+
compiler.size.cmd=arm-none-eabi-size
32+
33+
# this can be overriden in boards.txt
34+
build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float
35+
build.debug_flags=-DCFG_DEBUG=0
36+
build.logger_flags=-DCFG_LOGGER=1
37+
build.sysview_flags=-DCFG_SYSVIEW=0
38+
39+
# common compiler for nrf
40+
rtos.path={build.core.path}/freertos
41+
nordic.path={build.core.path}/nordic
42+
43+
# build.logger_flags and build.sysview_flags and intentionally empty,
44+
# to allow modification via a user's own boards.local.txt or platform.local.txt files.
45+
build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DLFS_NAME_MAX=64 -Ofast {build.debug_flags} {build.logger_flags} {build.sysview_flags} "-I{build.core.path}/cmsis/include" "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src"
46+
47+
# usb flags
48+
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
49+
50+
# These can be overridden in platform.local.txt
51+
compiler.c.extra_flags=
52+
compiler.c.elf.extra_flags=
53+
compiler.cpp.extra_flags=
54+
compiler.S.extra_flags=
55+
compiler.ar.extra_flags=
56+
compiler.elf2bin.extra_flags=
57+
compiler.elf2hex.extra_flags=
58+
59+
60+
# Compile patterns
61+
# ----------------
62+
63+
## Compile c files
64+
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} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}"
65+
66+
## Compile c++ files
67+
recipe.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} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}"
68+
69+
## Compile S files
70+
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.flags.nrf} {includes} "{source_file}" -o "{object_file}"
71+
72+
## Create archives
73+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
74+
75+
## Combine gc-sections, archives, and objects
76+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group
77+
78+
## Create output (bin file)
79+
#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
80+
81+
## Create output (hex file)
82+
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
83+
84+
## Create dfu package zip file
85+
recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
86+
87+
## Create uf2 file
88+
#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex"
89+
90+
## Save bin
91+
recipe.output.tmp_file_bin={build.project_name}.bin
92+
recipe.output.save_file_bin={build.project_name}.save.bin
93+
94+
## Save hex
95+
recipe.output.tmp_file_hex={build.project_name}.hex
96+
recipe.output.save_file_hexu={build.project_name}.save.hex
97+
98+
## Compute size
99+
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
100+
recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).*
101+
recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).*
102+
103+
## Export Compiled Binary
104+
recipe.output.tmp_file={build.project_name}.hex
105+
recipe.output.save_file={build.project_name}.{build.variant}.hex
106+
107+
#***************************************************
108+
# adafruit-nrfutil for uploading
109+
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
110+
# pre-built binaries are provided for macos and windows
111+
#***************************************************
112+
tools.nrfutil.cmd=adafruit-nrfutil
113+
tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe
114+
tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil
115+
116+
tools.nrfutil.upload.params.verbose=--verbose
117+
tools.nrfutil.upload.params.quiet=
118+
tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank
119+
120+
#***************************************************
121+
# Burning bootloader with either jlink or nrfutil
122+
#***************************************************
123+
124+
# Bootloader version
125+
tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.3.2_{build.sd_name}_{build.sd_version}
126+
127+
tools.bootburn.bootloader.params.verbose=
128+
tools.bootburn.bootloader.params.quiet=
129+
tools.bootburn.bootloader.pattern={program.burn_pattern}
130+
131+
# erase flash page while programming
132+
tools.bootburn.erase.params.verbose=
133+
tools.bootburn.erase.params.quiet=
134+
tools.bootburn.erase.pattern=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Copyright (c) 2014-2017 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 Zero (Prorgamming Port)
18+
# ---------------------------------------
19+
arduino_zero_edbg.name=Arduino Zero (Programming Port)
20+
arduino_zero_edbg.vid.0=0x03eb
21+
arduino_zero_edbg.pid.0=0x2157
22+
23+
arduino_zero_edbg.debug.tool=gdb-openocd
24+
arduino_zero_edbg.upload.tool=openocd
25+
arduino_zero_edbg.upload.protocol=sam-ba
26+
arduino_zero_edbg.upload.maximum_size=262144
27+
arduino_zero_edbg.upload.use_1200bps_touch=false
28+
arduino_zero_edbg.upload.wait_for_upload_port=false
29+
arduino_zero_edbg.upload.native_usb=false
30+
arduino_zero_edbg.build.mcu=cortex-m0plus
31+
arduino_zero_edbg.build.f_cpu=48000000L
32+
arduino_zero_edbg.build.usb_product="Arduino Zero"
33+
arduino_zero_edbg.build.usb_manufacturer="Arduino LLC"
34+
arduino_zero_edbg.build.board=SAMD_ZERO
35+
arduino_zero_edbg.build.core=arduino
36+
arduino_zero_edbg.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags}
37+
arduino_zero_edbg.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
38+
arduino_zero_edbg.build.openocdscript=openocd_scripts/arduino_zero.cfg
39+
arduino_zero_edbg.build.variant=arduino_zero
40+
arduino_zero_edbg.build.variant_system_lib=
41+
arduino_zero_edbg.build.vid=0x2341
42+
arduino_zero_edbg.build.pid=0x804d
43+
arduino_zero_edbg.bootloader.tool=openocd
44+
arduino_zero_edbg.bootloader.file=zero/samd21_sam_ba.bin
45+
46+
# Arduino MKR1000
47+
# -----------------------
48+
mkr1000.name=Arduino MKR1000
49+
mkr1000.vid.0=0x2341
50+
mkr1000.pid.0=0x804e
51+
mkr1000.vid.1=0x2341
52+
mkr1000.pid.1=0x004e
53+
mkr1000.vid.2=0x2341
54+
mkr1000.pid.2=0x824e
55+
mkr1000.vid.3=0x2341
56+
mkr1000.pid.3=0x024e
57+
58+
mkr1000.debug.tool=gdb-openocd
59+
mkr1000.upload.tool=bossac
60+
mkr1000.upload.protocol=sam-ba
61+
mkr1000.upload.maximum_size=262144
62+
mkr1000.upload.use_1200bps_touch=true
63+
mkr1000.upload.wait_for_upload_port=true
64+
mkr1000.upload.native_usb=true
65+
mkr1000.build.mcu=cortex-m0plus
66+
mkr1000.build.f_cpu=48000000L
67+
mkr1000.build.usb_product="Arduino MKR1000"
68+
mkr1000.build.usb_manufacturer="Arduino LLC"
69+
mkr1000.build.board=SAMD_MKR1000
70+
mkr1000.build.core=arduino
71+
mkr1000.build.extra_flags=-DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ {build.usb_flags}
72+
mkr1000.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
73+
mkr1000.build.openocdscript=openocd_scripts/arduino_zero.cfg
74+
mkr1000.build.variant=mkr1000
75+
mkr1000.build.vid=0x2341
76+
mkr1000.build.pid=0x804e
77+
mkr1000.bootloader.tool=openocd
78+
mkr1000.bootloader.file=mkr1000/samd21_sam_ba_arduino_mkr1000.bin
79+
80+
# Arduino Tian (with) Bootloader
81+
# ------------------------------
82+
tian.name=Arduino Tian
83+
tian.upload.via_ssh=true
84+
tian.vid.0=0x10C4
85+
tian.pid.0=0xEA70
86+
tian.descriptor.0=Enhanced Com Port
87+
88+
tian.upload.tool=avrdude
89+
#tian.upload.protocol=stk500v2
90+
tian.upload.protocol=wiring
91+
tian.upload.maximum_size=262144
92+
tian.upload.use_1200bps_touch=true
93+
tian.upload.wait_for_upload_port=true
94+
tian.upload.native_usb=true
95+
tian.upload.speed=57600
96+
tian.build.mcu=cortex-m0plus
97+
tian.build.f_cpu=48000000L
98+
tian.build.usb_product="Arduino Tian"
99+
tian.build.board=SAMD_TIAN
100+
tian.build.core=arduino
101+
tian.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
102+
tian.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
103+
tian.build.openocdscript=openocd_scripts/arduino_zero.cfg
104+
tian.build.variant=arduino_mzero
105+
tian.build.variant_system_lib=
106+
tian.build.vid=0x2a03
107+
tian.build.pid=0x8052
108+
tian.build.preferred_out_format=hex
109+
tian.bootloader.size=0x4000
110+
tian.build.emu.mcu=atmega2560
111+
tian.bootloader.tool=openocd-withbootsize
112+
tian.bootloader.low_fuses=0xff
113+
tian.bootloader.file=sofia/Sofia_Tian_151118.hex
114+
tian.drivers=SiliconLabs-CP2105/Silicon Labs VCP Driver.pkg

0 commit comments

Comments
 (0)