Skip to content

Documented tx_thread_create stack address preservation - #107

Open
jnsagai wants to merge 1 commit into
eclipse-threadx:mainfrom
jnsagai:docs/744-stack-pointer-width
Open

jnsagai wants to merge 1 commit into
eclipse-threadx:mainfrom
jnsagai:docs/744-stack-pointer-width

Conversation

@jnsagai

@jnsagai jnsagai commented Oct 7, 2026 •

Copy link
Copy Markdown

Companion documentation for eclipse-threadx/threadx#744, targeting main in eclipse-threadx/rtos-docs-asciidoc.

The tx_thread_create Description does not explain the corrected stack-address contract when stack checking and MISRA are both enabled. Added one paragraph describing alignment and pattern reservations within the supplied memory area, preservation of the full stack address, and passing stack_start directly as a pointer without a narrowing integer cast. The existing port type-width content from merged docs PR #79 is not duplicated.

Confirmed the wording against the actual common/src/tx_thread_create.c: stack checking reduces the usable size for pattern reservations and alignment, and both address conversions use ALIGN_TYPE with no MISRA-specific narrowing path. Reviewed the existing regression implementation and red/green evidence; the recorded fixed run passes all six focused tests. Those existing results support the contract and are not a new test run for this documentation change.

Validation: local documentation diff and whitespace checks passed. The candidate rendered successfully with Antora; the generated tx_thread_create page contains the added paragraph. The independent documentation review passed on this patch. Human technical and provenance review was confirmed for this patch. Upstream approval and final-head ECA checks remain pending.

AI assistance: Codex (gpt-6.1-sol) read both contribution guides, the kernel implementation and evidence, authored the documentation paragraph and this PR draft, and checked the local diff. The submitting human remains responsible for reviewing and verifying the contribution.

The human contributor reviewed both linked contribution patches and confirmed provenance before submission.

Matching kernel fix: eclipse-threadx/threadx#799.

Stack checking adjusted stack addresses without documenting pointer width.

Clarified alignment, checking reserves, and full-width pointer preservation.

The candidate rendered successfully with Antora and passed independent review.

Assisted-by: Codex (gpt-6.1-sol) <noreply@openai.com>
@jnsagai
jnsagai marked this pull request as ready for review October 7, 2026 20:27

@fdesbiens fdesbiens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jnsagai. The kernel side is merged. For the docs, I'd like to keep only the part of this paragraph that describes the API.

The first sentence is right and useful, but it can be more concrete about what a reader is sizing for. Suggested wording: "When TX_ENABLE_STACK_CHECKING is defined, ThreadX reserves part of the stack area for overflow detection: stack_size is rounded down to a whole number of ULONGs and reduced by one ULONG, and when stack_start is not ULONG-aligned, the start is rounded up and the size reduced by one more ULONG."

Please drop the other two sentences. Preserving the full address is what any reader expects already. Stating it "including when TX_MISRA_ENABLE is also enabled" describes the fix in threadx#799, not the API, and it is not true of 6.4.x, which this manual also describes. The fix belongs in the release notes. The advice against narrowing the pointer is general C guidance, and stack_start is already a VOID *.

With that change the commit subject no longer fits. Something like "Documented the stack reserve applied by stack checking" would.

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