A lot of times when an individual tells you that language X is “better” at something they truly suggest that it has far better created-in libraries for that undertaking. Java is a fantastic illustration. The language is not all that various from C++ outside of garbage assortment and several inheritance, but the normal libraries are tremendous potent, primarily for networking. Even C relies on a library to give a whole lot of capabilities people today feel of as section of the language —
printf, for instance. That is not genuinely portion of the C language, but just aspect of the normal library. When you are composing for a little processor, the option of library is crucial and [Keith Packard] features you one option: picolibc.
The library has its genesis from two other diminutive libraries: Newlib and the AVR model of libc. It presents help for ARC, ARM, i386, m68k, MIPS, MSP430, Nios II, PPC, RISC-V, Sparc64, x86_64, and the ESP8266/ESP32.
There is documentation for how to graft the library into your initiatives. That contains a several APIs that it expects from the working atmosphere. There are also paperwork on how the library works by using thread regional storage, locking, and other specialized facts.
Is it far better than other choices? Which is not for us to say. You will have to develop it on your exact system and make your possess comparisons. Nevertheless, it is a feasible prospect and because it is primarily based on newlib, it must be quite stable. You can discussion if you should use
printf, or not. Or you can just lean into it. But you can also use other elements of the library with out delving into
Even if you don’t require a little library, occasionally reading through by library code for your preferred focus on can be illuminating. For instance, how would you generate an effective
strchr function? Now, glance how they did it. Portability is the satan here because you could probably do even improved with some CPU-specific directions like AVX2 or SSE.
Title graphic courtesy [Priscilla Du Preez]