Skip to content

Commit fdf731f

Browse files
committed
Add support for Adafruit boards/bootloader.
Former-commit-id: fb4739c
1 parent 2dd6946 commit fdf731f

File tree

27 files changed

+16782
-14
lines changed

27 files changed

+16782
-14
lines changed

boards.txt

Lines changed: 405 additions & 3 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* Linker script to configure memory regions. */
2+
3+
SEARCH_DIR(.)
4+
GROUP(-lgcc -lc -lnosys)
5+
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x00001000, LENGTH = 0x73000
9+
RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 0x1FFF8
10+
}
11+
12+
13+
INCLUDE "nrf_common.ld"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* Linker script to configure memory regions. */
2+
3+
SEARCH_DIR(.)
4+
GROUP(-lgcc -lc -lnosys)
5+
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x1000, LENGTH = 0xf3000
9+
RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 0x3FFF8
10+
}
11+
12+
13+
INCLUDE "nrf_common.ld"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* Linker script to configure memory regions. */
2+
3+
SEARCH_DIR(.)
4+
GROUP(-lgcc -lc -lnosys)
5+
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x00001000, LENGTH = 0x73000
9+
RAM (rwx) : ORIGIN = 0x20000008, LENGTH = 0xFFF8
10+
}
11+
12+
13+
INCLUDE "nrf_common.ld"

cores/nRF5/nordic/nrf_nvm_store.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
#include "nrf.h"
55
#include "nrfx_nvmc.h"
66

7-
#ifdef USE_TINYUSB
8-
#define BOOTLOADER_PAGE_SIZE 32
7+
#if defined(USE_ADA_BL)
8+
# define BOOTLOADER_PAGE_SIZE 12
9+
#elif defined(USE_NORDIC_BL)
10+
# define BOOTLOADER_PAGE_SIZE 32
911
#else
10-
#define BOOTLOADER_PAGE_SIZE 0
12+
# define BOOTLOADER_PAGE_SIZE 0
1113
#endif
1214

1315
#define FLASH_WAIT_READY while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

platform.txt

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ compiler.define=-DARDUINO=
5151

5252
# this can be overriden in boards.txt
5353
build.extra_flags=
54-
build.dfu_pattern=echo
55-
54+
build.dfu_pattern=echo Not building DFU package
55+
build.bootloader.file=variants/Generic/none_bootloader.hex
5656
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
57+
5758
nrfutil.dfu_pattern="{tools.nrfutil.cmd}" pkg generate --hw-version 52 --debug-mode --sd-req 0 --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
59+
adafruit-nrfutil.dfu_pattern="{tools.adafruit-nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
60+
5861
nordic.path={build.core.path}/nordic
5962

6063
compiler.nrf.flags=-DNRF5 -DARDUINO_ARCH_NRF5 "-I{build.core.path}/nimble_config" "-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{build.core.path}/CMSIS/Include" "-I{build.core.path}/FC_Store" "-I{build.core.path}/BLEBond_nvs" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src"
@@ -145,7 +148,7 @@ tools.openocd.erase.pattern=
145148

146149
tools.openocd.bootloader.params.verbose=-d2
147150
tools.openocd.bootloader.params.quiet=-d0
148-
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -f interface/{program.protocol}.cfg -c "{program.setup_command}" -f target/{upload.target}.cfg -c "init; halt; nrf5 mass_erase; shutdown;"
151+
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -f interface/{program.protocol}.cfg -c "{program.setup_command}" -f target/{upload.target}.cfg -c "init; halt; nrf51 mass_erase; program {runtime.platform.path}/{build.bootloader.file} verify reset; shutdown;"
149152

150153
#
151154
# blackmagic probe upload
@@ -172,19 +175,33 @@ tools.blackmagicprobe.program.pattern.windows="{path}{cmd}" -quiet -cd "{build.p
172175

173176
tools.blackmagicprobe.bootloader.params.verbose=
174177
tools.blackmagicprobe.bootloader.params.quiet=-q --batch-silent
175-
tools.blackmagicprobe.bootloader.pattern="{path}{cmd}" -quiet -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex "detach" -ex "quit"
176-
tools.blackmagicprobe.bootloader.pattern.windows="{path}{cmd}" -quiet -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex "detach" -ex "quit"
178+
tools.blackmagicprobe.bootloader.pattern="{path}{cmd}" -quiet -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex "load {runtime.platform.path}/{build.bootloader.file}" -ex "echo \nBootloader flash complete!\n" -ex "detach" -ex "quit"
179+
tools.blackmagicprobe.bootloader.pattern.windows="{path}{cmd}" -quiet -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex load {runtime.platform.path}\{build.bootloader.file} -ex "echo \nBootloader flash complete!\n" -ex "detach" -ex "quit"
177180

178181
#
179182
# nrfutil upload
180183
#
181-
tools.nrfutil.cmd={runtime.tools.nrfutil-6.1.4.path}/nrfutil
182-
tools.nrfutil.cmd.windows={runtime.tools.nrfutil-6.1.4.path}/nrfutil.exe
184+
tools.nrfutil.cmd=nrfutil
183185

184186
tools.nrfutil.upload.params.verbose=
185187
tools.nrfutil.upload.params.quiet=
186188
tools.nrfutil.upload.pattern="{cmd}" dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200
187189

188190
tools.nrfutil.program.params.verbose=
189191
tools.nrfutil.program.params.quiet=
190-
tools.nrfutil.program.pattern="{cmd}" dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200
192+
tools.nrfutil.program.pattern="{cmd}" dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200
193+
194+
#***************************************************
195+
# adafruit-nrfutil for uploading
196+
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
197+
# pre-built binaries are provided for macos and windows
198+
#***************************************************
199+
tools.adafruit-nrfutil.cmd=adafruit-nrfutil
200+
201+
tools.adafruit-nrfutil.upload.params.verbose=--verbose
202+
tools.adafruit-nrfutil.upload.params.quiet=
203+
tools.adafruit-nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank
204+
205+
tools.adafruit-nrfutil.program.params.verbose=--verbose
206+
tools.adafruit-nrfutil.program.params.quiet=
207+
tools.adafruit-nrfutil.program.pattern="{cmd}" {program.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank

programmers.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ blackmagicprobe.program.tool=blackmagicprobe
3030
blackmagicprobe.bootloader.tool=blackmagicprobe
3131
blackmagicprobe.program.extra_params=;
3232

33+
adafruit-nrfutil.name=adafruit-nrfutil
34+
adafruit-nrfutil.communication=USB
35+
adafruit-nrfutil.protocol=
36+
adafruit-nrfutil.program.protocol=
37+
adafruit-nrfutil.program.tool=adafruit-nrfutil
38+
adafruit-nrfutil.program.extra_params=;
39+
3340
nrfutil.name=nrfutil
3441
nrfutil.communication=USB
3542
nrfutil.protocol=

0 commit comments

Comments
 (0)