Skip to content

Commit f4b503e

Browse files
authored
Merge pull request #270 from adafruit/feather-833
Add Feather nRF52833
2 parents 597dc6f + 90c856e commit f4b503e

File tree

14 files changed

+260
-259
lines changed

14 files changed

+260
-259
lines changed

.github/workflows/githubci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- 'circuitplayground_nrf52840'
2020
- 'clue_nrf52840'
2121
- 'feather_nrf52832'
22+
- 'feather_nrf52833_express'
2223
- 'feather_nrf52840_express'
2324
- 'feather_nrf52840_sense'
2425
- 'itsybitsy_nrf52840_express'

Makefile

Lines changed: 61 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# - SD_HEX : to bootloader hex binary
88
#------------------------------------------------------------------------------
99

10+
# local customization
1011
-include Makefile.user
1112

1213
SDK_PATH = lib/sdk/components
@@ -15,8 +16,9 @@ TUSB_PATH = lib/tinyusb/src
1516
NRFX_PATH = lib/nrfx
1617
SD_PATH = lib/softdevice/$(SD_FILENAME)
1718

19+
# SD_VERSION can be overwritten by board.mk
1820
ifndef SD_VERSION
19-
SD_VERSION = 6.1.1
21+
SD_VERSION = 6.1.1
2022
endif
2123

2224
SD_FILENAME = $(SD_NAME)_nrf52_$(SD_VERSION)
@@ -37,7 +39,7 @@ OUT_NAME = $(BOARD)_bootloader-$(GIT_VERSION)
3739
MERGED_FILE = $(OUT_NAME)_$(SD_NAME)_$(SD_VERSION)
3840

3941
#------------------------------------------------------------------------------
40-
# Tool configure
42+
# Tool Configure
4143
#------------------------------------------------------------------------------
4244

4345
# Toolchain commands
@@ -208,39 +210,46 @@ ASM_SRC = $(NRFX_PATH)/mdk/gcc_startup_$(MCU_SUB_VARIANT).S
208210
#------------------------------------------------------------------------------
209211

210212
# src
211-
IPATH += src
212-
IPATH += src/boards
213-
IPATH += src/boards/$(BOARD)
214-
IPATH += src/cmsis/include
215-
IPATH += src/usb
216-
IPATH += $(TUSB_PATH)
213+
IPATH += \
214+
src \
215+
src/boards \
216+
src/boards/$(BOARD) \
217+
src/cmsis/include \
218+
src/usb \
219+
$(TUSB_PATH)
217220

218221
# nrfx
219-
IPATH += $(NRFX_PATH)
220-
IPATH += $(NRFX_PATH)/mdk
221-
IPATH += $(NRFX_PATH)/hal
222-
IPATH += $(NRFX_PATH)/drivers/include
223-
IPATH += $(NRFX_PATH)/drivers/src
224-
225-
IPATH += $(SDK11_PATH)/libraries/bootloader_dfu/hci_transport
226-
IPATH += $(SDK11_PATH)/libraries/bootloader_dfu
227-
IPATH += $(SDK11_PATH)/drivers_nrf/pstorage
228-
IPATH += $(SDK11_PATH)/ble/common
229-
IPATH += $(SDK11_PATH)/ble/ble_services/ble_dfu
230-
IPATH += $(SDK11_PATH)/ble/ble_services/ble_dis
231-
232-
IPATH += $(SDK_PATH)/libraries/timer
233-
IPATH += $(SDK_PATH)/libraries/scheduler
234-
IPATH += $(SDK_PATH)/libraries/crc16
235-
IPATH += $(SDK_PATH)/libraries/util
236-
IPATH += $(SDK_PATH)/libraries/hci/config
237-
IPATH += $(SDK_PATH)/libraries/uart
238-
IPATH += $(SDK_PATH)/libraries/hci
239-
IPATH += $(SDK_PATH)/drivers_nrf/delay
240-
241-
# Softdevice
242-
IPATH += $(SD_PATH)/$(SD_FILENAME)_API/include
243-
IPATH += $(SD_PATH)/$(SD_FILENAME)_API/include/nrf52
222+
IPATH += \
223+
$(NRFX_PATH) \
224+
$(NRFX_PATH)/mdk \
225+
$(NRFX_PATH)/hal \
226+
$(NRFX_PATH)/drivers/include \
227+
$(NRFX_PATH)/drivers/src
228+
229+
# sdk11 for cdc/ble dfu
230+
IPATH += \
231+
$(SDK11_PATH)/libraries/bootloader_dfu/hci_transport \
232+
$(SDK11_PATH)/libraries/bootloader_dfu \
233+
$(SDK11_PATH)/drivers_nrf/pstorage \
234+
$(SDK11_PATH)/ble/common \
235+
$(SDK11_PATH)/ble/ble_services/ble_dfu \
236+
$(SDK11_PATH)/ble/ble_services/ble_dis
237+
238+
# later sdk with updated drivers
239+
IPATH += \
240+
$(SDK_PATH)/libraries/timer \
241+
$(SDK_PATH)/libraries/scheduler \
242+
$(SDK_PATH)/libraries/crc16 \
243+
$(SDK_PATH)/libraries/util \
244+
$(SDK_PATH)/libraries/hci/config \
245+
$(SDK_PATH)/libraries/uart \
246+
$(SDK_PATH)/libraries/hci \
247+
$(SDK_PATH)/drivers_nrf/delay
248+
249+
# SoftDevice
250+
IPATH += \
251+
$(SD_PATH)/$(SD_FILENAME)_API/include \
252+
$(SD_PATH)/$(SD_FILENAME)_API/include/nrf52
244253

245254
#------------------------------------------------------------------------------
246255
# Compiler Flags
@@ -253,6 +262,7 @@ CFLAGS += \
253262
-mcpu=cortex-m4 \
254263
-mfloat-abi=hard \
255264
-mfpu=fpv4-sp-d16 \
265+
-ggdb \
256266
-Os \
257267
-ffunction-sections \
258268
-fdata-sections \
@@ -272,15 +282,11 @@ CFLAGS += \
272282
-Wsign-compare \
273283
-Wmissing-format-attribute \
274284
-Wno-endif-labels \
275-
-Wunreachable-code \
276-
-ggdb
285+
-Wunreachable-code
277286

278287
# Suppress warning caused by SDK
279288
CFLAGS += -Wno-unused-parameter -Wno-expansion-to-defined
280289

281-
# TinyUSB tusb_hal_nrf_power_event
282-
CFLAGS += -Wno-cast-function-type
283-
284290
# Nordic Softdevice SDK header files contains inline assembler that has
285291
# broken constraints. As a result the IPA-modref pass, introduced in gcc-11,
286292
# is able to "prove" that arguments to wrapper functions generated with
@@ -332,6 +338,7 @@ LIBS += -lm -lc
332338
#------------------------------------------------------------------------------
333339
# Assembler flags
334340
#------------------------------------------------------------------------------
341+
335342
ASFLAGS += $(CFLAGS)
336343

337344
#function for removing duplicates in a list
@@ -356,7 +363,7 @@ INC_PATHS = $(addprefix -I,$(IPATH))
356363
# BUILD TARGETS
357364
#------------------------------------------------------------------------------
358365

359-
.PHONY: all clean flash dfu-flash sd gdbflash gdb
366+
.PHONY: all clean flash flash-dfu flash-sd flash-mbr dfu-flash sd mbr gdbflash gdb
360367

361368
# default target to build
362369
all: $(BUILD)/$(OUT_NAME).out $(BUILD)/$(OUT_NAME)_nosd.hex $(BUILD)/update-$(OUT_NAME)_nosd.uf2 $(BUILD)/$(MERGED_FILE).hex $(BUILD)/$(MERGED_FILE).zip
@@ -431,7 +438,9 @@ copy-artifact: $(BIN)
431438
@$(CP) $(BUILD)/$(MERGED_FILE).hex $(BIN)
432439
@$(CP) $(BUILD)/$(MERGED_FILE).zip $(BIN)
433440

434-
#------------------- Flash target -------------------
441+
#--------------------------------------
442+
# Flash Target
443+
#--------------------------------------
435444

436445
check_defined = \
437446
$(strip $(foreach 1,$1, \
@@ -440,29 +449,31 @@ __check_defined = \
440449
$(if $(value $1),, \
441450
$(error Undefined make flag: $1$(if $2, ($2))))
442451

452+
# erase chip
453+
erase:
454+
@echo Erasing flash
455+
$(call FLASH_ERASE_CMD)
456+
443457
# Flash the compiled
444458
flash: $(BUILD)/$(OUT_NAME)_nosd.hex
445459
@echo Flashing: $(notdir $<)
446460
$(call FLASH_CMD,$<)
447461

448-
erase:
449-
@echo Erasing flash
450-
$(call FLASH_ERASE_CMD)
451-
452462
# flash SD only
453-
sd:
463+
sd: flash-sd
464+
flash-sd:
454465
@echo Flashing: $(SD_HEX)
455466
$(call FLASH_NOUICR_CMD,$(SD_HEX))
456467

457468
# flash MBR only
458-
mbr:
469+
mbr: flash-mbr
470+
flash-mbr:
459471
@echo Flashing: $(MBR_HEX)
460472
$(call FLASH_NOUICR_CMD,$(MBR_HEX))
461473

462-
#------------------- Flash with NRFUTIL via DFU -------------------
463-
464-
# dfu using CDC interface
465-
dfu-flash: $(BUILD)/$(MERGED_FILE).zip
474+
# dfu with adafruit-nrfutil using CDC interface
475+
dfu-flash: flash-dfu
476+
flash-dfu: $(BUILD)/$(MERGED_FILE).zip
466477
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0)
467478
$(NRFUTIL) --verbose dfu serial --package $< -p $(SERIAL) -b 115200 --singlebank --touch 1200
468479

README.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -121,57 +121,62 @@ both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to a
121121
You should only continue if you are looking to develop bootloader for your own.
122122
You must have have a J-Link available to "unbrick" your device.
123123
124-
Prerequisites
124+
### Prerequisites
125125
126126
- ARM GCC
127-
128-
To install for macos
129-
130-
```bash
131-
brew tap ArmMbed/homebrew-formulae
132-
brew install arm-none-eabi-gcc
133-
brew link --overwrite arm-none-eabi-gcc # if a prior version was present
134-
```
135-
136127
- Nordic's [nRF5x Command Line Tools](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools)
137128
- [Python IntelHex](https://pypi.org/project/IntelHex/)
138129
139-
To build:
130+
### Build:
140131
141132
```
142133
make BOARD=feather_nrf52840_express all
143134
```
144135
145-
To flash the bootloader with JLink:
136+
For the list of supported boards, run `make` without `BOARD=` :
137+
138+
```
139+
$ make
140+
You must provide a BOARD parameter with 'BOARD='
141+
Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
142+
Makefile:90: *** BOARD not defined. Stop
143+
```
144+
145+
### Flash
146+
147+
To flash the bootloader (without softdevice/mbr) using JLink:
146148
147149
```
148150
make BOARD=feather_nrf52840_express flash
149151
```
150152
153+
If you are using pyocd as debugger, add `FLASHER=pyocd` to make command:
154+
155+
```
156+
make BOARD=feather_nrf52840_express FLASHER=pyocd flash
157+
```
158+
151159
To upgrade the bootloader using DFU Serial via port /dev/ttyACM0
152160
153161
```
154-
make BOARD=feather_nrf52840_express SERIAL=/dev/ttyACM0 dfu-flash
162+
make BOARD=feather_nrf52840_express SERIAL=/dev/ttyACM0 flash-dfu
155163
```
156164
157-
To flash SoftDevice (and chip erase):
165+
To flash SoftDevice (will also erase chip):
158166
159167
```
160-
make BOARD=feather_nrf52840_express sd
168+
make BOARD=feather_nrf52840_express flash-sd
161169
```
162170
163-
For the list of supported boards, run `make` without `BOARD=` :
171+
To flash MBR only
164172
165173
```
166-
$ make
167-
You must provide a BOARD parameter with 'BOARD='
168-
Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
169-
Makefile:90: *** BOARD not defined. Stop
174+
make BOARD=feather_nrf52840_express flash-mbr
170175
```
171176
172177
### Common makefile problems
173178
174-
#### 1. `arm-none-eabi-gcc`: No such file or directory
179+
#### `arm-none-eabi-gcc`: No such file or directory
175180
176181
If you get the following error ...
177182
@@ -190,16 +195,15 @@ $ make CROSS_COMPILE=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi- B
190195
191196
For other compile errors, check the gcc version with `arm-none-eabi-gcc --version` to insure it is at least 9.x.
192197
193-
#### 2. `ModuleNotFoundError: No module named 'intelhex'`
198+
#### `ModuleNotFoundError: No module named 'intelhex'`
194199
195200
Install python-intelhex with
196201
197202
```
198203
pip install intelhex
199204
```
200205
201-
202-
#### 3. `make: nrfjprog: No such file or directory`
206+
#### `make: nrfjprog: No such file or directory`
203207
204208
Make sure that `nrfjprog` is available from the command-line. This binary is
205209
part of Nordic's nRF5x Command Line Tools.

linker/nrf52833.ld

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ MEMORY
1111
* those values do not match. The check is performed in main.c, see
1212
* APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START);
1313
*/
14-
FLASH (rx) : ORIGIN = 0x74000, LENGTH = 0x7E000-0x74000 /* 40 KB */
14+
FLASH (rx) : ORIGIN = 0x74000, LENGTH = 0x7E000-0x74000-2K /* 38 KB */
15+
16+
BOOTLOADER_CONFIG (r): ORIGIN = 0x7E000 - 2K, LENGTH = 2K
1517

1618
/** Location of mbr params page in flash. */
1719
MBR_PARAMS_PAGE (rw) : ORIGIN = 0x0007E000, LENGTH = 0x1000
@@ -50,6 +52,11 @@ SECTIONS
5052
PROVIDE( __stop_fs_data = .);
5153
} = 0
5254

55+
.bootloaderConfig :
56+
{
57+
KEEP(*(.bootloaderConfig))
58+
} > BOOTLOADER_CONFIG
59+
5360
/* Place the bootloader settings page in flash. */
5461
.bootloaderSettings(NOLOAD) :
5562
{

0 commit comments

Comments
 (0)