Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

how to send a file to fpga through jtag uart?

Altera_Forum
Honored Contributor II
3,506 Views

hi,everyone! i want to sent the file (for exmple a.dat)of host through the jtag uart to the sdram,which in up3 board.i have get some exmples as for the message sent by uart to host,not the file. 

but,how can i to cope with it?can someone give the source code for it?thank you !
0 Kudos
12 Replies
Altera_Forum
Honored Contributor II
1,542 Views

Hi liannunu, 

 

> i want to sent the file (for exmple a.dat)of host through the jtag uart to the sdram 

 

This was possible with nios-console (Nios-32) via the stdio window. But I don't think it's 

available for Nios II (nios2-console). Regardless, you can still use the nios2-console 

load command to load a bin, hex, or srec file from your host machine to Nios II memory. 

 

E.g.: load file a.dat to address 0x1000: 

 

1> load bin 0x1000 a.dat 

 

This may not be quite what you want, but it may give you some of the capability you need. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

If you're using >=5.0, you can use the hostfs filing system. The limitation being that it only functions when in Debug mode. It's now a part of the rozipfs example software template. 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

thank you for your reply.however,i still have some questions about it 

 

--- Quote Start ---  

E.g.: load file a.dat to address 0x1000: 

1> load bin 0x1000 a.dat 

 

 

and do i need input the the path and the a.dat .if i want to seng several files for example 3,what should i do?i guess that to make the command line three times?meanwhile,i want to send these files to sdram in up3,but the command line have nothing about the destination?such as sdram,flash or fpga? 

 

in the reply of slacker's,whether the hostfs filing system is the" /mnt/rozipfs"?if so ,i want to send these files to sdram in up3,  

can the the hostfs filing system implement sending three files at a time?i use the nios 1.1now,i only to see the altera zip read only file system,does ti result from the version 1.1? 

thank you all the same!
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

hostfs is not supported in v1.1. You would need, at least, v5.0. I'd recommend upgrading anyway... Once you've done this, you'll see that the example now contains a mount point of "/mnt/hostfs". 

 

Best Regards, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

thank your reply! i have met a new question on the example now contains a mount point of "/mnt/hostfs" tonight,while i run as the nois hardware ,and the properties of the syslib in which i set all the auto-generated linker script to sdram,at last the console reported  

"verified ok 

leaving target processor paused." 

 

in the side of the console ,the only first result of the argument of printf() can be executed and paused . 

 

may i get some information about it?i guess that is possible to have some problems on the quartus project ? 

thank you all the same!
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

hi,,while i build the project of hostfs,the ide reported the warning:error launching external scanner info generator(make -s -c debug listincludedirs) 

what does it means? 

thank you very much
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

dear friends , 

 

iam having NIOS II 5.0v , my target board is (cyclone)UP3 board , i had seen ur discussion on Filesystems ,  

 

i had tried to use HOSTFile system in NIOS II IDE , but iam not sucessfull in it , 

 

IS there any option to be enable while creating .bdf file , 

 

I have components in SOPC builters such as (Jtag-uart , sdram,sram,..)but i didnt have included UART(Rs232),  

 

As per the Help contents in NIOSII IDE , i enabled the option  

 

systemlib->system componets ->Host file system ..... 

 

 

but iam not posible to read and write .I even created the specified file (read.txt and write,txt)in the workspace , for read and write .. but iam not possible to successed . 

 

 

i have another doubt , HostFs is not possible to perform in Run mode only in Debug mode means , 

 

then what is the use ... 

 

then what is the difference b/w run and debugg mode in Nios II IDE  

 

 

eagerly waiting for the reply. 

 

regards , 

Murugan.b
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

As per the comments in the rozipfs example/template, hostfs only works when debugging in the IDE. You've got to actually be debugging, not just running. 

 

I have tested this feature on many boards/architectures. The only requirement is a functional JTAG Debug connection to your host. 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

Thanks Slacker , 

for ur reply , As if u told HOsfs have to work only in debugging mode , 

 

even in debugging mode also for me it is not working , 

 

After Debugging Icon is pressed every thing goes fine , It doesnt shows any error but from file data is not read or created . 

 

I have installed Quartusv5.0 in Windows NT, not in unix or linux OS , 

 

Is HOST filesystem works for u in windows..  

 

 

Actually my design contains all memory elements also ... 

 

 

 

can u reply me with the procedure how u created the file and print from the file to NIOS II IDE console. 

 

 

regards , 

Murugan.b
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

Before responding to the heart of your question, are you able to debug/run most software? Is it only hostfs that you have issues with? 

 

All of the documentation you need is contained within the rozipfs software template, shipped with the kit. I don't think I can provide anything further than what this documentation already does. 

 

I'm currently running the following tool versions: 

 

Quartus II: 5.0SP1 

Nios II: 5.01 

 

The hostfs part of the "zip filesystem" example has worked in every version of the tools since v5.0. 

 

If you decide that this can't work for you, I'd advocate using the following to read/write files onto your target: 

 

Read => cat <filename> | nios2-terminal 

Write => nios2-terminal >& terminal.log 

 

Or a combination of the two... 

 

cat <filename> | nios2-terminal >& terminal.log 

 

You could write more elaborate scripts/code using pipes going into and out of nios2-terminal. 

 

Best Regards, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

Or a combination of the two... 

 

cat <filename> | nios2-terminal >& terminal.log 

 

You could write more elaborate scripts/code using pipes going into and out of nios2-terminal. 

 

 

The above is OK if batch style IO is acceptable.  

Do you know if it is possible to use the IO redirection tricks above to allow an existing windows terminal app to talk (tx and rx) over the jtag uart? 

 

The all the redirection examples I have seen, the data flow is one-way only. 

I am thinking that you would need something like a virtual serial port.
0 Kudos
Altera_Forum
Honored Contributor II
1,542 Views

Hi 

I record a tutorial on how to mount text file using NIOS II Processor and hostfs feature which enables us to mount files (such as text file) and perform read and write operation on that file 

http://youtu.be/kbicxwtfbiy (http://youtu.be/kbicxwtfbiy)
0 Kudos
Reply