- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am interested in build the following environment through Nios II.
Through a proper Qsys system, i.e., JTAG included, it is possible to use printf commands to be echoed in the Nios Console. Based on this, I suppose it is possible to redirect the standard output to a file and use the fprintf command to register some results I am looking for inspect during some loops. Is this possible? If 'yes', where can I find a documentation which can help me?Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This file I mentioned must be located in the PC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are looking for the "host based filesystem". In the BSP editor, I believe it is a software package you can add. There is an example on the alterawiki site.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- You are looking for the "host based filesystem". In the BSP editor, I believe it is a software package you can add. There is an example on the alterawiki site. --- Quote End --- Thanks ted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I thought it is not necessary to open a new thread because this post is problem-related.
To configure my bsp file system:- At the BSP Editor, I enabled the hostfs, leaving the /mnt/host as the default and clicked at the generate button
- After this, I right-clicked my bsp project, went to the Nios option, and perfomed the generate/compile (I don´t remember exactly) command
- And, finnaly I compiled my code with success
# include <stdio.h>
# include <string.h>
int main()
{
char *msg = "hello to file";
FILE *fp;
printf("before fopen...\n"); /* it freezes here */
fp = fopen("/mnt/host/myfile.txt", "w");
printf("after fopen\n");
if(fp != NULL){
printf("inside if...\n");
fprintf(fp, "%s", msg);
fclose(fp);
printf("file closed\n");
}
else printf("Error during opening file\n");
printf("Hello from JTAG CONSOLE Nios II!\n");
return 0;
}
any tip why i only can run via debug and can´t run directly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure what you are referring to and what is different for you between "via debug" and "run directly" ?
The host filesystem is using the debugger / JTAG to do the communication that happens during the file operations, so you can't ever run it without being connected and running through the debugger.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- I'm not sure what you are referring to and what is different for you between "via debug" and "run directly" ? The host filesystem is using the debugger / JTAG to do the communication that happens during the file operations, so you can't ever run it without being connected and running through the debugger. --- Quote End --- thank you for your time. I will try to be clearer than before. Please, check if now it is understandable. running "directly" I was refererring when I click over my project, right-click it, select "Run As" and choose Nios II. This makes the progam to be executed non-stopable, non-step-by step. When I choose this option, the program freezes, as previously described. runnig via debug is when I select debug on the menu, the debug environment is opened, and I click at the F6 (step over) and execute each one of the commands that exist on the .c code. Choosing this way, I can run, step-by-step my code with sucess, as I mentioned before. The proof is that after the execution, the myfile.txt is created and contains the "hello to file" message. In both cases all environment is prepared, i.e., my jtag is connected, the hardware is already with the .sof file, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The documentation for the host file system says:
--- Quote Start --- The host-based file system only operates while debugging a project. It cannot be used for run sessions. --- Quote End --- Using "Run As" is probably exactly what they are referring to when they say it cannot be used that way. So, don't do that.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- The documentation for the host file system says: Using "Run As" is probably exactly what they are referring to when they say it cannot be used that way. So, don't do that. --- Quote End --- oopps, sorry! https://www.altera.com.cn/zh_cn/pdfs/literature/hb/nios2/n2sw_nii52004.pdf, p. 6-15, third feature/restriction. I found it. Thank you again, ted
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