Skip to content

Commit a7df997

Browse files
authored
Merge pull request #10833 from tannewt/zephyr_bleio
Add basic _bleio implementation for zephyr-cp port
2 parents 75906f4 + 1303767 commit a7df997

File tree

84 files changed

+3187
-340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+3187
-340
lines changed

.github/workflows/run-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,10 @@ jobs:
9595
uses: ./.github/actions/deps/external
9696
- name: Build native sim target
9797
run: make -C ports/zephyr-cp -j2 BOARD=native_native_sim
98+
- name: Build bsim
99+
run: make -j 2 everything
100+
working-directory: ports/zephyr-cp/tools/bsim
101+
- name: Build native_nrf5340bsim
102+
run: make -C ports/zephyr-cp -j2 BOARD=native_nrf5340bsim
98103
- name: Run Zephyr tests
99104
run: make -C ports/zephyr-cp test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,6 @@ TAGS
110110

111111
# windsurf rules
112112
.windsurfrules
113+
114+
# git-review-web outputs
115+
.review

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Capture CircuitPython output by finding the matching device in `/dev/serial/by-id`
2+
- You can mount the CIRCUITPY drive by doing `udisksctl mount -b /dev/disk/by-label/CIRCUITPY` and access it via `/run/media/<user>/CIRCUITPY`.
3+
- `circup` is a command line tool to install libraries and examples to CIRCUITPY.

conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ def autoapi_prepare_jinja_env(jinja_env):
192192
# Port READMEs in various formats
193193
"ports/*/README*",
194194
]
195-
exclude_patterns = ["docs/autoapi/templates/**", "docs/README.md"]
195+
exclude_patterns = [
196+
"docs/autoapi/templates/**",
197+
"docs/README.md",
198+
"AGENTS.md",
199+
"**/AGENTS.md",
200+
]
196201

197202
# The reST default role (used for this markup: `text`) to use for all
198203
# documents.

locale/circuitpython.pot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,10 @@ msgstr ""
13311331
msgid "Invalid ROS domain ID"
13321332
msgstr ""
13331333

1334+
#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
1335+
msgid "Invalid advertising data"
1336+
msgstr ""
1337+
13341338
#: ports/espressif/common-hal/espidf/__init__.c py/moderrno.c
13351339
msgid "Invalid argument"
13361340
msgstr ""
@@ -3801,6 +3805,7 @@ msgid "non-hex digit"
38013805
msgstr ""
38023806

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

@@ -4284,6 +4289,7 @@ msgid "timeout duration exceeded the maximum supported value"
42844289
msgstr ""
42854290

42864291
#: ports/nordic/common-hal/_bleio/Adapter.c
4292+
#: ports/zephyr-cp/common-hal/_bleio/Adapter.c
42874293
msgid "timeout must be < 655.35 secs"
42884294
msgstr ""
42894295

ports/zephyr-cp/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- Build a board by doing `make BOARD=<vendor>_<board_name>`.
2+
- The corresponding configuration files are in `boards/<vendor>/<board_name>`
3+
- The files (not folders) in `boards/` directory are used by Zephyr.
4+
- To flash it on a board do `make BOARD=<vendor>_<board_name> flash`.
5+
- Zephyr board docs are at `zephyr/boards/<vendor>/<board_name>`.

ports/zephyr-cp/Kconfig.sysbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config NET_CORE_BOARD
88
default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk"
99
default "nrf7002dk/nrf5340/cpunet" if $(BOARD) = "nrf7002dk"
1010
default "nrf5340_audio_dk/nrf5340/cpunet" if $(BOARD) = "nrf5340_audio_dk"
11+
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD) = "nrf5340bsim"
1112

1213
config NET_CORE_IMAGE_HCI_IPC
1314
bool "HCI IPC image on network core"

ports/zephyr-cp/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ BUILD ?= build-$(BOARD)
88

99
TRANSLATION ?= en_US
1010

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

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

30+
recover: $(BUILD)/zephyr-cp/zephyr/zephyr.elf
31+
west flash --recover -d $(BUILD)
32+
2933
debug: $(BUILD)/zephyr-cp/zephyr/zephyr.elf
3034
west debug -d $(BUILD)
3135

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
set(pca10056_BOARD_ALIAS nrf52840dk/nrf52840)
22
set(renesas_ek_ra6m5_BOARD_ALIAS ek_ra6m5)
33
set(renesas_ek_ra8d1_BOARD_ALIAS ek_ra8d1)
4+
set(renesas_da14695_dk_usb_BOARD_ALIAS da14695_dk_usb)
45
set(native_native_sim_BOARD_ALIAS native_sim)
6+
set(native_nrf5340bsim_BOARD_ALIAS nrf5340bsim/nrf5340/cpuapp)
57
set(nordic_nrf54l15dk_BOARD_ALIAS nrf54l15dk/nrf54l15/cpuapp)
68
set(nordic_nrf54h20dk_BOARD_ALIAS nrf54h20dk/nrf54h20/cpuapp)
79
set(nordic_nrf5340dk_BOARD_ALIAS nrf5340dk/nrf5340/cpuapp)
810
set(nordic_nrf7002dk_BOARD_ALIAS nrf7002dk/nrf5340/cpuapp)
911
set(nxp_frdm_mcxn947_BOARD_ALIAS frdm_mcxn947/mcxn947/cpu0)
12+
set(nxp_frdm_rw612_BOARD_ALIAS frdm_rw612)
1013
set(nxp_mimxrt1170_evk_BOARD_ALIAS mimxrt1170_evk@A/mimxrt1176/cm7)
1114
set(st_stm32h7b3i_dk_BOARD_ALIAS stm32h7b3i_dk)
15+
set(st_stm32wba65i_dk1_BOARD_ALIAS stm32wba65i_dk1)
1216
set(st_nucleo_u575zi_q_BOARD_ALIAS nucleo_u575zi_q/stm32u575xx)
1317
set(st_nucleo_n657x0_q_BOARD_ALIAS nucleo_n657x0_q/stm32n657xx)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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_BT_DEVICE_APPEARANCE_DYNAMIC=y
9+
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
10+
CONFIG_BT_DEVICE_NAME_MAX=28
11+
CONFIG_BT_L2CAP_TX_MTU=253
12+
13+
# BT Buffers
14+
CONFIG_BT_BUF_CMD_TX_SIZE=255
15+
CONFIG_BT_BUF_EVT_RX_COUNT=16
16+
CONFIG_BT_BUF_EVT_RX_SIZE=255
17+
CONFIG_BT_BUF_ACL_TX_COUNT=3
18+
CONFIG_BT_BUF_ACL_TX_SIZE=251
19+
CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=1
20+
CONFIG_BT_BUF_ACL_RX_SIZE=255

0 commit comments

Comments
 (0)