|
Message
From: Gy?rgy 'nog' Jeney<nog@s...>
Date: Fri May 20 17:41:46 CEST 2005
Subject: [openrisc] using stdio.h functions with or1ksim
> I'm linking the application with newlib. The fopen/fread/fclose > symbols get resolved by the linker, but a lot of other external symbols > from newlib remain unresolved. The unresolved symbols look like > _lseek_r, _read_r, _sbrk_r, _fstat_r, ... I assume that those functions > must be provided by some OS, for example uclinux.
The underlying implementation (what comunicates with the hardware) is provided by uclinux or linux, which newlib calls via syscalls. Though you don't need to link in the os kernel for the symbols to resolve. This is probably the annoying linker issue discussed many times before. See:
http://www.opencores.org/forums.cgi/openrisc/2005/05/001455
> But, is there a > library that with the support of or1ksim can provide that functionality?
See below.
> I have tried to implement those symbols with 'l.sys' instructions > (using the syscall numbers from uclib/uclinux), but the or1ksim simply > jumps to the SYSCALL vector address, and there is nothing there... ;-)
That's exactly what it's meant to do. It's what the arcitechture defines. It's up to the openrisc code located at the SYSCALL vector (0xc00) to figure out what the meaning of the syscall is and act inacordance.
> I also have looked to the or1ksim source to see if it emulates the > syscalls but found nothing (there seems to be an obsolete #define > ONLY_VIRTUAL_MACHINE).
Syscalls (the l.sys instruction) are emulated just fine.
> So, in summary: is there an easy way to use > fopen/fread/fclose/printf/... under or1ksim? One way i see is to > somehow communicate with the outside world via the emulated serial port > of or1ksim, but that's not trivial...
There are the `report' and `printf' `nop' `instructions' provided by the sim, which may or maynot be what you're after. The testbenches use them quite abit (check out the files under or1ksim/testbench on how to use them). Or you could just run the entire (uc)linux kernel and run your code from there...
nog.
|
 |