This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Porting Newlib to Microchip's dsPIC series
Here is the file that gets built from "printf.c". It gets put in my
build directory under "pic30/newlib/libc/stdio/lib_a-printf.o". I see
no mention of the symbol "printf", just "printf_r" and "iprintf".
This is very strange because "iprintf" is not invoked directly
anywhere inside the file "printf.c". Does anyone know what is going
on?
lib_a-printf.o: file format coff-pic30
Disassembly of section .text:
Disassembly of section .libc:
00000000 <__printf_r>:
0: 02 00 fa lnk #0x2
2: 3f b9 97 mov.w [w15-10], w2
4: ea 81 57 sub.w w15, #0xa, w3
6: f3 bf 9f mov.w w3, [w15-2]
8: a0 00 90 mov.w [w0+4], w1
a: 00 00 02 call 0x0 <__printf_r>
c: 00 00 00
e: 00 80 fa ulnk
10: 00 00 06 return
00000012 <__iprintf>:
12: 02 00 fa lnk #0x2
14: 3f b9 97 mov.w [w15-10], w2
16: 00 00 80 mov.w 0x0, w0
18: ea 81 57 sub.w w15, #0xa, w3
1a: f3 bf 9f mov.w w3, [w15-2]
1c: a0 00 90 mov.w [w0+4], w1
1e: 00 00 02 call 0x0 <__printf_r>
20: 00 00 00
22: 00 80 fa ulnk
24: 00 00 06 return
On Sun, Feb 1, 2009 at 2:05 PM, Leo Singer <doc.aronnax@gmail.com> wrote:
> Dear Karolina,
>
> I have also patched most of the source files in libnosys, giving them
> __attribute__ ((weak)) so that routines like open, read, write, close,
> and lseek can be overridden by user code just as with the stock
> Microchip standard library.
>
> Can you find out if "printf" is defined anywhere in the libraries you
> made? If you go into the library containing the .a files, you can use
> the following command to find out:
>
> find . -name "*.a" -exec pic30-nm {} \; | grep '_printf'
>
> Thanks,
> Leo
>
> On Sun, Feb 1, 2009 at 1:42 PM, Karolina <karolina.lindqvist@kramnet.se> wrote:
>> lördagen den 31 januari 2009 skrev Leo Singer:
>>> Hey,
>>>
>>> I am porting Newlib to Microchip's line of 16-bit microcontrollers (I
>>> am using a dsPIC33FJ256GP710). The compiler is invoked using the name
>>> "pic30-gcc". I have some platform specific implementations of things
>>> like brk, sbrk, etc. Where should I put those?
>>>
>>> I put them in "newlib/libc/sys/pic30", and I think that I made my
>>> Automake and Autoconf files correctly (though it's my first time
>>> actually editing automake or autoconf files), but the source files
>>> that I added are not getting compiled.
>>>
>>> My "setjmp" and "longjmp", which I have placed in
>>> "newlib/libc/machine/pic30" are correctly getting built and linked.
>>>
>>> Thanks,
>>> Leo
>>
>>
>> I am trying exactly the same right now. I got the whole thing to build without
>> error, but now I got a little bit stuck with gcc, to get it to use the
>> correct paths for include/lib files etc. I got more work there than I
>> bargained for.
>>
>> And then I am not sure if not newlib gives just too much bloat, and it would
>> be better to use unix v7 libs, or something.
>>
>> Some things with newlib I find confusing. Some systems put system files in
>> libgloss/<systemname>, and others in libc/sys/<systemname>
>> I put them in libc/sys/pic30
>>
>> Files I have patched so far:
>> newlib/libc/include/machine/ieeefp.h
>> newlib/libc/include/machine/setjmp.h
>> newlib/libc/include/sys/config.h
>> newlib/libc/include/sys/stdio.h
>> newlib/libm/machine/configure.in
>> config/mt-pic30
>> config.sub
>> newlib/configure.host
>> newlib/libc/machine/configure.in
>>
>> But apart from making a clean build, it has to be integrated with all the
>> quirks of the PIC30 and tried out and get to work also. That is probably the
>> tough part.
>>
>> Karolina
>>
>>
>