1.
As title.
and what time I need to add options ?
I know add --specs=nano.specs thas is mean using newlib-nano when I use arm-none-eabi-gcc.
In readme, rdimon is for semihosting. Nosys is for retarget.
We use bare metal system and printf retarget to AXI port. What option I need to select ?
2. Does newlib support reentrant in arm-none-eabi-gcc?
Newlib provide two version function first is usual name . Second is reentrant version "_xxx_r"
How to choose the function when compile my code? Or I don't need know that.
Ex : _write_r , write
3. Are both of two function target to _write?
I implement _write function will retarget printf.
I not sure printf will call which function. _write_r , write, _write
1. nosys.specs, as your usage is retarget
2. it is not reenterable as some shared resources (heap managed by malloc/free) are not protected with locks or any mechanism.
3. _write_r will invoke _write. So retargeting _write should be enough.
A very quick answer based on knowledge in memory. Maybe wrong but further questions are welcome.
Hi Joey
Thank for your reply!
About 2 .
I study newlib and found an reentrant usage descriptions.
-----------------------------
Dynamic reentrancy is specified by the __DYNAMIC_REENT__ flag. This flag denotes setting up a macro to replace _REENT with a function call to __getreent().
---------------------------
Have you know arm-none-eabi-gcc defined this when build libraries?
About 1, 3 Like your reply
I summary some result in my study and take notes.
The specs file will change -l option and point to library in arm corss compiler folder. Ex libnosys.a libc_nano.a ...
And nosys library have some default OS interface function if we don't have implenment.
But I don't know rdimon library how to work with semihost.
3.
Retarget is modify _write because newlib porting OS interface have some usage. The descrition is in newlib reent.h.
The usage 2 is porting write -> _write_r -> _write.