Can nios_gnupro support file system?

J

Jasmine Hau

Guest
Hi, can any body explain to me does the nios_gnupro support any
functions that manage files or other input/output streams???
I am currently using the Altera Nios Developed Board during my
research which is Apex Device (EP20K200EFC484-2x). But i failed to
execute a very simple program which just consist of fopen and fclose
as follows:

#include <stdio.h>

main()
{
FILE *a;
a = fopen("simple.dat", "w");
fclose(a);
return 0;
}

i have compile this program using Visual Studio, and the
output is correct. But once i execute the nios-build in the Nios SDK
shell, it keep giving me the following errors:

in function `_open_r':
openr.o(.text+0x14): undefined reference to `_open'
openr.o(.text+0x16): undefined reference to `_open'
openr.o(.text+0x18): undefined reference to `_open'
openr.o(.text+0x1a): undefined reference to `_open'

Can anybody explain to me where is my problem? Thanks a lot and
wish you all have a nice day.
 
"Jasmine Hau" <hauyuanwen1980@yahoo.com> wrote in message
news:fc6016ce.0401152311.25e56b30@posting.google.com...
Hi, can any body explain to me does the nios_gnupro support any
functions that manage files or other input/output streams???
I am currently using the Altera Nios Developed Board during my
research which is Apex Device (EP20K200EFC484-2x). But i failed to
execute a very simple program which just consist of fopen and fclose
as follows:
Where are you expecting this file to be? Which operating system is running
on the Nios, and providing access to a file system? File access is a
service that needs to be provided by an operating system, or emulated in
some way - without that, the program has no more chance of openning a file
than it has of drawing a window on the screen.

Functions such as fopen and fclose are required parts of the standard c
library, but since there is no sensible way to implement them on most
embedded systems, they are often stubbed out (i.e., they do nothing, as is
the case for fclose), or are missing entirely from the library files (as is
the case for _open).


#include <stdio.h

main()
{
FILE *a;
a = fopen("simple.dat", "w");
fclose(a);
return 0;
}

i have compile this program using Visual Studio, and the
output is correct. But once i execute the nios-build in the Nios SDK
shell, it keep giving me the following errors:

in function `_open_r':
openr.o(.text+0x14): undefined reference to `_open'
openr.o(.text+0x16): undefined reference to `_open'
openr.o(.text+0x18): undefined reference to `_open'
openr.o(.text+0x1a): undefined reference to `_open'

Can anybody explain to me where is my problem? Thanks a lot and
wish you all have a nice day.
 
David Brown wrote:

"Jasmine Hau" <hauyuanwen1980@yahoo.com> wrote in message
news:fc6016ce.0401152311.25e56b30@posting.google.com...


Hi, can any body explain to me does the nios_gnupro support any
functions that manage files or other input/output streams???
I am currently using the Altera Nios Developed Board during my
research which is Apex Device (EP20K200EFC484-2x). But i failed to
execute a very simple program which just consist of fopen and fclose
as follows:




Where are you expecting this file to be? Which operating system is running
on the Nios, and providing access to a file system? File access is a
service that needs to be provided by an operating system, or emulated in
some way - without that, the program has no more chance of openning a file
than it has of drawing a window on the screen.

Functions such as fopen and fclose are required parts of the standard c
library, but since there is no sensible way to implement them on most
embedded systems, they are often stubbed out (i.e., they do nothing, as is
the case for fclose), or are missing entirely from the library files (as is
the case for _open).



In many embedded system, a memory file system is used.
MicroBlaze and EDK is shipped with a memory file system.

Göran Bilski

#include <stdio.h

main()
{
FILE *a;
a = fopen("simple.dat", "w");
fclose(a);
return 0;
}

i have compile this program using Visual Studio, and the
output is correct. But once i execute the nios-build in the Nios SDK
shell, it keep giving me the following errors:

in function `_open_r':
openr.o(.text+0x14): undefined reference to `_open'
openr.o(.text+0x16): undefined reference to `_open'
openr.o(.text+0x18): undefined reference to `_open'
openr.o(.text+0x1a): undefined reference to `_open'

Can anybody explain to me where is my problem? Thanks a lot and
wish you all have a nice day.
 
"Goran Bilski" <goran@xilinx.com> wrote in message
news:bu8bn1$kao1@cliff.xsj.xilinx.com...
David Brown wrote:

"Jasmine Hau" <hauyuanwen1980@yahoo.com> wrote in message
news:fc6016ce.0401152311.25e56b30@posting.google.com...


Hi, can any body explain to me does the nios_gnupro support any
functions that manage files or other input/output streams???
I am currently using the Altera Nios Developed Board during my
research which is Apex Device (EP20K200EFC484-2x). But i failed to
execute a very simple program which just consist of fopen and fclose
as follows:




Where are you expecting this file to be? Which operating system is
running
on the Nios, and providing access to a file system? File access is a
service that needs to be provided by an operating system, or emulated in
some way - without that, the program has no more chance of openning a
file
than it has of drawing a window on the screen.

Functions such as fopen and fclose are required parts of the standard c
library, but since there is no sensible way to implement them on most
embedded systems, they are often stubbed out (i.e., they do nothing, as
is
the case for fclose), or are missing entirely from the library files (as
is
the case for _open).



In many embedded system, a memory file system is used.
MicroBlaze and EDK is shipped with a memory file system.

Göran Bilski
Yes, that's the most common way to implement working file functions on
embedded systems without a reasonably complete OS with a real file system
somewhere. The file functions are simply implemented in library functions.
I don't know if there are such library functions in the Nios kit - I haven't
looked at everything on it yet.




#include <stdio.h

main()
{
FILE *a;
a = fopen("simple.dat", "w");
fclose(a);
return 0;
}

i have compile this program using Visual Studio, and the
output is correct. But once i execute the nios-build in the Nios SDK
shell, it keep giving me the following errors:

in function `_open_r':
openr.o(.text+0x14): undefined reference to `_open'
openr.o(.text+0x16): undefined reference to `_open'
openr.o(.text+0x18): undefined reference to `_open'
openr.o(.text+0x1a): undefined reference to `_open'

Can anybody explain to me where is my problem? Thanks a lot and
wish you all have a nice day.
 
Hi,I am currently doing research on the Elliptic Curve Cryptosystem
(ECC) on Smart Card Prototype.
I will build a ECC Smart card prototype and download the
entire design into Altera FPGA APEX Device which is EP20K200EFC484-2x.
This prototype does not have an embedded OS. To test and verify my
design, I will build a testbench for Elliptic Curve Digital Signature
and ECC-based Mutual Authentication.
Currently, the Operating System on my PC is Windows2000 with
NTFS File System. My Altera Nios Development Board communicates with
the PC through UART. To build the testbench, i need to write a
software which will be built and run on the Nios SDK shell and able to
do the following functions:
1. Open a new file or read a existing file (plain-text) in the
Operating System Windows2000 environemnt in my PC.
2. The file will be sent from my PC to my Smart Card prototype
through UART.
3. The file (plaintext) will be processed in my Smart Card
prototype to create a Digital Signature.
4. Both of the original file (plaintext) and the digital
signature will then sent back to PC from smart card prototype through
UART.

My question is: Does the Nios-gnupro support the file access
system such as fopen, fprintf, fclose? I have written a simple program
which is able to run on Visual Studio but can't execute while in
nios-build process. I wonder does the Nios-gnupro support the file
access system. Thanks for your reply. Wish you all have a nice day.
 
"Jasmine Hau" <hauyuanwen1980@yahoo.com> wrote in message
news:fc6016ce.0401161933.778f4654@posting.google.com...
Hi,I am currently doing research on the Elliptic Curve Cryptosystem
(ECC) on Smart Card Prototype.
I will build a ECC Smart card prototype and download the
entire design into Altera FPGA APEX Device which is EP20K200EFC484-2x.
This prototype does not have an embedded OS. To test and verify my
design, I will build a testbench for Elliptic Curve Digital Signature
and ECC-based Mutual Authentication.
Currently, the Operating System on my PC is Windows2000 with
NTFS File System. My Altera Nios Development Board communicates with
the PC through UART. To build the testbench, i need to write a
software which will be built and run on the Nios SDK shell and able to
do the following functions:
1. Open a new file or read a existing file (plain-text) in the
Operating System Windows2000 environemnt in my PC.
2. The file will be sent from my PC to my Smart Card prototype
through UART.
3. The file (plaintext) will be processed in my Smart Card
prototype to create a Digital Signature.
4. Both of the original file (plaintext) and the digital
signature will then sent back to PC from smart card prototype through
UART.

My question is: Does the Nios-gnupro support the file access
system such as fopen, fprintf, fclose? I have written a simple program
which is able to run on Visual Studio but can't execute while in
nios-build process. I wonder does the Nios-gnupro support the file
access system. Thanks for your reply. Wish you all have a nice day.
I think you are confusing the issues here quite significantly. The OS you
have on your PC is basically irrelevant - when I asked what OS you had, I
meant what OS your embedded processor is running - and the answer is none.
So unless you implement (or find) functions to create a virtual file system
in the Nios's local memory, then it has no fopen, etc., functions. Even
with such memory-based file access, it would not give you what you want.

Forget file access for the Nios - it is not what you are looking for. You
need something running on the PC which accesses files there, and sends them
through the UART to the Nios board. The Nios program must take its data
from the UART, not through fopen, and send its results back through the
UART. Unless you need the Nios program to be able to choose the files
itself, you can probably do this using a simple terminal program on the PC
(maybe the nios-run terminal, or download something like Tera Term Pro or
RealTerm). If you need more than that, you can write a PC program to handle
the file access and send data back and forth across the UART.
 

Welcome to EDABoard.com

Sponsor

Back
Top