This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: newlib PIC24/30 port


Karolina,

You might have noticed that many of the symbols in Microchip's
standard library are prefixed with __attribute__ ((weak)). This makes
it possible for user code to override standard library routines and
syscalls. At my company, we have a source file called "iosupport.c"
for each board that defines the open, read, write, and close routines.
Some of our boards have one UART, some have two, some have SD cards --
"iosupport.c" binds all of these different devices to the standard C
I/O routines. In my work with Newlib I've preserved this attribute for
most of the syscalls so that this is still possible.

In your case you could implement "write" by having it write the input
array byte by byte to the UART, for instance.

Leo

On Sat, Feb 7, 2009 at 3:15 PM, Karolina Lindqvist
<karolina.lindqvist@kramnet.se> wrote:
> tisdagen den 3 februari 2009 skrev Leo Singer:
>> Dear Karolina,
>>
>> It appears that I do have the "iprintf" symbol, but my linker insists
>> otherwise.  Do you know what is happening?  See below.
>
> No, I don't know. Try to give absolute paths to the libraries, since there is
> a bug in pic30-gcc, that makes it not understand paths on linux. I have a
> bugfix, but it is not cleaned out, but mixed with my other changes to
> pic30-gcc.
>
> I finally got some success using newlib on he pic30, after hours, and hours of
> finding and fixing gcc problems, and even more hours trying to get some sense
> out of the autobuild system for newlib, and finally giving up on libgloss,.
>
> $ cat test.c
> #include <stdio.h>
>
> int main()
> {
>        printf("Hello, world!\n");
>        return 0;
> }
> $ pic30-gcc test.c -msmart-io=0  -o test
> $ wine /usr/pic30/bin/sim30.exe
>
> This is the Microchip dsPIC30 simulator version [CLI v3.43.00.00]
> Copyright (c) 2005 Microchip Technology Inc. All rights reserved.
> Device: 'dspic30super'
> Instruction set version [ISA2 Rev A 2003/01/31]
> Program space:-
> [000000..03ffff] Program FLASH
> [7ff000..7fffff] Data FLASH
> [f80000..f8000d] Configuration Registers
> Data space:-
> [0000..ffff] X Data RAM
> [3000..ffff] Y Data RAM
> Simulated Peripherals:-
> HsAdc   Uart1   Uart2   Timer1  Timer2
> Timer3  Timer4  Timer5  IC1     IC2
> IC3     IC4     IC5     IOPortA IOPortB
> IOPortC IOPortD IOPortE IOPortF IOPortG
> KeySequenceEnable
> dsPIC30> lc test
> dsPIC30> rp
> dsPIC30> io nul out
> dsPIC30> e
> dsPIC30>q
> $ cat out
> Hello, world!
> $
>
> I don't know how to get the ouput to the screen, (stdout) instead of a to a
> file yet. At least newlib works on the pic30 now, which is a milestone for
> me.
>
> Next I will look into some other functions, like iprintf et. al, and some
> other missing functions.
>
> Karolina
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]