Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,10 @@ jobs:
uses: ./.github/actions/deps/external
- name: Build native sim target
run: make -C ports/zephyr-cp -j2 BOARD=native_native_sim
- name: Build bsim
run: make -j 2 everything
working-directory: ports/zephyr-cp/tools/bsim
- name: Build native_nrf5340bsim
run: make -C ports/zephyr-cp -j2 BOARD=native_nrf5340bsim
- name: Run Zephyr tests
run: make -C ports/zephyr-cp test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ TAGS

# windsurf rules
.windsurfrules

# git-review-web outputs
.review
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Capture CircuitPython output by finding the matching device in `/dev/serial/by-id`
- You can mount the CIRCUITPY drive by doing `udisksctl mount -b /dev/disk/by-label/CIRCUITPY` and access it via `/run/media/<user>/CIRCUITPY`.
- `circup` is a command line tool to install libraries and examples to CIRCUITPY.
7 changes: 6 additions & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ def autoapi_prepare_jinja_env(jinja_env):
# Port READMEs in various formats
"ports/*/README*",
]
exclude_patterns = ["docs/autoapi/templates/**", "docs/README.md"]
exclude_patterns = [
"docs/autoapi/templates/**",
"docs/README.md",
"AGENTS.md",
"**/AGENTS.md",
]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down
6 changes: 6 additions & 0 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,10 @@ msgstr ""
msgid "Invalid ROS domain ID"
msgstr ""

#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
msgid "Invalid advertising data"
msgstr ""

#: ports/espressif/common-hal/espidf/__init__.c py/moderrno.c
msgid "Invalid argument"
msgstr ""
Expand Down Expand Up @@ -3801,6 +3805,7 @@ msgid "non-hex digit"
msgstr ""

#: ports/nordic/common-hal/_bleio/Adapter.c
#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
msgid "non-zero timeout must be > 0.01"
msgstr ""

Expand Down Expand Up @@ -4284,6 +4289,7 @@ msgid "timeout duration exceeded the maximum supported value"
msgstr ""

#: ports/nordic/common-hal/_bleio/Adapter.c
#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
msgid "timeout must be < 655.35 secs"
msgstr ""

Expand Down
5 changes: 5 additions & 0 deletions ports/zephyr-cp/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Build a board by doing `make BOARD=<vendor>_<board_name>`.
- The corresponding configuration files are in `boards/<vendor>/<board_name>`
- The files (not folders) in `boards/` directory are used by Zephyr.
- To flash it on a board do `make BOARD=<vendor>_<board_name> flash`.
- Zephyr board docs are at `zephyr/boards/<vendor>/<board_name>`.
1 change: 1 addition & 0 deletions ports/zephyr-cp/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config NET_CORE_BOARD
default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk"
default "nrf7002dk/nrf5340/cpunet" if $(BOARD) = "nrf7002dk"
default "nrf5340_audio_dk/nrf5340/cpunet" if $(BOARD) = "nrf5340_audio_dk"
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim"

config NET_CORE_IMAGE_HCI_IPC
bool "HCI IPC image on network core"
Expand Down
6 changes: 5 additions & 1 deletion ports/zephyr-cp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ BUILD ?= build-$(BOARD)

TRANSLATION ?= en_US

.PHONY: $(BUILD)/zephyr-cp/zephyr/zephyr.elf flash debug run clean menuconfig all clean-all test fetch-port-submodules

.PHONY: $(BUILD)/zephyr-cp/zephyr/zephyr.elf flash recover debug run clean menuconfig all clean-all test fetch-port-submodules

$(BUILD)/zephyr-cp/zephyr/zephyr.elf:
python cptools/pre_zephyr_build_prep.py $(BOARD)
Expand All @@ -26,6 +27,9 @@ $(BUILD)/firmware.exe: $(BUILD)/zephyr-cp/zephyr/zephyr.elf
flash: $(BUILD)/zephyr-cp/zephyr/zephyr.elf
west flash -d $(BUILD)

recover: $(BUILD)/zephyr-cp/zephyr/zephyr.elf
west flash --recover -d $(BUILD)

debug: $(BUILD)/zephyr-cp/zephyr/zephyr.elf
west debug -d $(BUILD)

Expand Down
4 changes: 4 additions & 0 deletions ports/zephyr-cp/boards/board_aliases.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
set(pca10056_BOARD_ALIAS nrf52840dk/nrf52840)
set(renesas_ek_ra6m5_BOARD_ALIAS ek_ra6m5)
set(renesas_ek_ra8d1_BOARD_ALIAS ek_ra8d1)
set(renesas_da14695_dk_usb_BOARD_ALIAS da14695_dk_usb)
set(native_native_sim_BOARD_ALIAS native_sim)
set(native_nrf5340bsim_BOARD_ALIAS nrf5340bsim/nrf5340/cpuapp)
set(nordic_nrf54l15dk_BOARD_ALIAS nrf54l15dk/nrf54l15/cpuapp)
set(nordic_nrf54h20dk_BOARD_ALIAS nrf54h20dk/nrf54h20/cpuapp)
set(nordic_nrf5340dk_BOARD_ALIAS nrf5340dk/nrf5340/cpuapp)
set(nordic_nrf7002dk_BOARD_ALIAS nrf7002dk/nrf5340/cpuapp)
set(nxp_frdm_mcxn947_BOARD_ALIAS frdm_mcxn947/mcxn947/cpu0)
set(nxp_frdm_rw612_BOARD_ALIAS frdm_rw612)
set(nxp_mimxrt1170_evk_BOARD_ALIAS mimxrt1170_evk@A/mimxrt1176/cm7)
set(st_stm32h7b3i_dk_BOARD_ALIAS stm32h7b3i_dk)
set(st_stm32wba65i_dk1_BOARD_ALIAS stm32wba65i_dk1)
set(st_nucleo_u575zi_q_BOARD_ALIAS nucleo_u575zi_q/stm32u575xx)
set(st_nucleo_n657x0_q_BOARD_ALIAS nucleo_n657x0_q/stm32n657xx)
20 changes: 20 additions & 0 deletions ports/zephyr-cp/boards/da14695_dk_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_OBSERVER=y
CONFIG_BT_EXT_ADV=y

CONFIG_BT_DEVICE_APPEARANCE_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_MAX=28
CONFIG_BT_L2CAP_TX_MTU=253

# BT Buffers
CONFIG_BT_BUF_CMD_TX_SIZE=255
CONFIG_BT_BUF_EVT_RX_COUNT=16
CONFIG_BT_BUF_EVT_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_COUNT=3
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=1
CONFIG_BT_BUF_ACL_RX_SIZE=255
10 changes: 10 additions & 0 deletions ports/zephyr-cp/boards/da14695_dk_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
&flash0 {
partitions{
circuitpy_partition: partition@118000 {
label = "circuitpy";
reg = <0x118000 (DT_SIZE_M(4) - DT_SIZE_K(1120))>;
};
};
};

#include "../app.overlay"
46 changes: 46 additions & 0 deletions ports/zephyr-cp/boards/frdm_rw612.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
CONFIG_NETWORKING=y
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y

CONFIG_WIFI=y
CONFIG_NET_L2_WIFI_MGMT=y
CONFIG_NET_MGMT_EVENT=y
CONFIG_NET_MGMT_EVENT_INFO=y

CONFIG_NET_HOSTNAME_ENABLE=y
CONFIG_NET_HOSTNAME_DYNAMIC=y
CONFIG_NET_HOSTNAME="circuitpython"

CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
CONFIG_MBEDTLS_RSA_C=y
CONFIG_MBEDTLS_PKCS1_V15=y
CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_ENABLED=y
CONFIG_MBEDTLS_ENTROPY_C=y
CONFIG_MBEDTLS_CTR_DRBG_ENABLED=y
CONFIG_MBEDTLS_USE_PSA_CRYPTO=n

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_OBSERVER=y
CONFIG_BT_EXT_ADV=y

CONFIG_BT_DEVICE_APPEARANCE_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_MAX=28
CONFIG_BT_L2CAP_TX_MTU=253

# BT Buffers
CONFIG_BT_BUF_CMD_TX_SIZE=255
CONFIG_BT_BUF_EVT_RX_COUNT=16
CONFIG_BT_BUF_EVT_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_COUNT=8
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=1
CONFIG_BT_BUF_ACL_RX_SIZE=255

CONFIG_UDC_WORKQUEUE_STACK_SIZE=1024
11 changes: 11 additions & 0 deletions ports/zephyr-cp/boards/frdm_rw612.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
&w25q512jvfiq {
partitions {
/delete-node/ storage_partition;
circuitpy_partition: partition@620000 {
label = "circuitpy";
reg = <0x00620000 (DT_SIZE_M(58) - DT_SIZE_K(128))>;
};
};
};

#include "../app.overlay"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "POSIX/Native Boards Native simulator - native_sim"

[modules]
__future__ = false
__future__ = true
_bleio = false
_eve = false
_pew = false
Expand Down
115 changes: 115 additions & 0 deletions ports/zephyr-cp/boards/native/nrf5340bsim/autogen_board_info.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info.
name = "POSIX/Native Boards nRF5340 simulated boards (BabbleSim)"

[modules]
__future__ = true
_bleio = true # Zephyr board has _bleio
_eve = false
_pew = false
_pixelmap = false
_stage = false
adafruit_bus_device = false
adafruit_pixelbuf = false
aesio = false
alarm = false
analogbufio = false
analogio = false
atexit = false
audiobusio = false
audiocore = false
audiodelays = false
audiofilters = false
audiofreeverb = false
audioio = false
audiomixer = false
audiomp3 = false
audiopwmio = false
aurora_epaper = false
bitbangio = false
bitmapfilter = true # Zephyr board has busio
bitmaptools = true # Zephyr board has busio
bitops = false
board = false
busdisplay = true # Zephyr board has busio
busio = true # Zephyr board has busio
camera = false
canio = false
codeop = false
countio = false
digitalio = true
displayio = true # Zephyr board has busio
dotclockframebuffer = false
dualbank = false
epaperdisplay = true # Zephyr board has busio
floppyio = false
fontio = true # Zephyr board has busio
fourwire = true # Zephyr board has busio
framebufferio = true # Zephyr board has busio
frequencyio = false
getpass = false
gifio = false
gnss = false
hashlib = false
i2cdisplaybus = true # Zephyr board has busio
i2cioexpander = false
i2ctarget = false
imagecapture = false
ipaddress = false
is31fl3741 = false
jpegio = false
keypad = false
keypad_demux = false
locale = false
lvfontio = true # Zephyr board has busio
math = false
max3421e = false
mdns = false
memorymap = false
memorymonitor = false
microcontroller = true
mipidsi = false
msgpack = false
neopixel_write = false
nvm = false
onewireio = false
os = true
paralleldisplaybus = false
ps2io = false
pulseio = false
pwmio = false
qrio = false
rainbowio = true
random = true
rclcpy = false
rgbmatrix = false
rotaryio = false
rtc = false
sdcardio = true # Zephyr board has busio
sdioio = false
sharpdisplay = true # Zephyr board has busio
socketpool = false
spitarget = false
ssl = false
storage = false
struct = true
supervisor = true
synthio = false
terminalio = true # Zephyr board has busio
tilepalettemapper = true # Zephyr board has busio
time = true
touchio = false
traceback = true
uheap = false
usb = false
usb_cdc = false
usb_hid = false
usb_host = false
usb_midi = false
usb_video = false
ustack = false
vectorio = true # Zephyr board has busio
warnings = true
watchdog = false
wifi = false
zephyr_kernel = false
zlib = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CIRCUITPY_BUILD_EXTENSIONS = ["elf"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name = "Nordic Semiconductor nRF5340 DK"

[modules]
__future__ = false
_bleio = false
__future__ = true
_bleio = true # Zephyr board has _bleio
_eve = false
_pew = false
_pixelmap = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "Nordic Semiconductor nRF54H20 DK"

[modules]
__future__ = false
__future__ = true
_bleio = false
_eve = false
_pew = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "Nordic Semiconductor nRF54L15 DK"

[modules]
__future__ = false
__future__ = true
_bleio = false
_eve = false
_pew = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name = "Nordic Semiconductor nRF7002 DK"

[modules]
__future__ = false
_bleio = false
__future__ = true
_bleio = true # Zephyr board has _bleio
_eve = false
_pew = false
_pixelmap = false
Expand Down
26 changes: 26 additions & 0 deletions ports/zephyr-cp/boards/nrf5340bsim_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Configuration for nrf5340bsim simulated board
# Mirror settings from native_sim.conf for compatibility

CONFIG_GPIO=y

# Enable Bluetooth stack - bsim is for BT simulation
CONFIG_BT=y
CONFIG_BT_HCI=y
CONFIG_BT_HCI_IPC=y
CONFIG_BT_OBSERVER=y
CONFIG_BT_BROADCASTER=y

CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_DEVICE_NAME_MAX=28

# So we can test safe mode
CONFIG_NATIVE_SIM_REBOOT=y

# Ensure the network core image starts when using native simulator
CONFIG_NATIVE_SIMULATOR_AUTOSTART_MCU=y

CONFIG_TRACING=y
CONFIG_TRACING_PERFETTO=y
CONFIG_TRACING_SYNC=y
CONFIG_TRACING_BACKEND_POSIX=y
CONFIG_TRACING_GPIO=y
Loading