Skip to content

Commit 7043e6f

Browse files
authored
Merge pull request #10923 from tannewt/zephyr_feather_sense
Add Zephyr build for the Feather nrf52840 Sense
2 parents 1eb34d0 + 1427256 commit 7043e6f

File tree

9 files changed

+198
-11
lines changed

9 files changed

+198
-11
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info.
2+
name = "Adafruit Industries LLC Feather Bluefruit Sense"
3+
4+
[modules]
5+
__future__ = true
6+
_bleio = false
7+
_eve = false
8+
_pew = false
9+
_pixelmap = false
10+
_stage = false
11+
adafruit_bus_device = false
12+
adafruit_pixelbuf = false
13+
aesio = false
14+
alarm = false
15+
analogbufio = false
16+
analogio = false
17+
atexit = false
18+
audiobusio = false
19+
audiocore = false
20+
audiodelays = false
21+
audiofilters = false
22+
audiofreeverb = false
23+
audioio = false
24+
audiomixer = false
25+
audiomp3 = false
26+
audiopwmio = false
27+
audiospeed = false
28+
aurora_epaper = false
29+
bitbangio = false
30+
bitmapfilter = true # Zephyr board has busio
31+
bitmaptools = true # Zephyr board has busio
32+
bitops = false
33+
board = false
34+
busdisplay = true # Zephyr board has busio
35+
busio = true # Zephyr board has busio
36+
camera = false
37+
canio = false
38+
codeop = false
39+
countio = false
40+
digitalio = true
41+
displayio = true # Zephyr board has busio
42+
dotclockframebuffer = false
43+
dualbank = false
44+
epaperdisplay = true # Zephyr board has busio
45+
floppyio = false
46+
fontio = true # Zephyr board has busio
47+
fourwire = true # Zephyr board has busio
48+
framebufferio = true # Zephyr board has busio
49+
frequencyio = false
50+
getpass = false
51+
gifio = false
52+
gnss = false
53+
hashlib = false
54+
hostnetwork = false
55+
i2cdisplaybus = true # Zephyr board has busio
56+
i2cioexpander = false
57+
i2ctarget = false
58+
imagecapture = false
59+
ipaddress = false
60+
is31fl3741 = false
61+
jpegio = false
62+
keypad = false
63+
keypad_demux = false
64+
locale = false
65+
lvfontio = true # Zephyr board has busio
66+
math = false
67+
max3421e = false
68+
mcp4822 = false
69+
mdns = false
70+
memorymap = false
71+
memorymonitor = false
72+
microcontroller = true
73+
mipidsi = false
74+
msgpack = false
75+
neopixel_write = false
76+
nvm = true # Zephyr board has nvm
77+
onewireio = false
78+
os = true
79+
paralleldisplaybus = false
80+
ps2io = false
81+
pulseio = false
82+
pwmio = false
83+
qrio = false
84+
qspibus = false
85+
rainbowio = true
86+
random = true
87+
rclcpy = false
88+
rgbmatrix = false
89+
rotaryio = true # Zephyr board has rotaryio
90+
rtc = false
91+
sdcardio = true # Zephyr board has busio
92+
sdioio = false
93+
sharpdisplay = true # Zephyr board has busio
94+
socketpool = false
95+
spitarget = false
96+
ssl = false
97+
storage = true # Zephyr board has flash
98+
struct = true
99+
supervisor = true
100+
synthio = false
101+
terminalio = true # Zephyr board has busio
102+
tilepalettemapper = true # Zephyr board has busio
103+
time = true
104+
touchio = false
105+
traceback = true
106+
uheap = false
107+
usb = false
108+
usb_cdc = true
109+
usb_hid = false
110+
usb_host = false
111+
usb_midi = false
112+
usb_video = false
113+
ustack = false
114+
vectorio = true # Zephyr board has busio
115+
warnings = true
116+
watchdog = false
117+
wifi = false
118+
zephyr_display = false
119+
zephyr_kernel = false
120+
zlib = false
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CIRCUITPY_BUILD_EXTENSIONS = ["elf", "uf2"]
2+
USB_VID=0x239A
3+
USB_PID=0x8088
4+
NAME="Feather Bluefruit Sense"

ports/zephyr-cp/boards/adafruit/feather_nrf52840_zephyr/autogen_board_info.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info.
2-
name = "Adafruit Industries LLC Feather nRF52840 (Express, Sense)"
2+
name = "Adafruit Industries LLC Feather nRF52840 Express"
33

44
[modules]
55
__future__ = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
CIRCUITPY_BUILD_EXTENSIONS = ["elf", "uf2"]
22
USB_VID=0x239A
33
USB_PID=0x802A
4+
NAME="Feather nRF52840 Express"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CONFIG_BT=y
2+
CONFIG_BT_PERIPHERAL=y
3+
CONFIG_BT_CENTRAL=y
4+
CONFIG_BT_BROADCASTER=y
5+
CONFIG_BT_OBSERVER=y
6+
CONFIG_BT_EXT_ADV=y
7+
8+
CONFIG_USE_DT_CODE_PARTITION=y
9+
10+
CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/ {
2+
chosen {
3+
zephyr,console = &uart0;
4+
zephyr,shell-uart = &uart0;
5+
zephyr,uart-mcumgr = &uart0;
6+
zephyr,bt-mon-uart = &uart0;
7+
zephyr,bt-c2h-uart = &uart0;
8+
};
9+
};
10+
11+
&zephyr_udc0 {
12+
/delete-node/ board_cdc_acm_uart;
13+
};
14+
15+
16+
&gd25q16 {
17+
/delete-node/ partitions;
18+
};
19+
20+
/delete-node/ &storage_partition;
21+
/delete-node/ &code_partition;
22+
23+
&flash0 {
24+
partitions {
25+
code_partition: partition@26000 {
26+
label = "Application";
27+
reg = <0x00026000 0x000c4000>;
28+
};
29+
30+
storage_partition: partition@ea000 {
31+
label = "storage";
32+
reg = <0x000ea000 0x00008000>;
33+
};
34+
35+
nvm_partition: partition@f2000 {
36+
label = "nvm";
37+
reg = <0x000f2000 0x00002000>;
38+
};
39+
};
40+
};
41+
42+
&uart0 {
43+
status = "okay";
44+
};
45+
46+
#include "../app.overlay"

ports/zephyr-cp/boards/board_aliases.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ endmacro()
2828

2929
cp_board_alias(pca10056 nrf52840dk/nrf52840)
3030
cp_board_alias(adafruit_feather_nrf52840_zephyr adafruit_feather_nrf52840/nrf52840/uf2)
31+
cp_board_alias(adafruit_feather_nrf52840_sense_zephyr adafruit_feather_nrf52840/nrf52840/sense/uf2)
3132
cp_board_alias(adafruit_feather_rp2040_zephyr adafruit_feather_rp2040/rp2040)
3233
cp_board_alias(renesas_ek_ra6m5 ek_ra6m5)
3334
cp_board_alias(renesas_ek_ra8d1 ek_ra8d1)

ports/zephyr-cp/cptools/build_circuitpython.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ async def build_circuitpython():
364364
genhdr = builddir / "genhdr"
365365
genhdr.mkdir(exist_ok=True, parents=True)
366366
version_header = genhdr / "mpversion.h"
367+
mpconfigboard_fn = board_tools.find_mpconfigboard(portdir, board)
368+
mpconfigboard = {"USB_VID": 0x1209, "USB_PID": 0x000C, "USB_INTERFACE_NAME": "CircuitPython"}
369+
if mpconfigboard_fn is not None and mpconfigboard_fn.exists():
370+
with mpconfigboard_fn.open("rb") as f:
371+
mpconfigboard.update(tomllib.load(f))
367372
async with asyncio.TaskGroup() as tg:
368373
tg.create_task(
369374
cpbuild.run_command(
@@ -381,21 +386,16 @@ async def build_circuitpython():
381386
)
382387

383388
board_autogen_task = tg.create_task(
384-
zephyr_dts_to_cp_board(zephyr_board, portdir, builddir, zephyrbuilddir)
389+
zephyr_dts_to_cp_board(zephyr_board, portdir, builddir, zephyrbuilddir, mpconfigboard)
385390
)
386391
board_info = board_autogen_task.result()
387-
mpconfigboard_fn = board_tools.find_mpconfigboard(portdir, board)
388-
mpconfigboard = {"USB_VID": 0x1209, "USB_PID": 0x000C, "USB_INTERFACE_NAME": "CircuitPython"}
389392
if mpconfigboard_fn is None:
390393
mpconfigboard_fn = (
391394
portdir / "boards" / board_info["vendor_id"] / board / "circuitpython.toml"
392395
)
393396
logging.warning(
394397
f"Could not find board config at: boards/{board_info['vendor_id']}/{board}"
395398
)
396-
elif mpconfigboard_fn.exists():
397-
with mpconfigboard_fn.open("rb") as f:
398-
mpconfigboard.update(tomllib.load(f))
399399

400400
autogen_board_info_fn = mpconfigboard_fn.parent / "autogen_board_info.toml"
401401

@@ -404,6 +404,9 @@ async def build_circuitpython():
404404
circuitpython_flags.append(f"-DCIRCUITPY_CREATOR_ID=0x{creator_id:08x}")
405405
circuitpython_flags.append(f"-DCIRCUITPY_CREATION_ID=0x{creation_id:08x}")
406406

407+
vendor = mpconfigboard.get("VENDOR", board_info["vendor"])
408+
name = mpconfigboard.get("NAME", board_info["name"])
409+
407410
enabled_modules, module_reasons = determine_enabled_modules(board_info, portdir, srcdir)
408411
for m in mpconfigboard.get("DISABLED_MODULES", []):
409412
enabled_modules.discard(m)
@@ -463,8 +466,8 @@ async def build_circuitpython():
463466
f"-DUSB_INTERFACE_NAME='\"{mpconfigboard['USB_INTERFACE_NAME']}\"'"
464467
)
465468
for macro, limit, value in (
466-
("USB_PRODUCT", 16, board_info["name"]),
467-
("USB_MANUFACTURER", 8, board_info["vendor"]),
469+
("USB_PRODUCT", 16, name),
470+
("USB_MANUFACTURER", 8, vendor),
468471
):
469472
circuitpython_flags.append(f"-D{macro}='\"{value}\"'")
470473
circuitpython_flags.append(f"-D{macro}_{limit}='\"{value[:limit]}\"'")
@@ -516,7 +519,7 @@ async def build_circuitpython():
516519
"This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info."
517520
)
518521
)
519-
autogen_board_info.add("name", board_info["vendor"] + " " + board_info["name"])
522+
autogen_board_info.add("name", vendor + " " + name)
520523
autogen_modules = tomlkit.table()
521524
autogen_board_info.add("modules", autogen_modules)
522525
for module in sorted(

ports/zephyr-cp/cptools/zephyr2cp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def find_ram_regions(device_tree):
433433

434434

435435
@cpbuild.run_in_thread
436-
def zephyr_dts_to_cp_board(board_id, portdir, builddir, zephyrbuilddir): # noqa: C901
436+
def zephyr_dts_to_cp_board(board_id, portdir, builddir, zephyrbuilddir, mpconfigboard=None): # noqa: C901
437437
board_dir = builddir / "board"
438438
# Auto generate board files from device tree.
439439

@@ -486,6 +486,8 @@ def zephyr_dts_to_cp_board(board_id, portdir, builddir, zephyrbuilddir): # noqa
486486
soc_name = board_yaml["socs"][0]["name"]
487487
board_info["soc"] = soc_name
488488
board_name = board_yaml["full_name"]
489+
if mpconfigboard and "NAME" in mpconfigboard:
490+
board_name = mpconfigboard["NAME"]
489491
board_info["name"] = board_name
490492
# board_id_yaml = zephyr_board_dir / (zephyr_board_dir.name + ".yaml")
491493
# board_id_yaml = yaml.safe_load(board_id_yaml.read_text())

0 commit comments

Comments
 (0)