Forum Discussion
Altera_Forum
Honored Contributor
14 years agoread a text file
Hi. I'm wondering if is possible to read contents from a text file in a NIOS2 software, either downloading that file to a SDRAM, or reading it from the hard disk via JTAG. is that possible...
Altera_Forum
Honored Contributor
14 years agoIf you are doing a real project, then you need to decide how the file will get onto the target system. If you are going to include it in the code/data image the just arrange for it to a data block and access as an array.
You can convert a text/binary file to an object file using 'objcopy', I think you need: objcopy -I binary -O nios2 -B nios2 mydata.txt mydata.oYou might want to add: --rename-section .data=.rodata.mydata,alloc,load,readonly,data,contents I use this to insert the code and data of by nios program into the data area of the ppc program that loads and interfaces with it. The ppc program is also linked with the symbol table of the nios program. This removes all the problems of mismatched versions!