the led roulette example misbehaves when compiled in release mode (+LTO)
japaric opened this issue · 2 comments
japaric commented
For example, this variation of the original example:
#[export_name = "main"]
pub extern "C" fn main() -> ! {
loop {
for led in LEDS.iter() {
led.on();
delay::ms(100);
led.off();
delay::ms(100);
}
}
}
when compiled in debug mode, produces the expected result: all the LEDs light on in a circular cycle.
But if the code is compiled in release mode, then only three, the "first" three, LEDs participate in the "circular" cycle.
This is the only example that misbehaves when compiled in release mode. It also happens to be only example that uses interrupts so perhaps that's the cause of the problem.
japaric commented
The problem seems to be the delay::ms
function. Let's try rolling that function back to use busy polling instead of interrupts.