Skip to content

Program freezes if compiled in debug mode. #528

Answered by Rahix
crmoratelli asked this question in Q&A
Discussion options

You must be logged in to vote

If, by debug build, you mean a build without optimizations, you are pretty much guaranteed to run into tons of issues. Due to the extremely limited amount of SRAM on AVR microcontrollers, we must rely on a lot of compiler optimizations to get the code into a shape whose memory footprint is small enough.
Otherwise, the stack will quickly grow too large and either corrupt statics or simply lead to an overflow.

Because of this, we usually configure the dev profile (that's cargo run) to also apply optimizations, similar to the release profile (cargo run --release). The relevant code is here:

avr-hal/Cargo.toml

Lines 1 to 11 in 2eb28fa

[profile.dev]
panic = "abort"
lto = t…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@crmoratelli
Comment options

@Rahix
Comment options

@crmoratelli
Comment options

@Rahix
Comment options

@crmoratelli
Comment options

Answer selected by crmoratelli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #527 on March 30, 2024 03:14.