Bare metal support with NOVAS_NO_LIBC flag#330
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
a3112f6 to
7833e60
Compare
|
I might try to get this to run on some real hardware in a bit just to play with it - but testing the size, the unlinked static archive compiled for an RP2350 microcontroller is only 262 KB of flash with 5.4 KB of RAM usage, which is really really good. In a real application, DCE will bring this even lower. Also, the lunar and high-precision nutation functions are ~50% of the total binary size. |
|
Hi Kiran, yes, it's a pretty compact library, with very little in the way external deps (especially once you get rid of libc). Nutation and the Moon models have relatively large data tables with ~15,000 sets of coefficients each, so it's expected they should take up a big chunk of the compiled code. One comment I have is that unlike the C++, or the CALCEPH options, which are add-on options to the typical build, the LIBC option should be an explicitly subtractive option. So, I'd suggest to use naming accordingly, either as |
|
Hi @kiranshila, I wanted to ask your opinion about having the |
dfe5b43 to
ee41396
Compare
Makes sense! I'll update that then. |
Yeah because they're scoped appropriately I don't see the issue I think? |
|
Hi Kiran, I plan to merge this tomorrow, unless you want me to hold off until you do your bare metal testing. (I'm not in any rush, but I also don't want to delay it for no reason.) ;-) |
ee41396 to
e4da00f
Compare
- Add WITHOUT_LIBC=ON build mode for bare-metal/WASM targets without libc file I/O, heap, or system clock - Add NOVAS_NO_SYSTEM_CLOCK build flag for targets without system clock - Add pluggable trace/error message handler (novas_set_error_handler) - Fix is*() functions to cast to unsigned char - Remove spurious stdlib.h includes - Fix novas_set_catalog() NUL-termination - CI: add embedded ARM cross-compile build (WITHOUT_LIBC=1)
e4da00f to
1baaf59
Compare
|
Alright give this a check again, I think I switched enough things after mucking with the rebase |
attipaci
left a comment
There was a problem hiding this comment.
Looks good. Thanks Kiran!
Summary
Adds the
NOVAS_NO_LIBCpreprocessor flag and theENABLE_LIBC(c)make option to set it, conditionally turning off all the libc and stdlib stuff not typically available on bare-metal platforms.Fixes
is*()functions need unsigned chars and passing char is technically UB for non-ASCII input (caught in -Werror on ARM)