Skip to content

Add meta-IRQ based mayfly HAL implementation with babblesim test coverage#32

Draft
cvinayak with Copilot wants to merge 3 commits into
mainfrom
copilot/implement-hal-abstraction-mayfly
Draft

Add meta-IRQ based mayfly HAL implementation with babblesim test coverage#32
cvinayak with Copilot wants to merge 3 commits into
mainfrom
copilot/implement-hal-abstraction-mayfly

Conversation

Copilot AI commented May 28, 2026

Copy link
Copy Markdown

The existing hal/nrf5/mayfly.c uses ARM Cortex-M SWI IRQs and NVIC tail-chaining to schedule mayfly execution contexts. This adds a portable alternative using Zephyr meta-IRQ threads, and a babblesim test to exercise it.

Meta-IRQ mayfly implementation

  • CONFIG_BT_CTLR_MAYFLY_META_IRQ — New Kconfig to select meta-IRQ threads over SWI. Requires NUM_METAIRQ_PRIORITIES > 0.
  • CONFIG_BT_CTLR_MAYFLY_META_IRQ_STACK_SIZE — Per-thread stack size (default 1024).
  • hal/nrf5/mayfly_meta_irq.c — Three dedicated meta-IRQ threads (LLL, ULL_HIGH, ULL_LOW), one per execution context. mayfly_pend() posts a semaphore; the thread wakes and calls mayfly_run().
  • Thread priorities map directly: LLL → K_HIGHEST_THREAD_PRIO, ULL_HIGH → +1, ULL_LOW → +2.
  • Conditional compilation in CMakeLists.txt — selects mayfly_meta_irq.c or mayfly.c based on Kconfig.

Babblesim test

  • prj_split_meta_irq.conf — Based on prj_split.conf, enables BT_CTLR_MAYFLY_META_IRQ with 4 meta-IRQ priorities.
  • basic_conn_encrypted_split_meta_irq.sh — Runs the encrypted connection test (peripheral + central_encrypted) against the meta-IRQ mayfly build. Auto-discovered by tests.nrf52bsim.txt.

Copilot AI requested a review from cvinayak May 28, 2026 20:31
Copilot AI changed the title Add meta-IRQ based mayfly HAL implementation Add meta-IRQ based mayfly HAL implementation with babblesim test coverage May 28, 2026
cvinayak added 3 commits May 29, 2026 05:56
Add meta-IRQ based mayfly implementation with Kconfig
option.

Add CONFIG_BT_CTLR_MAYFLY_META_IRQ Kconfig option and a new
mayfly_meta_irq.c HAL implementation that uses Zephyr
meta-IRQ priority threads instead of SWI/NVIC for mayfly
scheduling.

Each mayfly execution context (LLL, ULL_HIGH, ULL_LOW) gets
a dedicated meta-IRQ thread. mayfly_pend() wakes the
corresponding thread via a semaphore, and the thread calls
mayfly_run() for that context.

Assisted-by: Github CoPilot: Claude Opus 4.6
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add babblesim encrypted conn test with meta-IRQ mayfly
variant.

Add a new babblesim coverage test variant of
basic_conn_encrypted_split that uses the meta-IRQ based
mayfly implementation instead of SWI.

New files:
- prj_split_meta_irq.conf: Config enabling
  BT_CTLR_MAYFLY_META_IRQ
- tests_scripts/basic_conn_encrypted_split_meta_irq.sh:
  Test script

Assisted-by: Github CoPilot: Claude Opus 4.6
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Trivial re-order of compilations in the compile script to
keep similar feature tests grouped together.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
@cvinayak cvinayak force-pushed the copilot/implement-hal-abstraction-mayfly branch from d8e0323 to 96e470a Compare May 29, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants