Skip to content

Add .uninit (NOLOAD) section to tb-app.x for defmt-rtt compatibility - #16

Merged
aq1018 merged 1 commit into
mainfrom
fix/tb-app-uninit-section
Apr 13, 2026
Merged

aq1018 merged 1 commit into
mainfrom
fix/tb-app-uninit-section

Conversation

@aq1018

@aq1018 aq1018 commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Problem

defmt-rtt places its buffer in .uninit.* sections and expects them to be NOLOAD (not included in the flash image). qingke-rt's link.x doesn't define a .uninit section, so the linker falls back to placing these symbols in a default loadable section with a RAM VMA (0x20000000+).

When wlink sees a loadable segment at a RAM address, it interprets the VMA as a flash offset and attempts to produce a binary spanning from 0x00000000 to 0x20000xxx. This results in a ~500MB output that fails to flash.

Fix

Define an explicit .uninit (NOLOAD) section in tb-app.x placed in RAM after .bss. The NOLOAD attribute tells the linker not to generate a load segment, so wlink only sees the actual flash content.

@aq1018

aq1018 commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

For reference, cortex-m/cortex-m-rt has a NOLOAD section here: https://github.com/rust-embedded/cortex-m/blob/master/cortex-m-rt/link.x.in#L175-L183

@aq1018

aq1018 commented Apr 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Related PR on qingke: ch32-rs/qingke#19.

We can revert this if/when qingke fixes this issue.

@aq1018
aq1018 merged commit 1ad034c into main Apr 13, 2026
6 checks passed
@aq1018
aq1018 deleted the fix/tb-app-uninit-section branch April 13, 2026 21:50
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