For firmware development purposes, my code makes heavy use of asserts, primarily the standard library assert() macro because that is available on all platforms that my code has to support (Zephyr, PC, etc). Most of these shared libraries use C++, including the std headers
Recently we have shifted from the v2.3.x SDK to the 2.6.x SDK and this has been relatively problem free, but the handling asserts is causing issues. I'm currently unsure if this is an NCS / Zephyr / ... problem so starting here and will move down as required
The issue appears to be based around the move to picolibc which was one of the benefits which motivated the shifting forward of SDK versions and if possible we would like to not have to shift back to newlib
With newlib, the assert handler is a weak symbol so we can override that directly and have our custom handler store all the relevant details to deal with post reboot. picolibc has similar functionality but the toolchain / precompiled picolibc just drops all the relevant info in favour of smaller binary sizes (which is totally understandable but does make asserts a real pain to debug)
That seems reasonable, so we'll compile piclibc ourselves using the handy module so we can tweak the build options. Except the module doesn't include a C++ standard library so none of our library code compiles (it also doesn't have an obvious way of replacing the assert handler with our custom one?). Clearly it can handle a C++ build, because the toolchain version does so what am I missing?
Summary
- toolchain picolibc - no useful assert() logging at all
- module picolibc - no C++ std includes, how to override the full assert handler for custom reporting?
- newlib - larger, slower
It seems like the module version is almost what I require but the specifics of the required configuration are not obvious