Skip to content

Added Cortex-M55 ThreadX module ports for GNU and IAR - #810

Open
rahmanih wants to merge 5 commits into
devfrom
feature/add-cm55-threadx-modules
Open

rahmanih wants to merge 5 commits into
devfrom
feature/add-cm55-threadx-modules

Conversation

@rahmanih

@rahmanih rahmanih commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

ThreadX Modules lacked a Cortex-M55 port for GNU and IAR. The port needs to build in C99 and preserve the secure stack and context save checks used by the maintained Armv8-M ports.

Added the GNU and IAR module ports, corrected GNU assembly preprocessing and shared MPU limit encoding, and carried forward the maintained checks. The module port initializes secure stacks at startup, validates thread handles, and clears the active Secure stack registers before release. The GNU module harness covers secure-only and dual-state operation on QEMU's AN547 machine. A Linux test exercises the Secure stack guards with simulated registers and CMSE decisions.

GCC 14 passed 26/26 QEMU tests and 14/14 Linux Module Manager tests. The MPU limit and secure stack startup regressions failed before their fixes. The exhaustion regression detected a lost context after Secure heap allocation failed. GNU M55 manager C coverage reached 97/97 lines and 39/39 branch outcomes in secure-only QEMU and 216/232 lines and 101/121 branch outcomes in dual-state QEMU. Combined with the Linux guard test, dual-state coverage reached 232/232 lines and 121/121 branch outcomes. The contributor reported STM32N6 tests with GNU and IAR. The follow-ups ran locally with GNU.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Test Results FreeRTOS

3 tests  ±0   3 ✅ ±0   1s ⏱️ -1s
1 suites ±0   0 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 1c1bf50. ± Comparison against base commit fb15fa4.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Test Results RISC-V

1 194 tests  ±0   1 194 ✅ ±0   6m 19s ⏱️ -13s
   12 suites ±0       0 💤 ±0 
   12 files   ±0       0 ❌ ±0 

Results for commit 1c1bf50. ± Comparison against base commit fb15fa4.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Test Results SMP

605 tests  ±0   605 ✅ ±0   4m 52s ⏱️ -13s
  5 suites ±0     0 💤 ±0 
  5 files   ±0     0 ❌ ±0 

Results for commit 1c1bf50. ± Comparison against base commit fb15fa4.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
common_smp.src 100% 81% ➖
Summary 100% (5576 / 5585) 81% (3132 / 3872) ➖

Minimum allowed line rate is 99%

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Test Results ThreadX

  7 files  ±0    7 suites  ±0   3m 44s ⏱️ +18s
817 tests +5  817 ✅ +5  0 💤 ±0  0 ❌ ±0 
853 runs  +5  853 ✅ +5  0 💤 ±0  0 ❌ ±0 

Results for commit 1c1bf50. ± Comparison against base commit fb15fa4.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
common.src 99% 78% ➖
Summary 99% (4773 / 4802) 78% (2691 / 3458) ➖

Minimum allowed line rate is 99%

@rahmanih
rahmanih changed the base branch from master to dev October 17, 2026 17:31
The new Cortex-M55 port required GNU C extensions to build. Several
assembly files also needed preprocessing, and the port lacked the current
secure stack and context save checks used by the maintained ports. Shared
memory limits mixed address and MPU attribute bits.

Used C99-compatible GNU assembly syntax and preprocessed the mode-specific
sources. Applied the maintained checks to GNU and IAR, corrected the MPU
limit encoding, and ran the GNU module manager in secure-only mode on the
AN547 QEMU machine. Inline CMSE register access retains the existing
MISRA C:2023 Rule 1.2 and Directive 4.3 deviations for hardware access.

GCC 14 built the dual-state GNU archives in C99 mode. QEMU passed 4/4 on M3,
4/4 on M4, and 3/3 on M55 with PRIMASK and with BASEPRI plus WFI. The M55
MPU limit regression failed before the encoding fix. Secure-only QEMU
covered 90/97 executable lines and 30/39 branch outcomes in M55 manager C.
IAR and STM32N6 were not run locally.

Assisted-by: Codex (GPT-6.2-Sol) <noreply@openai.com>
@fdesbiens fdesbiens changed the title feat(ports_module): Add Cortex-M55 GNU and IAR ThreadX module ports Added Cortex-M55 ThreadX module ports for GNU and IAR Nov 25, 2026
The M55 module SVC handler skipped secure stack initialization, and the
dispatcher validated thread arguments by size. Releasing an active stack left
its address in the Secure stack registers.

Dispatch the startup SVC by its return address, authenticate live thread
objects, and clear the active stack registers and context ownership on
release. GNU register access uses MISRA C:2023 Rule 1.2 and Directive 4.3
deviations for hardware access. Rule 11.6 applies to comparing a stack limit
address with the register value.

QEMU passed 4/4 on M3, 4/4 on M4, and 3/3 in each M55 secure-only and
dual-state interrupt configuration. The startup regression failed before
the fix. GCC covered 97/97 lines and 39/39 branch outcomes in secure-only
GNU M55 manager C and 206/232 lines and 92/121 branch outcomes in dual-state
manager C. IAR and STM32N6 testing of this follow-up remains outstanding.

Assisted-by: Codex (GPT-6.2-Sol) <noreply@openai.com>
Signed-off-by: Frédéric Desbiens <frederic.desbiens@eclipse-foundation.org>
The dual-state module tests exercised secure stack allocation and release
with room in the allocator and the context pool. They left the startup and
interrupt caller checks in the public APIs partly untested.

Bounded the QEMU Secure heap and added a regression that exhausts both
resources, retries after a release, and calls the public APIs during startup
and from timer callbacks. The fixture documents its MISRA C:2023 deviations
for the heap's alignment and the newlib system-call interface.

GCC 14 and QEMU passed 26/26 across seven Cortex-M configurations. The test
failed when allocation stopped returning a context after malloc failure.
Combined M55 dual-state manager C coverage reached 216/232 lines and
101/121 branch outcomes. Both secure stack API wrappers reached full line
and branch coverage.

Assisted-by: Codex (GPT-6.2-Sol) <noreply@openai.com>
Signed-off-by: Frédéric Desbiens <frederic.desbiens@eclipse-foundation.org>
The dual-state QEMU tests covered normal secure stack operations, resource
exhaustion, and timer callers. Secure-side rejection paths remained uncovered.

Moved register access into GNU port macros and added a Linux regression that
compiles the port source with a simulated register bank and CMSE decisions.
The Cortex-M55 object retained identical instructions and relocations.

GCC 14 passed 26/26 QEMU tests and 14/14 Linux Module Manager tests. QEMU
exercised 216/232 GNU dual-state manager C lines and 101/121 branch outcomes.
Combined with the Linux guard test, coverage reached 232/232 lines and
121/121 branch outcomes.

Assisted-by: Codex (GPT-6.2-Sol) <noreply@openai.com>
Signed-off-by: Frédéric Desbiens <frederic.desbiens@eclipse-foundation.org>
@fdesbiens

Copy link
Copy Markdown
Contributor

@rahmanih Could you build the updated PR head (1c1bf502) with IAR and test it on STM32N6 in secure-only and dual-state modes? Please verify that a protected module can load, start, use its granted shared memory, stop, and unload in both modes. In dual-state mode, please also check that secure stacks initialize at boot and that a worker can allocate a secure stack, keep it across context switches, and release it.

Please share the IAR version, configurations tested, and results here.

This branch has not been deployed

No deployments
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