AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

refactor(core): separate norcow config from flash layout

Public commit record

What the developer wrote

Authored by tychovrahe

95/100 · Strong
refactor(core): separate norcow config from flash layout

`norcow_config.h` lived in the flash module and was pulled in by
`sys/flash.h`, while storage's `norcow.h` includes `norcow_config.h`,
which itself includes `sys/flash.h` — a cycle between the two modules.

Split it along its natural seam:

- `STORAGE_AREAS` / `STORAGE_AREAS_COUNT` are flash layout (defined by
`flash_layout.c`, used by `flash_utils.c` and the bootloader emulator),
so they join the other area declarations in `sys/flash.h`.
- The norcow parameters move to `sec/storage/inc/norcow_config.h`, next
to the module that needs them, and `NORCOW_SECTOR_COUNT` is now derived
from `STORAGE_AREAS_COUNT` so the two cannot disagree.

`projects/unix/main_main.c` uses `MODEL_INTERNAL_NAME` but reached
`trezor_model.h` only through the removed include chain, so it now
includes it directly.

Legacy and `storage/tests` are unaffected: each supplies its own
`norcow_config.h`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

[no changelog]
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit is a straightforward internal code cleanup. It moves two configuration constants between header files to remove a circular include dependency between the flash and storage modules. There is no user-facing change, no bug fix, and no security-sensitive behavior change.

Recommended action

No security action required. Review as normal code-quality refactor.

Security signals we found

No strong security signals were identified.

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.