SpenceKonde/DxCore

Menu with optimization level.

michpro opened this issue · 1 comments

It would be nice if it was possible to set the optimization level from the menu (-Os, -O0..03, -Og, -flto).

We tried that, but it wasn't compatible with the aggressive performance and flash size optimizations we use - nothing that used serial or interrupts would compile.

Also, the core is designedfrom the ground up to use link time optimization; Almost every file would have multiple places where "can't happen" conditions would be detected because without LTO, the compiler can't see that the codes is actually valid. Getting rid of LTO and making the core work afterwards would require almost starting de novo.

and what would the result of losing LTO be? Your binaries would be 20% larger.

So: I have tried and been unsuccessful at O2/O3 becuase it doesn't likethe optimization I used which on some parts cut the overhead of serial ports by a factor of 6. I don't know how or if it is possible to work around this without adverse impact on performance.

Considering that the optimizer is so bad at it's job... I don't think this is worth it. I'm happy to merge a working PR, but I do not even know that this is possible,