-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-O2 breaks this lib on atmel M0 #102
Comments
Note -O1 works fine |
Was able to bisect down the optimizations 2 adds, this also repros the bug. I'm guessing this is likely a bug in GCC now that I look at those flags, its probably not repurposing a register properly for an inlined function. What is interesting is that by default the system is compiling with reference gcc manual |
thats unfortunate but....not sure what it could be. what if you de-inline any functions, does that help? |
could you confirm if the issue reproducible with Arduino IDE by changing the -Os to -O2 option here (there are 3 occurrences) |
@ladyada it appears to be the transfer function, forcing that to not be inlined fixes it
|
Dug a bit deeper through the ASM, looks like its specifically the calls to
This is the from the .s dump @ line 121 (test build config changed the line to this from 462 in original report)
Note there is another call right before this one and its fine, but if the parser is going from reverse then this is not-helpful.
Further debugging, looking into the ARMv6 ISA posted here. I think I figured out the error Section A6.7.65 (pg 164) So back to blaming gcc unfortunately. |
erk - im ok with forcing a non-inline attribute, can we by chance #ifdef that for the gcc version? |
Sure, I can test that out, I'll also see if I can bisect the affected range since platformio makes adjusting toolchains easy |
ok please note we do not have CI or testing for platformio so basically just make sure it passes the actions CI for arduino :) |
Latest gcc on platformio is also broken
I'll try and build gcc from source later this week on GCC 11 and 12 and see if its fixed there, otherwise i'll report upstream |
Unable to repro on So it looks like the gcc toolchain needs to be updated for the board, i don't even see that in homebrew formulas yet so i don't expect it to be for a bit. Thankfully my project is not blocked by this (my project was slow because I was doing way too much float math on an itsybitsy_m0, which i have removed). |
Note I checked the asm dump in my test and the second call was using |
is the toolchain v defined in platformio - e.g. do you see the same issue in arduino ide? |
Will test when I have time, but I believe it inherits the same toolchains from the Arduino bsp as it tries to reuse as much as possible |
Arduino board: itsy bitsy m0
Arduino IDE version (found in Arduino -> About Arduino menu): platformio 6.0.2
List the steps to reproduce the problem below (if possible attach a sketch or
copy the sketch code in too):
Use the following build config and try and use the BusIO library
main.cpp
build output (dirty build to reduce length)
The text was updated successfully, but these errors were encountered: