Skip to content

Commit ed691eb

Browse files
committed
Implement GATT for Zephyr _bleio
Tested with BSIM and on nRF54LM20DK. CharacteristicBuffer and PacketBuffer are implemented as well. This hasn't been tested for BLE workflow so it may need allocation tweaks. Includes many other small fixes: * bsim tests are done with nRF54LM20bsim too. * bsim exe binaries are saved. * nRF7002DK loses bleio because it doesn't have space. * Other boards have their slot1 removed in favor of slot0 growing. * Fix UUID length and byte order issues. * Remove extra common_hal function for remote services. Code gen by DeepSeek V4 Pro. All prompted and reviewed by me. This is a bunch of work towards #9904, implementing _bleio. Pairing and bonding remains.
1 parent 83c549e commit ed691eb

60 files changed

Lines changed: 5070 additions & 215 deletions

Some content is hidden

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

locale/circuitpython.pot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ msgstr ""
12001200

12011201
#: ports/espressif/common-hal/_bleio/Characteristic.c
12021202
#: ports/nordic/common-hal/_bleio/Characteristic.c
1203+
#: ports/zephyr-cp/common-hal/_bleio/Characteristic.c
12031204
msgid "No CCCD for this Characteristic"
12041205
msgstr ""
12051206

@@ -1222,11 +1223,13 @@ msgstr ""
12221223

12231224
#: ports/espressif/common-hal/_bleio/PacketBuffer.c
12241225
#: ports/nordic/common-hal/_bleio/PacketBuffer.c
1226+
#: ports/zephyr-cp/common-hal/_bleio/PacketBuffer.c
12251227
msgid "Writes not supported on Characteristic"
12261228
msgstr ""
12271229

12281230
#: ports/espressif/common-hal/_bleio/PacketBuffer.c
12291231
#: ports/nordic/common-hal/_bleio/PacketBuffer.c
1232+
#: ports/zephyr-cp/common-hal/_bleio/PacketBuffer.c
12301233
msgid "Total data to write is larger than %q"
12311234
msgstr ""
12321235

@@ -1241,6 +1244,9 @@ msgstr ""
12411244

12421245
#: ports/espressif/common-hal/_bleio/__init__.c
12431246
#: ports/nordic/common-hal/_bleio/__init__.c
1247+
#: ports/zephyr-cp/common-hal/_bleio/Characteristic.c
1248+
#: ports/zephyr-cp/common-hal/_bleio/Connection.c
1249+
#: ports/zephyr-cp/common-hal/_bleio/Descriptor.c
12441250
#: shared-bindings/_bleio/CharacteristicBuffer.c
12451251
msgid "Not connected"
12461252
msgstr ""

ports/zephyr-cp/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,9 @@ config BT_BUF_ACL_RX_COUNT_EXTRA
8181

8282
config BT_BUF_ACL_RX_SIZE
8383
default 255
84+
85+
config BT_GATT_DYNAMIC_DB
86+
default y
87+
88+
config BT_GATT_CLIENT
89+
default y

ports/zephyr-cp/boards/board_aliases.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ cp_board_alias(renesas_ek_ra8d1 ek_ra8d1)
3535
cp_board_alias(renesas_da14695_dk_usb da14695_dk_usb)
3636
cp_board_alias(native_native_sim native_sim/native)
3737
cp_board_alias(native_nrf5340bsim nrf5340bsim/nrf5340/cpuapp)
38+
cp_board_alias(native_nrf54lm20bsim nrf54lm20bsim/nrf54lm20a/cpuapp)
3839
cp_board_alias(nordic_nrf54l15dk nrf54l15dk/nrf54l15/cpuapp)
3940
cp_board_alias(nordic_nrf54l15tag nrf54l15tag/nrf54l15/cpuapp)
4041
cp_board_alias(nordic_nrf54lm20dk nrf54lm20dk/nrf54lm20a/cpuapp)

ports/zephyr-cp/boards/da14695_dk_usb.overlay

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/* Remove slot1 (OTA), expand slot0 to use the space.
2+
* CircuitPython doesn't use OTA updates. */
3+
&slot0_partition {
4+
reg = <0x00010000 DT_SIZE_K(1024)>;
5+
};
6+
7+
/delete-node/ &slot1_partition;
8+
19
&flash0 {
210
partitions{
311
circuitpy_partition: partition@118000 {

ports/zephyr-cp/boards/frdm_rw612.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CONFIG_MBEDTLS_CIPHERSUITE_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256=y
1919
CONFIG_MBEDTLS_ENTROPY_C=y
2020
CONFIG_MBEDTLS_CTR_DRBG_C=y
2121

22-
# Override bt.conf default
22+
# Override Kconfig default (3)
2323
CONFIG_BT_BUF_ACL_TX_COUNT=8
2424

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

ports/zephyr-cp/boards/nordic/nrf7002dk/autogen_board_info.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "Nordic Semiconductor nRF7002 DK"
33

44
[modules]
55
__future__ = true
6-
_bleio = true # Zephyr board has _bleio
6+
_bleio = false
77
_eve = false
88
_pew = false
99
_pixelmap = false

0 commit comments

Comments
 (0)