Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Nios fopen

Hi all,

I was trying to use (fopen) & (fclose) to dump data to PC in Nios IDE. The file was never created.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

FILE *Fp;

Fp = fopen("/dev/ext_flash/dump.txt", "w");

if (Fp == NULL)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Nios II software developer's handbook shows, there is not concept of current directory. I should use mounted device and specific file system. Don't quite understand the "Read-Only Zip Filing system" for the flash memory. (Chapter 12 of Nios II Software Developer's Handbook)

Simple and straight question. Is it possible to output something from FPGA to a .txt file on PC filing system?

Please help!!!

10 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You could also use the host filing system, though only when running in "Debug" mode. There's an example software template shipped with the kit.

    - slacker
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by slacker@Jan 25 2006, 01:37 PM

    you could also use the host filing system, though only when running in "debug" mode. there's an example software template shipped with the kit.

    - slacker

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12391)

    --- quote end ---

    --- Quote End ---

    Hi Slacker,

    Thanks a lot of your suggestion. I am using the StratixII DSP development kit (EP2S60), don&#39;t have clear impact on the material I have in my hands about the host filing system.

    Could you please give me more detail about locating it?

    thanks,
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    It&#39;s included with the standard software examples shipped with the distribution. It started shipping in 5.0, as part of the ro_zipfs software example, and is a stand alone example in 5.1.

    So, look in:

    <nios2_install_dir>/examples/software/host_filesystem

    or

    <nios2_install_dir>/examples/software/zip_filesystem

    Looking at the code should be enough for you, as it&#39;s pretty straightforward.

    Cheers,

    - slacker
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi !

    I was trying to use (fopen) & (fclose) to dump data to PC in Nios IDE. The file was never created too.

    I didn't understand. I have the Nios II 8.0, and in this version doesn't have the host_filesystem example.

    I donwloaded this, but it doesn't appear in the templates options menu, when I create a new project.

    Somobody can help me ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can't open a file on the PC from the Nios application. You either need to dump your data through the JTAG UART and copy/paste it on the PC, or create your own protocol.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    does anyone has an update on this, is there a way to use fwrite, fclose,fopen calls and put the data on the file, JTAG uartcooy of huge data is not possible. Can anyone suggest some alternative method for this.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I succeeded in creating the file.

    I set an option in the project properties.

    Menu Project ->

    Properties ->

    Associated System Library ->

    System Library Properties ->

    Software Components ->

    And set the option: "add this software component"
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi

    I have the same problem: I'd like save elaborated data on my PC, but the fopen function return 0x0. I set the host based file system, but don't work. There is same proble if my o.s. is windows xp?

    Luca
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Luca, I'm having the same problem. Did you find a solution to that or is the fopen function not possible on Windows PC? I've set the host based file system software component, but I don't know what to write as mount-point. I thought 'C:\\' could be a 'mount-point' for windows systems but I get the 0x0000 return too when in debug mode.

    --- Quote Start ---

    Hi

    I have the same problem: I'd like save elaborated data on my PC, but the fopen function return 0x0. I set the host based file system, but don't work. There is same proble if my o.s. is windows xp?

    Luca

    --- Quote End ---