Skip to content

feat: Add cm85 threadx modules for IAR and GNU - #811

Open
rahmanih wants to merge 9 commits into
devfrom
feature/add-cm85-threadx-modules
Open

rahmanih wants to merge 9 commits into
devfrom
feature/add-cm85-threadx-modules

Conversation

@rahmanih

@rahmanih rahmanih commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Generated by AI: GPT-5.6 Terra

PR checklist

  • Updated function header with a short description and version number
  • Added test case for bug fix or new feature
  • [x ] Validated on real hardware STM32V8 IAR/GNU GCC

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Test Results FreeRTOS

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

Results for commit 575c6f8. ± Comparison against base commit 584516a.

♻️ 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 21s ⏱️ -12s
   12 suites ±0       0 💤 ±0 
   12 files   ±0       0 ❌ ±0 

Results for commit 575c6f8. ± Comparison against base commit 584516a.

♻️ 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   5m 4s ⏱️ -3s
  5 suites ±0     0 💤 ±0 
  5 files   ±0     0 ❌ ±0 

Results for commit 575c6f8. ± Comparison against base commit 584516a.

♻️ 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% (3135 / 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 26s ⏱️ -1s
847 tests +10  847 ✅ +10  0 💤 ±0  0 ❌ ±0 
883 runs  +10  883 ✅ +10  0 💤 ±0  0 ❌ ±0 

Results for commit 575c6f8. ± Comparison against base commit 584516a.

♻️ 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%

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>
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 We’ll carry the Cortex-M55 fixes from #810 into the M85 port while #810 goes through verification. That includes the GNU C99 build and assembly preprocessing, secure-stack startup and release, thread-handle validation, and shared MPU limits. Once #810 merges, we’ll rebase the M85 commit onto dev and run the GNU builds and applicable regressions on the updated branch.

Once that head is ready, could you rerun your STM32V8 tests with GNU and IAR in secure-only and dual-state modes? Please check the protected module lifecycle and shared-memory access in both modes. In dual-state mode, please also verify secure-stack initialization at boot and allocation, use across context switches, and release. Please share the compiler versions and results here.

The Cortex-M55 tests overlapped new Module Manager and pointer-context
tests on dev. The M55 shell called only scalar entries, so pointer
workers did not start when the opt-in APIs were enabled.

Preserved the Cortex-A35 tests and gave the QEMU results distinct slots.
Used the shared module entry dispatcher in the GNU and IAR M55 shells.
The QEMU workflow exercises both pointer settings across the three ports.

Arm GNU 14.2 and QEMU 10.2 passed 38/38 tests across ten configurations,
including both M55 security modes and dual-state timer ISR processing.
GCC 14 passed 136/136 Linux host tests.

Assisted-by: Codex (GPT-6.2-Sol) <noreply@openai.com>
@rahmanih

rahmanih commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

@fdesbiens
since the PR #810 has been merged now, how to proceed regarding this one?

The Cortex-M85 contribution was based on the original Cortex-M55 port.
The Cortex-M55 branch has since integrated current dev and gained fixes
and regression coverage.

Merged the updated Cortex-M55 branch to keep the existing Cortex-M85
contribution and its prerequisite history.

Git verified a clean merge and confirmed that the result differs from
the updated Cortex-M55 branch only by the original Cortex-M85 files.

Assisted-by: Codex (GPT-6.2-Sol) <noreply@openai.com>
The Cortex-M85 port inherited the original Cortex-M55 code, including
unpreprocessed GNU assembly and incomplete Secure stack and module
entry handling.

Applied the corresponding GNU and IAR fixes for stack initialization
and release, module handle checks, shared MPU capacity, and pointer
entry dispatch. Extended the host guard test to both ports and checked
pool exhaustion, allocation rollback, and save and restore.

Arm GNU 14.2 built the manager and module library in six configurations
with zero warnings. GCC 14 passed 137/137 Linux tests and covered
118/118 lines and 62/62 branch outcomes in each host Secure stack build.

Assisted-by: Codex (GPT-6.2-Sol) <noreply@openai.com>
@fdesbiens

Copy link
Copy Markdown
Contributor

Hi @rahmanih, once I push the updated #811 head, could you run a first pass on STM32V8 with IAR and TX_ENABLE_POINTER_CONTEXT enabled?

  • Secure-only and dual-state: Load, start, stop, and unload a protected module. Check that it can use its granted shared memory and that a module worker and timer callback receive their pointer arguments.
  • Dual-state: Confirm that secure stacks initialize at boot and that a worker can allocate a secure stack, retain it across context switches, and release it.

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

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