Skip to content

Commit 67fbbae

Browse files
jacobwfabiobaltieri
authored andcommitted
boards: adafruit feather nrf52840 update UF2
Add support for flashing the Adafruit Feather nrf52840 Express using UF2 over USB. Also standardise on using the UF2 variant, so add a non UF2 variant of the Sense board, so it can be flashed using the SWD headers. Created flash dtsi files for both SWD and UF2. These are actually identical for many other boards and should probably be moved to common in future. Signed-off-by: Jacob Winther <[email protected]>
1 parent dcb05ce commit 67fbbae

17 files changed

+324
-104
lines changed

boards/adafruit/feather_nrf52840/adafruit_feather_nrf52840.dts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
/dts-v1/;
9-
109
#include "adafruit_feather_nrf52840_common.dtsi"
10+
#include "adafruit_feather_nrf52840_flash.dtsi"
1111

1212
/ {
1313
model = "Adafruit Feather nRF52840 Express";
@@ -19,7 +19,6 @@
1919
zephyr,uart-mcumgr = &uart0;
2020
zephyr,bt-mon-uart = &uart0;
2121
zephyr,bt-c2h-uart = &uart0;
22-
zephyr,code-partition = &slot0_partition;
2322
};
2423

2524
leds {
@@ -28,39 +27,3 @@
2827
};
2928
};
3029
};
31-
32-
&flash0 {
33-
partitions {
34-
compatible = "fixed-partitions";
35-
#address-cells = <1>;
36-
#size-cells = <1>;
37-
38-
boot_partition: partition@0 {
39-
label = "mcuboot";
40-
reg = <0x00000000 0x0000C000>;
41-
};
42-
slot0_partition: partition@c000 {
43-
label = "image-0";
44-
reg = <0x0000C000 0x00067000>;
45-
};
46-
slot1_partition: partition@73000 {
47-
label = "image-1";
48-
reg = <0x00073000 0x00067000>;
49-
};
50-
scratch_partition: partition@da000 {
51-
label = "image-scratch";
52-
reg = <0x000da000 0x0001e000>;
53-
};
54-
55-
/*
56-
* The flash starting at 0x000f8000 and ending at
57-
* 0x000fffff is reserved for use by the application.
58-
*/
59-
60-
/* Storage partition will be used by FCB/NFFS/NVS if enabled. */
61-
storage_partition: partition@f8000 {
62-
label = "storage";
63-
reg = <0x000f8000 0x00008000>;
64-
};
65-
};
66-
};

boards/adafruit/feather_nrf52840/adafruit_feather_nrf52840_common.dtsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
chosen {
1717
zephyr,sram = &sram0;
18-
zephyr,flash = &flash0;
1918
zephyr,ieee802154 = &ieee802154;
2019
};
2120

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2024 Jacob Winther
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,flash = &flash0;
10+
zephyr,code-partition = &slot0_partition;
11+
};
12+
};
13+
14+
&flash0 {
15+
partitions {
16+
compatible = "fixed-partitions";
17+
#address-cells = <1>;
18+
#size-cells = <1>;
19+
20+
boot_partition: partition@0 {
21+
label = "mcuboot";
22+
reg = <0x00000000 0x0000C000>;
23+
};
24+
slot0_partition: partition@c000 {
25+
label = "image-0";
26+
reg = <0x0000C000 0x00077000>;
27+
};
28+
slot1_partition: partition@83000 {
29+
label = "image-1";
30+
reg = <0x00083000 0x00075000>;
31+
};
32+
33+
/*
34+
* The flash starting at 0x000f8000 and ending at
35+
* 0x000fffff is reserved for use by the application.
36+
*/
37+
38+
/*
39+
* Storage partition will be used by FCB/LittleFS/NVS
40+
* if enabled.
41+
*/
42+
storage_partition: partition@f8000 {
43+
label = "storage";
44+
reg = <0x000f8000 0x00008000>;
45+
};
46+
};
47+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2024 Jacob Winther
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Default flash layout for nrf52840 using UF2
7+
*/
8+
9+
/ {
10+
chosen {
11+
zephyr,flash = &flash0;
12+
zephyr,code-partition = &code_partition;
13+
};
14+
};
15+
16+
&flash0 {
17+
partitions {
18+
compatible = "fixed-partitions";
19+
#address-cells = <1>;
20+
#size-cells = <1>;
21+
22+
/* To enable flashing with UF2 bootloader, we
23+
* must reserve a partition for SoftDevice.
24+
* See https://learn.adafruit.com/
25+
* introducing-the-adafruit-nrf52840-feather?view=all#hathach-memory-map
26+
*/
27+
reserved_partition_0: partition@0 {
28+
label = "SoftDevice";
29+
read-only;
30+
reg = <0x000000000 DT_SIZE_K(152)>;
31+
};
32+
code_partition: partition@26000 {
33+
label = "Application";
34+
reg = <0x00026000 DT_SIZE_K(796)>;
35+
};
36+
37+
/*
38+
* The flash starting at 0x000ed000 and ending at
39+
* 0x000f4000 is reserved for use by the application.
40+
*/
41+
storage_partition: partition@ed000 {
42+
label = "storage";
43+
reg = <0x0000ed000 DT_SIZE_K(28)>;
44+
};
45+
46+
boot_partition: partition@f4000 {
47+
label = "UF2";
48+
read-only;
49+
reg = <0x000f4000 DT_SIZE_K(48)>;
50+
};
51+
};
52+
};
Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
/*
2-
* Copyright (c) 2020 Tobias Svehagen
32
* Copyright (c) 2024 Jacob Winther
43
*
54
* SPDX-License-Identifier: Apache-2.0
65
*/
76

87
/dts-v1/;
98
#include "adafruit_feather_nrf52840_common.dtsi"
9+
#include "adafruit_feather_nrf52840_flash.dtsi"
1010

1111
/ {
1212
model = "Adafruit Feather nRF52840 Sense";
13-
compatible = "adafruit,feather-nrf52840-sense";
13+
compatible = "adafruit,feather-nrf52840-sense-uf2";
1414

1515
chosen {
16-
zephyr,console = &cdc_acm_uart0;
17-
zephyr,shell-uart = &cdc_acm_uart0;
18-
zephyr,uart-mcumgr = &cdc_acm_uart0;
19-
zephyr,bt-mon-uart = &cdc_acm_uart0;
20-
zephyr,bt-c2h-uart = &cdc_acm_uart0;
21-
zephyr,code-partition = &code_partition;
16+
zephyr,console = &uart0;
17+
zephyr,shell-uart = &uart0;
18+
zephyr,uart-mcumgr = &uart0;
19+
zephyr,bt-mon-uart = &uart0;
20+
zephyr,bt-c2h-uart = &uart0;
2221
};
2322

2423
leds {
@@ -34,47 +33,3 @@
3433
reg = <0x44>;
3534
};
3635
};
37-
38-
&flash0 {
39-
partitions {
40-
compatible = "fixed-partitions";
41-
#address-cells = <1>;
42-
#size-cells = <1>;
43-
44-
/* To enable flashing with UF2 bootloader, we
45-
* must reserve a partition for SoftDevice.
46-
* See https://learn.adafruit.com/
47-
* introducing-the-adafruit-nrf52840-feather?view=all#hathach-memory-map
48-
*/
49-
reserved_partition_0: partition@0 {
50-
label = "SoftDevice";
51-
read-only;
52-
reg = <0x000000000 DT_SIZE_K(152)>;
53-
};
54-
code_partition: partition@26000 {
55-
label = "Application";
56-
reg = <0x00026000 DT_SIZE_K(796)>;
57-
};
58-
59-
/*
60-
* The flash starting at 0x000ed000 and ending at
61-
* 0x000f4000 is reserved for use by the application.
62-
*/
63-
storage_partition: partition@ed000 {
64-
label = "storage";
65-
reg = <0x0000ed000 DT_SIZE_K(28)>;
66-
};
67-
68-
boot_partition: partition@f4000 {
69-
label = "UF2";
70-
read-only;
71-
reg = <0x000f4000 DT_SIZE_K(48)>;
72-
};
73-
};
74-
};
75-
76-
zephyr_udc0: &usbd {
77-
cdc_acm_uart0: cdc_acm_uart0 {
78-
compatible = "zephyr,cdc-acm-uart";
79-
};
80-
};

boards/adafruit/feather_nrf52840/adafruit_feather_nrf52840_nrf52840_sense_defconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,3 @@ CONFIG_UART_CONSOLE=y
1616
# 32kHz clock source
1717
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
1818
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
19-
20-
# Logger cannot use itself to log
21-
CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y
22-
23-
# Enable USB
24-
CONFIG_USB_DEVICE_STACK=y
25-
26-
# Build UF2 by default, supported by the Adafruit nRF52 Bootloader
27-
CONFIG_BUILD_OUTPUT_UF2=y
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2020 Tobias Svehagen
3+
* Copyright (c) 2024 Jacob Winther
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/dts-v1/;
9+
#include "adafruit_feather_nrf52840_common.dtsi"
10+
#include "adafruit_feather_nrf52840_flash_uf2.dtsi"
11+
12+
/ {
13+
model = "Adafruit Feather nRF52840 Sense";
14+
compatible = "adafruit,feather-nrf52840-sense-uf2";
15+
16+
chosen {
17+
zephyr,console = &cdc_acm_uart0;
18+
zephyr,shell-uart = &cdc_acm_uart0;
19+
zephyr,uart-mcumgr = &cdc_acm_uart0;
20+
zephyr,bt-mon-uart = &cdc_acm_uart0;
21+
zephyr,bt-c2h-uart = &cdc_acm_uart0;
22+
};
23+
24+
leds {
25+
led0: led_0 {
26+
gpios = <&gpio1 9 0>;
27+
};
28+
};
29+
};
30+
31+
&i2c0 {
32+
SHT3XD: sht3xd@44 {
33+
compatible = "sensirion,sht3xd";
34+
reg = <0x44>;
35+
};
36+
};
37+
38+
zephyr_udc0: &usbd {
39+
cdc_acm_uart0: cdc_acm_uart0 {
40+
compatible = "zephyr,cdc-acm-uart";
41+
};
42+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
identifier: adafruit_feather_nrf52840/nrf52840/sense/uf2
2+
name: Adafruit Feather nRF52840 Sense UF2
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
supported:
10+
- adc
11+
- usb_device
12+
- usb_cdc
13+
- ble
14+
- watchdog
15+
- counter
16+
- feather_serial
17+
- feather_i2c
18+
- feather_spi
19+
vendor: adafruit
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
# Enable MPU
4+
CONFIG_ARM_MPU=y
5+
6+
# Enable GPIO
7+
CONFIG_GPIO=y
8+
9+
# Enable UART driver
10+
CONFIG_SERIAL=y
11+
12+
# Enable console
13+
CONFIG_CONSOLE=y
14+
CONFIG_UART_CONSOLE=y
15+
16+
# 32kHz clock source
17+
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
18+
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
19+
20+
# Logger cannot use itself to log
21+
CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y
22+
23+
# Enable USB
24+
CONFIG_USB_DEVICE_STACK=y
25+
26+
# Build UF2 by default, supported by the Adafruit nRF52 Bootloader
27+
CONFIG_BUILD_OUTPUT_UF2=y
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2024 Jacob Winther
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include "adafruit_feather_nrf52840_common.dtsi"
9+
#include "adafruit_feather_nrf52840_flash_uf2.dtsi"
10+
11+
/ {
12+
model = "Adafruit Feather nRF52840 Express";
13+
compatible = "adafruit,feather-nrf52840-uf2";
14+
15+
chosen {
16+
zephyr,console = &cdc_acm_uart0;
17+
zephyr,shell-uart = &cdc_acm_uart0;
18+
zephyr,uart-mcumgr = &cdc_acm_uart0;
19+
zephyr,bt-mon-uart = &cdc_acm_uart0;
20+
zephyr,bt-c2h-uart = &cdc_acm_uart0;
21+
};
22+
23+
leds {
24+
led0: led_0 {
25+
gpios = <&gpio1 15 0>;
26+
};
27+
};
28+
};
29+
30+
zephyr_udc0: &usbd {
31+
cdc_acm_uart0: cdc_acm_uart0 {
32+
compatible = "zephyr,cdc-acm-uart";
33+
};
34+
};

0 commit comments

Comments
 (0)