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++
12600 Discussions

NIOS2 Host File System not Working

WUnkn
Beginner
894 Views

 

Hi all, please see my code below, I have hostfs enabled in BSP


#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include "system.h"
#include "alt_types.h"


int main ()
{
printf ("HOSTFS step1\n");

FILE *fp;

fp = fopen ("/mnt/host/readme.txt", "a");

printf ("HOSTFS step2\n");

if (fp == NULL)
{
printf ("HOSTFS failed\n");
while (1);
}
else
{
fclose (fp);
printf ("HOSTFS OK\n");
}

return 0;
}

 

When execute my code on DE10_LITE board,  I could only see HOSTFS step1

readme.txt is a very small ASCII file

 

Any idea it would not fopen readme.txt?

 

Thank u

0 Kudos
6 Replies
BoonBengT_Intel
Moderator
842 Views

Hi @WUnkn,

Thank you for posting and sharing the finding in Intel community forum, hope this message find you well and apologies for the delayed in response.
If I understand the situation correctly, you would like to read from the 'readme.txt', please try changing the second param for the fopen to r as below and see if it works:
fp = fopen ("/mnt/host/readme.txt", "r");

Please do let us know if that helps.

Best Wishes
BB

0 Kudos
BoonBengT_Intel
Moderator
812 Views

Hi @WUnkn,

Good day, just checking in to see if there is any further doubts in regards to this matter.
Please do let us know.

 

Best Wishes
BB

0 Kudos
BoonBengT_Intel
Moderator
790 Views

Hi @WUnkn,

 

Hope this message find you well and good day, unfortunately as we do not receive any response from you to the previous clarification that we have provided. This thread will now be transitioned to community support. If you have new queries, please feel free to open a new thread to get support from Intel experts. Otherwise, the community users will further help you with doubts in this thread.

 

Best Wishes
BB

0 Kudos
BoonBengT_Intel
Moderator
782 Views

Hi @WUnkn,

 

Hope you are well, glad that you are back with us.
Quick check did you managed to try on the previous suggestion?
Please do let us know if there is any further clarification/doubts/issues on the previous steps so that we can better understand the situation.

 

Best Wishes
BB

0 Kudos
BoonBengT_Intel
Moderator
741 Views

Hi @WUnkn,

 

Hope you are doing well and safe.
Any updates on the following thread?

 

Best Wishes
BB

0 Kudos
BoonBengT_Intel
Moderator
731 Views

Hi @WUnkn,

 

Unfortunately as we still do not receive any response from you to the previous clarification that we have provided, hence would assume problem are closed. With that we will now be transitioned to community support. If you have new queries, please feel free to open a new thread to get support from Intel experts. Otherwise, the community users will further help you with doubts in this thread.

 

Best Wishes
BB

0 Kudos
Reply