This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
RE: how to retarget newlib printf scanf to embedded systemUART ?
- From: "Anil Paranjape" <AnilP1 at KPITCummins dot com>
- To: "wnlee at cad" <wnlee at cad dot csie dot ncku dot edu dot tw>
- Cc: <newlib at sources dot redhat dot com>
- Date: Tue, 10 Aug 2004 17:25:30 +0530
- Subject: RE: how to retarget newlib printf scanf to embedded systemUART ?
Hi Wayne,
Please refer to following link,
http://sources.redhat.com/newlib/libc.html#SEC195
>In order to retarget _read and _write syscalls, should we edit the newlib
>source, rebuild it, and rebuild a new toolchain for specified target?
No need to change newlib source code and to rebuild newlib.
If you include syscalls.c from ../newlib/libc/sys/arm/syscalls.c in your project and
if you change _read and _write functions then this new implementation will override on
its default newlib implementation.
I tested by adding syscalls.c into one project for ARM.
I am using gcc3.2 for ARM.
I could successfully compile syscalls.c with the same options specified by you
but didn't get any of the errors mentioned by you.
Kindly send me more details or modified syscalls.c.
Regards,
Anil Paranjpe
KPIT Cummins InfoSystems Ltd.
Pune, India
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH and H8 Series.
The following site also offers free technical support to its users.
Visit http://www.kpitgnutools.com for details.
Latest versions of KPIT GNU tools were released on June 1, 2004.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message-----
From: wnlee@cad [mailto:wnlee@cad.csie.ncku.edu.tw]
Sent: Sunday, August 08, 2004 8:40 PM
To: Anil Paranjape
Cc: newlib@sources.redhat.com
Subject: Re:how to retarget newlib printf scanf to embedded systemUART ?
Hi Anil,
After reading your post, I do the following steps.
0. cd $PROJECT_DIR
1. cp ../newlib-1.12.0/newlib/libc/sys/arm/syscalls.c
2. cp ../newlib-1.12.0/newlib/libc/sys/arm/swi.h
3. edit Makefile add syscalls.o
4. make clean;make
Then, I receives the followings error messages.
I guess that I fail to overwrite newlib syscalls with the copies in my ROM
code.
arm-elf-as -mzpcs-32 -mno-fpu -gdwarf2 -o vector.o vector.s
arm-elf-objdump -p -h vector.o > vector.o.objdump
arm-elf-readelf -a vector.o > vector.o.elf
arm-elf-as -mapcs-32 -mno-fpu -gdwarf2 -o init.o init.s
arm-elf-objdump -p -h init.o > init.o.objdump
arm-elf-readelf -a init.o > init.o.elf
arm-elf-gcc -Os -Wall -g -c -o main.o main.c
main.c: In function `main':
main.c:24: warning: implicit declaration of function `strlen'
arm-elf-objdump -p -h main.o > main.o.objdump
arm-elf-readelf -a main.o > main.o.elf
arm-elf-gcc -Os -Wall -g -c -o uart.o uart.c
arm-elf-objdump -p -h uart.o > uart.o.objdump
arm-elf-readelf -a uart.o > uart.o.elf
arm-elf-gcc -Os -Wall -g -c -o syscalls.o syscalls.c
syscalls.c:25: error: conflicting types for `_unlink'
/armtools/arm-elf/include/sys/unistd.h:129: error: previous declaration of
`_unlink'
syscalls.c:26: error: conflicting types for `_link'
/armtools/arm-elf/include/sys/unistd.h:125: error: previous declaration of
`_link'
syscalls.c:29: error: conflicting types for `_sbrk'
/armtools/arm-elf/include/sys/unistd.h:128: error: previous declaration of
`_sbrk'
syscalls.c:30: error: conflicting types for `_getpid'
/armtools/arm-elf/include/sys/unistd.h:124: error: previous declaration of
`_getpid'
syscalls.c:37: error: conflicting types for `_write'
/armtools/arm-elf/include/sys/unistd.h:130: error: previous declaration of
`_write'
syscalls.c:39: error: conflicting types for `_lseek'
/armtools/arm-elf/include/sys/unistd.h:126: error: previous declaration of
`_lseek'
syscalls.c:41: error: conflicting types for `_read'
/armtools/arm-elf/include/sys/unistd.h:127: error: previous declaration of
`_read'
syscalls.c:49: warning: `do_AngelSWI' declared `static' but never defined
make: *** [syscalls.o] Error 1
In order to retarget _read and _write syscalls, should we edit the newlib
source, rebuild it,
and rebuild a new toolchain for specified target?
Or we can just modified our ROM code to retagert _read and _write syscalls?
Why I got the above error messages ?
Do you have some idea according to your succesful porting experiences? :)
Wayne