Skip to content

Fixed module thread reset on Cortex-A7 builds without MMU support - #857

Merged
fdesbiens merged 2 commits into
eclipse-threadx:devfrom
fdesbiens:fix/module-reset-without-memory-protection
Dec 1, 2026
Merged

fdesbiens merged 2 commits into
eclipse-threadx:devfrom
fdesbiens:fix/module-reset-without-memory-protection

Conversation

@fdesbiens

Copy link
Copy Markdown
Contributor

Thread reset rebuilds a module thread's entry frame from tx_thread_module_stack_start, _end and _size, but _txm_module_manager_thread_create recorded those fields only when TXM_MODULE_MEMORY_PROTECTION is non-zero. The Cortex-A7 module ports define it as zero when TXM_MODULE_MEMORY_PROTECTION_ENABLED is removed, so resetting any module thread on such a build placed the frame 76 bytes below a null stack end, at 0xFFFFFFB4. Every other module port defines the constant as non-zero and is not affected.

Thread create now records the module stack fields for every module thread. Guarding the restore in reset was rejected because it would keep a second code path and leave those threads invisible to the stack overlap check in thread create. On Cortex-A7 builds without MMU support, that check now refuses a module stack overlapping another module thread's stack with TX_PTR_ERROR, as on the other ports.

A new host test runs thread create and reset against the Cortex-A7 port headers, as shipped and with MMU support compiled out. Without the fix the second build fails 6 of 14 expectations, with a reset frame end of 0; with it, 15/15 module manager host tests pass in each of the five non-MISRA configurations. The QEMU module harness passed 4/4 on Cortex-M3 and Cortex-M4, with and without pointer context. Not run on Cortex-A7 hardware.

Thread reset rebuilds a module thread's entry frame from tx_thread_module_stack_start,
_end and _size, but _txm_module_manager_thread_create recorded those fields only when
TXM_MODULE_MEMORY_PROTECTION is non-zero. The Cortex-A7 module ports define it as zero
when TXM_MODULE_MEMORY_PROTECTION_ENABLED is removed, so resetting any module thread
on such a build placed the frame 76 bytes below a null stack end, at 0xFFFFFFB4. Every
other module port defines the constant as non-zero and is not affected.

Thread create now records the module stack fields for every module thread. Guarding the
restore in reset was rejected because it would keep a second code path and leave those
threads invisible to the stack overlap check in thread create. On Cortex-A7 builds
without MMU support, that check now refuses a module stack overlapping another module
thread's stack with TX_PTR_ERROR, as on the other ports.

A new host test runs thread create and reset against the Cortex-A7 port headers, as
shipped and with MMU support compiled out. Without the fix the second build fails 6 of
14 expectations, with a reset frame end of 0; with it, 15/15 module manager host tests
pass in each of the five non-MISRA configurations. The QEMU module harness passed 4/4
on Cortex-M3 and Cortex-M4, with and without pointer context. Not run on Cortex-A7
hardware.

Assisted-by: Claude Code (Opus 5.5) <noreply@anthropic.com>
Dev appended the Cortex-A35 properties test where this branch appended the thread reset
stack test in the Module Manager test CMakeLists, so the two blocks conflicted.

Both test blocks are kept, the reset stack test first.

19/19 Module Manager host tests pass in default_build_coverage.

Assisted-by: Claude Code (Opus 5.5) <noreply@anthropic.com>
@fdesbiens
fdesbiens merged commit 4aaa748 into eclipse-threadx:dev Dec 1, 2026
24 of 25 checks passed
@fdesbiens
fdesbiens deleted the fix/module-reset-without-memory-protection branch December 1, 2026 22:16
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.

1 participant