Skip to content

[FEATURE] Zephyr Bluetooth host (zblue): roadmap and tracking #21478

Open

Description

@chengkai15

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

  1. xiaoxiang781216 commented on Nov 5, 2026

    @xiaoxiang781216
    Contributor

    @LingaoM please integrate the bsworld simulation after the porting get merged.

  2. LingaoM commented on Nov 5, 2026

    @LingaoM
    Contributor

    2. @LingaoM please integrate the bsworld simulation after the porting get merged.

    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.

  3. chengkai15 commented on Nov 5, 2026

    @chengkai15
    ContributorAuthor

    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:

    Where How it runs What it covers Per PR in CI
    1. Twister + ztest tests/bluetooth/ on native_sim / qemu_x86; hardware boards are build-only in CI unit and small integration tests, e.g. host internals with fff mocks (tests/bluetooth/host/), bt_crypto, buf, uuid yes (twister.yaml)
    2. BabbleSim tests/bsim/bluetooth/ images for nrf52_bsim built by Twister, run by shell scripts with bs_2G4_phy_v1 multi-device end-to-end tests of host, audio and mesh; EDTT (gap/gatt/hci/ll lists); the BTP tester (tests/bsim/bluetooth/tester) yes (bsim-tests.yaml, on changes to subsys/bluetooth/**)
    3. BTP tester + AutoPTS tests/bluetooth/tester tester on a board, driven by AutoPTS with PTS and a PTS dongle qualification test cases from the ICS (tests/bluetooth/qualification/) no, daily (bluetooth-qualification)
    4. Hardware as 1, with twister --device-testing on real boards board-specific behaviour no, vendor labs

    How this maps to zblue:

    • 1: the host unit tests depend on ztest and on mocking Zephyr internals, so they do not carry over directly. Tests of pure functions can be reused; the bt_crypto vectors already pass on sim:zblue.
    • 2: this is the per-commit regression in Zephyr. What ties it to Zephyr is the nrf52_bsim board 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, and sim:zblue already 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.
    • 3: PR 7 of the roadmap ports the BTP tester. As Zephyr does in 2, the same application can be driven by BSWorld scenarios in CI and by AutoPTS on hardware.
    • 4: a hardware lab for regular regression is useful, and can be tracked separately from this roadmap.

    I have updated PR 7 in the roadmap above to: BTP tester for AutoPTS, plus BSWorld scenarios with sim:zblue in CI. Could you confirm that BSWorld can drive a NuttX sim host over H4 today, and which controller you would use for it?

  4. LingaoM commented on Nov 6, 2026

    @LingaoM
    Contributor

    Could you confirm that BSWorld can drive a NuttX sim host over H4 today, and which controller you would use for it?

    Yes—BSWorld already supports a NuttX sim host 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 existing CONFIG_SIM_HCISOCKET transport. 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:zblue configuration and BTP application still need their own integration and regression scenarios. For deterministic execution, the NuttX build should also enable CONFIG_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 on nrf52_bsim and 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:zblue to 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions