avr-rust/ruduino

Come up with some way to instruct LLVM that all PORT/DDR registers are zeroed at startup

dylanmckay opened this issue · 3 comments

At the top of main, we should be able to assume that all PORT/DDR registers are zeroed.

This should let LLVM optimise RMW OR/AND/NOT instructions into a simple assignment.

Maybe a macro that expands to something like

llvm::assume(PORTB::read() == 0);
...

We could tell all users to insert this into the top of main.

all PORT/DDR registers are zeroed.

And that's true on soft restarts too?

Perhaps there could be a compiler flag to insert that, too.