Skip to content

increase stack size on F4 models#6837

Merged
TychoVrahe merged 1 commit into
mainfrom
tychovrahe/fix/tt_stack_overflow
Apr 27, 2026
Merged

increase stack size on F4 models#6837
TychoVrahe merged 1 commit into
mainfrom
tychovrahe/fix/tt_stack_overflow

Conversation

@TychoVrahe

Copy link
Copy Markdown
Contributor

Fixes RSOD during booloader update.

@TychoVrahe TychoVrahe self-assigned this Apr 27, 2026
@github-project-automation github-project-automation Bot moved this to 🔎 Needs review in Firmware Apr 27, 2026
@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f17d7a4b-831d-42c6-a48a-db5a960077c8

📥 Commits

Reviewing files that changed from the base of the PR and between 0eef21e and b426d72.

📒 Files selected for processing (7)
  • core/embed/models/D001/memory.h
  • core/embed/models/D001/memory.ld
  • core/embed/models/T2B1/memory.h
  • core/embed/models/T2B1/memory.ld
  • core/embed/models/T2T1/memory.h
  • core/embed/models/T2T1/memory.ld
  • core/embed/sys/linker/stm32f4/kernel.ld
✅ Files skipped from review due to trivial changes (6)
  • core/embed/models/D001/memory.h
  • core/embed/models/T2B1/memory.ld
  • core/embed/models/T2T1/memory.h
  • core/embed/models/T2B1/memory.h
  • core/embed/models/D001/memory.ld
  • core/embed/models/T2T1/memory.ld
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/embed/sys/linker/stm32f4/kernel.ld

Walkthrough

Kernel memory layout constants were updated across multiple embed models (D001, T2B1, T2T1) and an STM32F4 linker script: the kernel main stack size (K_MAIN_STACK_SIZE) was increased from 8 KiB to 10 KiB, and the AUX2 RAM region start was moved from 0x10002000 to 0x10002800 with corresponding reductions in AUX2_RAM_SIZE. Changes are limited to C header macros (memory.h) and linker scripts (memory.ld / kernel.ld). No control flow, interfaces, or other functional code were modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is minimal but provides context about fixing RSOD during bootloader update. However, it does not follow the repository's template structure with required sections like development status, assignment, project setup, or QA notes. Add development status section and clarify whether this requires QA testing. Consider following the template guidance for PR setup and post-merge status expectations.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary change: increasing stack size on F4 models, which is the main modification across multiple memory configuration files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tychovrahe/fix/tt_stack_overflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 25014717763

@TychoVrahe TychoVrahe force-pushed the tychovrahe/fix/tt_stack_overflow branch from 7f3d5d6 to 53c4f8d Compare April 27, 2026 11:59
@TychoVrahe TychoVrahe marked this pull request as ready for review April 27, 2026 12:14
@TychoVrahe TychoVrahe requested a review from cepetr April 27, 2026 12:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/embed/models/D001/memory.h`:
- Around line 108-109: AUX2 currently starts at 0x10002000 and overlaps the
kernel main stack; update the definition AUX2_RAM_START in memory.h from
0x10002000 to 0x10002800 (leave AUX2_RAM_SIZE unchanged) so AUX2 begins at the
end of K_MAIN_STACK (K_MAIN_STACK_START + 10 KiB), then regenerate the generated
linker file memory.ld so the symbol AUX2_RAM_START in that file is also
0x10002800.

In `@core/embed/sys/linker/stm32f4/kernel.ld`:
- Line 47: The linker script kernel.ld uses the nonconforming location-counter
syntax `. = +10K;`; update this to the project-standard `. += 10K;` so the stack
allocation line (the location counter expression in
core/embed/sys/linker/stm32f4/kernel.ld) matches other linker scripts
(stm32f4/stm32u5g/stm32u58) and preserves the intended 10K increment for the
stack.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8777d682-5775-4359-99b4-fa5254082d51

📥 Commits

Reviewing files that changed from the base of the PR and between e37d8e7 and 53c4f8d.

📒 Files selected for processing (7)
  • core/embed/models/D001/memory.h
  • core/embed/models/D001/memory.ld
  • core/embed/models/T2B1/memory.h
  • core/embed/models/T2B1/memory.ld
  • core/embed/models/T2T1/memory.h
  • core/embed/models/T2T1/memory.ld
  • core/embed/sys/linker/stm32f4/kernel.ld

Comment thread core/embed/models/D001/memory.h Outdated
Comment thread core/embed/sys/linker/stm32f4/kernel.ld Outdated
@TychoVrahe TychoVrahe force-pushed the tychovrahe/fix/tt_stack_overflow branch from 0eef21e to b426d72 Compare April 27, 2026 19:19
@TychoVrahe TychoVrahe merged commit 0c49e9e into main Apr 27, 2026
106 checks passed
@TychoVrahe TychoVrahe deleted the tychovrahe/fix/tt_stack_overflow branch April 27, 2026 20:09
@trezor-bot trezor-bot Bot moved this from 🔎 Needs review to 🤝 Needs QA in Firmware Apr 27, 2026
@Thalarion Thalarion moved this from 🤝 Needs QA to ✅ Done (no QA) in Firmware Apr 28, 2026
@romanz romanz linked an issue May 6, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Reproducible RSOD when updating Trezor T from older firmware

3 participants