Hi, I have been using the Yagarto tools to program the AT91SAM7S embedded Evaluation Kit. From version 4.3.2 to version 4.3.3 they changed the newlib as folows : !!! This version of YAGARTO was built to support newlib with reentrant stubs !!! I have a few questions on this : 1. Why did they do this ?. 2. Why use reentrant stubs which seem to only interface to a piece of code which you want to use. Why not use the procedure in its entirity ?? 3. I think i can answer question 2 but not sure - it is to stop multiple copies of the functions sprintf for example being created in the program, and hence reduces overhead. Can anyone confirm that i am correct in this ? Thanks. 4. If they were going to use stubs for reentrant code - why did they state : To make your life easier, an example "syscalls.c" can be find here: http://www.yagarto.de/download/yagarto/syscalls.c Where they have provided EXAMPLE syscalls.c. Why not just provide the definitive code for all to use without having to worry about it themselves ??? From what i can determine, you need to be very proficient in C and the details of how the compiler works and the interdependencies of the libraries. I think that a novice in this area would be confused as i am. Regards, Richard.
Sure but thats the way programming works. yagarto is a free toolchain. If you want more you will have to buy a comercial toolchain.
/EDIT It's on to you to change this if you want.
Hi Tilo, Thanks for the reply. I just wondered why they did what they did in 4.3.3 and yet 4.3.2 was OK. The sprintf function works on the embedded design, so i am perhaps confused at the mention of stubs thinking that the sprintf function would not work and i had to provide some interfacing. Regards, Richard.
I haven't used newlib very often because it makes no sense to use it in small uC projects. Afaik the reentrant versions are needed to make newlib thread-safe.
Most of your questions wer probably answerd on teh other thread you tacked your question onto: http://embdev.net/topic/133927 > > 1. Why did they do this ?. > The stubs are implemented to map teh library to your hardware. > 2. Why use reentrant stubs which seem to only interface to a piece of > code which you want to use. Why not use the procedure in its entirity ?? > C has a global errno variable. In modern implementation it is not really a variable but a macro. In multithreaded code you need an errno value for each thread, otherwise you might test its value in one thread when it was set by another. The renetrant stubd allow you to inplement the necessary code for thread local storage. That's one reason. > 3. I think i can answer question 2 but not sure - it is to stop multiple > copies of the functions sprintf for example being created in the > program, and hence reduces overhead. Can anyone confirm that i am > correct in this ? Thanks. > That is nothing to do with it. > 4. If they were going to use stubs for reentrant code - why did they > state : > > To make your life easier, an example "syscalls.c" can be find here: > > http://www.yagarto.de/download/yagarto/syscalls.c > > Where they have provided EXAMPLE syscalls.c. Why not just provide the > definitive code for all to use without having to worry about it > themselves ??? > Because not everyone's hardware is the same. Most embedded systems use proprietary hardware, even if they were initially developed on an evaluiation or dev board. You need to be able to adapt the library to work on any platform. > From what i can determine, you need to be very proficient in C and the > details of how the compiler works and the interdependencies of the > libraries. > Maybe. Better documentation for Newlib would help, with some more realistic examples for different situations. > I think that a novice in this area would be confused as i am. > If you are using off-the-shelf hardware and the work has already been done, you have it easy. The first time I used Newlib was on entirely in-house hardware for a ARM9 microcontroller that had no existing BSP package. Clifford
hi Richards, i try to build my project with your syscalls file but when i have this error [c]-IC:\PROGRA~1\yagarto\arm-none-eabi\include -I./inc src/syscalls.c -o src/syscalls.o src/syscalls.c:12:19: fatal error: uart0.h: No such file or directory compilation terminated. make: *** [src/syscalls.o] Error 1[c] Can you tell me where i could find this header file?? because i don't find it in the include folder of Yagarto Best Regards Mini,
Please do not post in such an old thread. Next time open a new thread with your question. The answer to your question: there are different methods to implement syscalls. The easiest method is to hard-code the input and output to the underlaying hardware directly into the syscall-function. Since the underlaying hardware is system-specific you have to look what functions the syscall-code expects (something like uart0putc oder uart0getc) and implement these functions so they access the uart of your controller. I don't know the syscall-implementations which came with Yagarto but as far as I know Michael Fischer provides example Applications for some controllers which you can use as template to adapt the code to your target. An alternative method is to use a set of functions-pointers so the syscall-code itself is not hard-bound with a single device like uart0. An example how to do this can be found in the newlib-lpc code which is rather old but shows the basic idea.