You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider using the circuitpython/lib/libm math library instead of -libm to save space #325
The atmel-samd boards currently use -libm. This is supplied as part of glibc in the arm-none-eabi toolchain. Various functions there such as powf and sqrtf end up using the double-precision float arithmetic routines (__aeabi_dadd, dsub, etc.), which occupy a few thousand bytes.
There is an alternate simpler libm which is in our source tree which does not use doubles and is simpler in other ways. It's used for some other ports, including esp8266. I assume it might be numerically different as well, probably less precise.
When I tested switching atmel-samd to use the libm in our tree instead of -libm, the Gemma M0 firmware got smaller by 8780 bytes (!). This would give us the freedom to add a lot more stuff to the non-Express boards, and completely solves the current space squeeze (e.g., #322).
@tannewt@ladyada Do you have an opinion on this? Should we try to use the same libm across all atmel-samd boards (the size matters less for Express and M4).
The internal libm needs some work to remove compile warnings. Our -Werror errors out on all warnings.
Gemma build using internal libm, complex arithmetic turned off, and -finline-limit disabled has 8312 bytes free.
Adding back complex uses 1576 bytes.
Re-enabling -finline-limit=50` (as an example) gains back about 1900 bytes, so there is headroom to use that again if necessary.
We could enable other stuff that might be useful even in small builds: #193 (MICROPY_PY_ARRAY_SLICE_ASSIGN, turned off in both builds), reversed(), etc. That's another discussion.
Turning on pulseio takes uses 7168 bytes, bringing free bytes down to 1092. Substantial, but it fits! I'll turn that on and add it to the pull request or make a separate one.
its worth it for sure, we can work around SLICE or reversed(), but if we dont have pwm support, we can't do servos, LED dimming, and a bunch of other things!
Limor suggested just the smaller builds, but happy to be consistent. Might be easier to support and test. I'll try to fix #331 before the merge anyway.
Activity
ladyada commentedon Oct 14, 2017
!!!! lets try libm for gemma/trinket/non-exp for now since its the most useful!
dhalbert commentedon Oct 15, 2017
Gemma build using internal
libm, complex arithmetic turned off, and-finline-limitdisabled has 8312 bytes free.Adding back complex uses 1576 bytes.
Re-enabling -finline-limit=50` (as an example) gains back about 1900 bytes, so there is headroom to use that again if necessary.
We could enable other stuff that might be useful even in small builds: #193 (
MICROPY_PY_ARRAY_SLICE_ASSIGN, turned off in both builds),reversed(), etc. That's another discussion.ladyada commentedon Oct 15, 2017
#1 most useful thing in small builds would be pwm/timer support.
dhalbert commentedon Oct 15, 2017
Turning on pulseio takes uses 7168 bytes, bringing free bytes down to 1092. Substantial, but it fits! I'll turn that on and add it to the pull request or make a separate one.
ladyada commentedon Oct 15, 2017
its worth it for sure, we can work around SLICE or reversed(), but if we dont have pwm support, we can't do servos, LED dimming, and a bunch of other things!
ladyada commentedon Oct 15, 2017
(if ya toss me a uf2 i will do a bunch of testing!)
dhalbert commentedon Oct 15, 2017
gemma and trinket uf2's attached in a zip
pulseio-uf2-gemma-trinket.zip
dhalbert commentedon Oct 16, 2017
Limor suggested just the smaller builds, but happy to be consistent. Might be easier to support and test. I'll try to fix #331 before the merge anyway.
tannewt commentedon Oct 16, 2017
Turn on pulseio now that there's room.
dhalbert commentedon Oct 16, 2017
Accomplished by #329.