luni
Well-known member
From time to time weird issues and workarounds pop up when using the STL with Teensies. Latest examples:
Simon.M found that switching to optimizer setting "smallest code" fixes some of those issues. This setting not only sets the -Os flag but also changes the used c-library from new-lib to nano-lib which fixes the issue regardless of the -Os setting.
Besides handling the STL much better than new-lib, nano-lib also dramatically reduces the memory footprint for sketches using the STL. E.g. on a T3.2 the simple deque code from the linked deque post above uses some 28% flash with new-lib and only 3% with nano-lib. I'm aware that, by default, nano-lib deactivates float support for printf but that is easy to activate by using --specs=nano.specs -u _printf_float. With activated float support the example needs about 7% flash which is still only a quarter of the new-lib version.
So, my question is: are there any disadvantages of nano-lib vs new-lib? If not, would it be feasible to switch to nano-lib by default?
Simon.M found that switching to optimizer setting "smallest code" fixes some of those issues. This setting not only sets the -Os flag but also changes the used c-library from new-lib to nano-lib which fixes the issue regardless of the -Os setting.
Besides handling the STL much better than new-lib, nano-lib also dramatically reduces the memory footprint for sketches using the STL. E.g. on a T3.2 the simple deque code from the linked deque post above uses some 28% flash with new-lib and only 3% with nano-lib. I'm aware that, by default, nano-lib deactivates float support for printf but that is easy to activate by using --specs=nano.specs -u _printf_float. With activated float support the example needs about 7% flash which is still only a quarter of the new-lib version.
So, my question is: are there any disadvantages of nano-lib vs new-lib? If not, would it be feasible to switch to nano-lib by default?