Skip to content

Fixed NAND faults from unaligned metadata and page buffers - #96

Open
fdesbiens wants to merge 1 commit into
eclipse-threadx:devfrom
fdesbiens:fix-nand-unaligned-access
Open

fdesbiens wants to merge 1 commit into
eclipse-threadx:devfrom
fdesbiens:fix-nand-unaligned-access

Conversation

@fdesbiens

Copy link
Copy Markdown
Contributor

Fixes #55

NAND metadata access cast byte pointers to word pointers, and an odd block count could leave the page buffer misaligned. Both can fault on targets with strict alignment.

This change copies fixed-width metadata values through aligned locals and pads the NAND workspace before its page buffer, including padding in the capacity check. On 64-bit ULONG targets, four-byte metadata fields now match their fixed offsets; media formatted by the old layout may need reformatting.

GCC 14: 6/6 default regression tests passed. The focused test passed with alignment sanitization on 32-bit and 64-bit builds; all new alignment lines were covered. Not run on hardware.

Assisted-by: Codex (GPT-6-Sol) noreply@openai.com

Fixes eclipse-threadx#55

NAND metadata access cast byte pointers to word pointers, and an odd block
count could leave the page buffer misaligned. Both can fault on targets with
strict alignment.

Copy fixed-width metadata values through aligned locals and pad the NAND
workspace before its page buffer. Account for padding in the capacity check.
On 64-bit ULONG targets, four-byte metadata fields now match their fixed
offsets; media formatted by the old layout may need reformatting.

GCC 14: 6/6 default regression tests passed. The focused test passed with
alignment sanitization on 32-bit and 64-bit builds; all new alignment lines
were covered. Not run on hardware.

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

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.

1 participant