- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've spent the past 8 hours trying to read data from my host Windows PC using a C program running on NIOSII. And finally I found light with that Host File System business! I thought it would be good to share this with you because the settings are not that obvious, and I am sure there are many beginners like me who will struggle to find this on NIOSII SBT 10.1.
So here goes. Go to NIOSII->BSP Editor -> Software Packages -> altera_hostfs and enable it! It will tell you /mnt/host/ as default. Just leave it as such. Then copy your data file (e.g testb.txt) in the folder where the C code is. Next you can insert the following lines in your C code to read the file: FILE* finput; finput = fopen ("/mnt/host/testb.txt", "r"); and then run it in debug mode in NIOSII hardware. OK, now my other question is: How to enter data from the host PC to the NIOS CPU when not in debug mode? Is that possible? Or do I have to copy data first to a memory or sd card available on my development kit and then try to access it from the code?Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It may not possible to send file to CPU if it is not in the debug mode.
Just because this method is using gdb. This function only available when you use the debug mode.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- I've spent the past 8 hours trying to read data from my host Windows PC using a C program running on NIOSII. And finally I found light with that Host File System business! I thought it would be good to share this with you because the settings are not that obvious, and I am sure there are many beginners like me who will struggle to find this on NIOSII SBT 10.1. So here goes. Go to NIOSII->BSP Editor -> Software Packages -> altera_hostfs and enable it! It will tell you /mnt/host/ as default. Just leave it as such. Then copy your data file (e.g testb.txt) in the folder where the C code is. Next you can insert the following lines in your C code to read the file: FILE* finput; finput = fopen ("/mnt/host/testb.txt", "r"); and then run it in debug mode in NIOSII hardware. OK, now my other question is: How to enter data from the host PC to the NIOS CPU when not in debug mode? Is that possible? Or do I have to copy data first to a memory or sd card available on my development kit and then try to access it from the code? --- Quote End --- Hi I have a problem with the fopen, fclose, getc commands when I build my project, but I followed your instructions. Do you know what could be the problem? Did you have "small_c_library" enabled? Please help, i'm so desperate....

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page