Repository navigation
Description
Is your feature request related to a problem? Please describe.
NuttX has no Bluetooth host with BR/EDR today. The native stack
(wireless/bluetooth, net/bluetooth) is an early-stage LE host, and
NimBLE in nuttx-apps supports LE only. Products that need BR/EDR
profiles (HFP, A2DP, AVRCP, ...) together with LE cannot use NuttX
without a third-party stack.
#20686 proposed an adapted Zephyr host in the kernel tree. After the
review there and the DISCUSS thread on dev@, the integration model was
put to a vote:
Option 1B passed, with 2B (L2CAP boundary) as the long-term direction.
This issue tracks the work for it.
Describe the solution you'd like
The Zephyr Bluetooth host is integrated in three steps. Each step is a
separate patch series, reviewed and tested on its own, and the stack is
usable after each step.
Step 1: unmodified Zephyr host in nuttx-apps (in progress)
The host is added to nuttx-apps under wireless/bluetooth/zblue, in the
same way as NimBLE: the Zephyr source is downloaded from a Zephyr
release (CONFIG_ZBLUE_REF) and is not modified. The NuttX code is a
porting layer (Zephyr kernel services on POSIX threads, HCI on the
existing /dev/ttyHCIx transport) and the build files. Fixes to the
host, including security fixes, go to Zephyr and are picked up by
changing the release. It is an optional stack: CONFIG_ZBLUE excludes
CONFIG_WIRELESS_BLUETOOTH_HOST and CONFIG_NIMBLE, and nothing changes
for them.
| PR | Repository | Content | Verified by | Status |
|---|---|---|---|---|
| 1 | apps + nuttx | Porting layer, HCI over /dev/ttyHCIx, Zephyr Kconfig resolution, Make and CMake builds, LE core (advertising, scanning, connections, GATT), PSA crypto through apps/crypto/mbedtls, zblue_peripheral example; sim:zblue, documentation, CI build. Simulator only. |
sim with a USB controller: scan, connect, GATT discovery and read, reconnect | draft: apache/nuttx-apps#3977, #21479 |
| 2 | apps | SMP (LE Secure Connections), privacy, ECC | pairing with a phone, encrypted link, resolvable private address | planned |
| 3 | apps | Persistent storage: Zephyr settings with a file backend on the NuttX file system | bonds and identity kept after reboot | planned |
| 4 | apps | bt shell: the upstream Bluetooth shell as an NSH command |
scan, connect, GATT and pairing from the shell | planned |
| 5 | apps | BR/EDR: L2CAP BR, SDP, RFCOMM, HFP, A2DP (with SBC), AVRCP, HID, selected by CONFIG_BT_*; classic commands in the shell |
pairing, SPP, HFP call and A2DP streaming with a phone or headset | planned |
| 6 | nuttx + apps | Targets other than the simulator: initialized iterable RAM sections of the host (net_buf pools) in .data, through the iterable section support in include/nuttx/linker; port iterable sections mapped to <nuttx/iterable_sections.h> |
build and run on a board with an on-chip or UART controller | planned |
| 7 | apps (+ nuttx) | Tests: the upstream Bluetooth tester (BTP) as an NSH application, driven by AutoPTS on hardware and by BSWorld scenarios with sim:zblue (H4 to a virtual controller) in CI |
AutoPTS GAP/GATT/SM test cases; BSWorld CI job | planned |
Order: 1, then 2; 3 and 4 after 2, in any order; 5 after 3 and 4. 6
can start after 1. 7 after 4. Board configurations are added or
updated with each PR.
Step 2: lower host layers in the kernel
HCI core, connection management and L2CAP move into the kernel and
replace wireless/bluetooth and net/bluetooth, without losing the
existing functions, and keeping existing applications and tools
(btsak, Bluetooth sockets) working. Controller drivers stay as they
are. Details will be proposed on dev@ before this step starts.
Step 3: userspace host on the kernel sockets
The userspace host uses the kernel through the socket interface
(L2CAP and management sockets, as with Linux and BlueZ) and drops its
own copy of the layers moved in step 2. Profiles, services, the shell
and tools stay in userspace, which keeps them out of the kernel in
protected and kernel builds.
The long-term kernel/user boundary is the L2CAP boundary (2B in the
vote); steps 2 and 3 move towards it.
Describe alternatives you've considered
- Adapted Zephyr host in the kernel tree, maintained as NuttX code
(option 1A, net/bt: Add native Bluetooth host stack #20686). - Whole host in userspace, kernel limited to the HCI transport (option
2A of the vote). - Extending the native NuttX stack or NimBLE: both are LE only, so
BR/EDR and its profiles would have to be written from scratch.
Verification
- I have verified before submitting the report.
Activity
xiaoxiang781216 commentedon Nov 5, 2026
@LingaoM please integrate the bsworld simulation after the porting get merged.
LingaoM commentedon Nov 5, 2026
AutoPTS currently, in the Zephyr project, it is used only for a daily smoke test (https://github.com/zephyrproject-rtos/bluetooth-qualification).
We also need to set up a hardware infrastructure to conduct regular regression testing.
For the entire Bluetooth protocol stack, if one wishes to perform PTS qualification for every commit, a viable approach is to conduct testing based on Bluetooth qualification specifications using the BabbleSim PHY. For reference, see: https://github.com/XiaoMi/bsworld/blob/main/components/bscontroller/tests/qualification/ll/connection_test.py#L19111;
Zephyr also use same ways call EDTT(https://github.com/zephyrproject-rtos/edtt) to perform PTS qualification for every commit.
However, a unit test based on the BabbleSim PHY—a foundational component for Bluetooth testing in Zephyr—is still missing in NuttX from the CI. Since this component is tightly coupled with Zephyr’s "Twister" test runner, the primary task ahead will be to determine how to reimplement it using the BSWorld framework.
chengkai15 commentedon Nov 5, 2026
Thanks @LingaoM. Agreed that per-commit regression has to run on a simulated PHY, and AutoPTS is for periodic qualification runs.
For reference, the Bluetooth testing in Zephyr is done in four ways:
tests/bluetooth/native_sim/qemu_x86; hardware boards are build-only in CItests/bluetooth/host/),bt_crypto,buf,uuidtwister.yaml)tests/bsim/bluetooth/nrf52_bsimbuilt by Twister, run by shell scripts withbs_2G4_phy_v1tests/bsim/bluetooth/tester)bsim-tests.yaml, on changes tosubsys/bluetooth/**)tests/bluetooth/testertests/bluetooth/qualification/)twister --device-testingHow this maps to zblue:
bt_cryptovectors already pass onsim:zblue.nrf52_bsimboard and the nRF HW models rather than Twister, which only builds the images. BSWorld avoids that: the host connects over H4 to a virtual controller, andsim:zbluealready uses H4 through/dev/ttyHCIx, so it should plug in without changes to the host. The EDTT LL lists test the controller; for a host only the gap/gatt lists apply.I have updated PR 7 in the roadmap above to: BTP tester for AutoPTS, plus BSWorld scenarios with
sim:zbluein CI. Could you confirm that BSWorld can drive a NuttX sim host over H4 today, and which controller you would use for it?LingaoM commentedon Nov 6, 2026
Yes—BSWorld already supports a NuttX
simhost over standard H4 HCI carried by a Unix-domain socket. For the per-commit LE regression job, I recommend the Python BSController.The existing NuttX integration launches each host with
--bt-dev=<controller socket>and the--sim-bsim-*arguments that join the shared simulation clock; see the process helper. This uses NuttX's existingCONFIG_SIM_HCISOCKETtransport. There are already scenarios for:sim:bthcisock/ BTSak: advertising, scanning, multiple advertisers, and interference/recovery.sim:nimble: discovery, connection, GATT service discovery, and notification subscription.Those scenarios are parameterized over both Python and Zephyr Controllers. So the NuttX sim/H4 integration exists today; the new
sim:zblueconfiguration and BTP application still need their own integration and regression scenarios. For deterministic execution, the NuttX build should also enableCONFIG_SIM_BSIM_TIME, as in the existing NuttX setup.I recommend the Python implementation because it removes the need to fetch a Zephyr workspace, install its SDK, and build a Zephyr Controller image for this CI job. The Controller itself runs directly as Python code and needs no separate firmware compilation. BabbleSim's native PHY and libraries are still required, but those can be built once and reused. The BSController CI workflow demonstrates installation, unit tests, and HCI/LL protocol tests without a Zephyr build.
To support stability, I have added unit tests and an independently implemented protocol regression suite containing 612 selected cases: 133 HCI and 479 LL, based on the Bluetooth test specifications. These provide development regression coverage; they do not imply complete specification coverage or Bluetooth SIG qualification. BSWorld also has interoperability scenarios between Python BSController and Zephyr's Controller over the shared BabbleSim PHY, with both Central/Peripheral role assignments, covering GATT, encryption, privacy, and link updates.
The current feature coverage is mainly LE functionality introduced through Bluetooth Core 5.0, including extended/periodic advertising, LE 2M/Coded PHY, privacy, encryption, and data length extension, plus a few newer features. It does not support BR/EDR, so the BR/EDR parts of the roadmap will need a different Controller/backend or hardware. We can extend the Python implementation together as additional LE features are needed.
I have also upstreamed the C-based virtual Controller as Zephyr's
samples/bluetooth/hci_virt, which runs onnrf52_bsimand exposes the same H4 socket interface. BSWorld supports either implementation, so we can use Python BSController for routine LE CI and retain Zephyr Controller runs for additional validation.For PR 7, I would reuse the existing NuttX sim transport, attach
sim:zblueto Python BSController, and add the host-focused GAP/GATT scenarios around the BTP tester. AutoPTS can drive that tester separately in the hardware qualification setup.