You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using rustc 1.85.0-nightly (45d11e51b 2025-01-01) I generated a project with this template for CH32V203 with the G8R6 pinout. Unfortunately, since no compiler flags overrides are defined for debug mode, this leads to the data sections being too large for the flash:
= note: rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 3664 bytes
rust-lld: error: section '.rodata' will not fit in region 'FLASH': overflowed by 3664 bytes
rust-lld: error: section '.data' will not fit in region 'FLASH': overflowed by 3712 bytes
rust-lld: error: section '.bss' will not fit in region 'FLASH': overflowed by 4240 bytes
Simply adding
[profile.dev]
opt-level = 's'
to Cargo.toml fixes this, without affecting compile times much. It would be nice if this was added to the template, since developers expect to be able to compile even embedded programs in debug mode for a faster development cycle, at least as long as they haven’t added too much code. Otherwise, I would add a warning about not using release mode to Cargo.toml or the README.
On that note, opt-level = 'z' (strong size optimization) should be considered for release mode. For the example program, without too much extra compile time it halves the code size from 10K to 5K, and decreases the read-only data size from 5K to just under 300 bytes.
The text was updated successfully, but these errors were encountered:
Using
rustc 1.85.0-nightly (45d11e51b 2025-01-01)
I generated a project with this template for CH32V203 with the G8R6 pinout. Unfortunately, since no compiler flags overrides are defined for debug mode, this leads to the data sections being too large for the flash:Simply adding
to Cargo.toml fixes this, without affecting compile times much. It would be nice if this was added to the template, since developers expect to be able to compile even embedded programs in debug mode for a faster development cycle, at least as long as they haven’t added too much code. Otherwise, I would add a warning about not using release mode to Cargo.toml or the README.
On that note,
opt-level = 'z'
(strong size optimization) should be considered for release mode. For the example program, without too much extra compile time it halves the code size from 10K to 5K, and decreases the read-only data size from 5K to just under 300 bytes.The text was updated successfully, but these errors were encountered: