Forum Discussion

Yogesh's avatar
Yogesh
Icon for Occasional Contributor rankOccasional Contributor
5 years ago

How to load data to FPGA memory using NIOS application?

Hi,
I have developed some NIOS application, and I am using NIOS II Eclipse tool to run the same. Suppose I have some data in files. I want to load some amount of locations in DDR of my FPGA device with this data. I want to do this everytime I run the program as NIOS II hardware / everytime when I program the board .

1) I know that file read/write operations are slow in NIOS eclipse tool. It is only supported in debug mode .So I don't want to choose this option .
2) Is there anyway , so that I can load this data to DDR of my FPGA in " run mode " ?


Please provide some sample code / document for the same


Thankyou
Regards,
Yogesh

7 Replies

    • Yogesh's avatar
      Yogesh
      Icon for Occasional Contributor rankOccasional Contributor

      Hi Isaac,

      The documentation link is not reachable.I am not able to access it.

      And I did download the project , But I couldnt find the C codes to run on eclipse?

      Am I missing something ?Please guide me.

      regards,

      Yogesh

    • Yogesh's avatar
      Yogesh
      Icon for Occasional Contributor rankOccasional Contributor

      Hi Isaac,

      I dont have the DE -10 lite board to exceute the example design provided by you.

      I am working with cyclone V GT board . That is why I want to understand the concept/ C code which writes the data to memory of FPGA. So that I can replicate the same in my C application.

      I downloaded .par file and opened it in quartus . I could not find the software folder which contains the c codes required for eclipse. I have attached the screeshot of the files that are generated.

      Please have a look into it and provide me the c code for the same

      regards,

      Yogesh

  • Hello Yogesh,

    Yes, you need to follow these steps to get the C code.

    • Compile the Quartus project
    • Open Nios ll
    • Select the same Quartus project folder for the Eclipse project
    • Open Nios ll Aplication and BSP from Template and select the BSP that you have in your workspace
    • Compile the Nios ll project

    If you follow these steps you are going to have the software folder and the C code. Also I attached the C code.

    Best regards.

    Isaac Vazquez

    • Yogesh's avatar
      Yogesh
      Icon for Occasional Contributor rankOccasional Contributor

      Hi Isaac,

      Thankyou for sharing the code.

      I was able to write some data. But SDRAM_TEST fails at some addresses.

      Say, If I try to write at addr 0x10005000 . I am able to write 3k bytes . But after that I am not able to write data, since SDRAM_test fails in that region.

      I have shared BSP memory screenshot. Please answer my below queries:

      1) SDRAM addressing has addr from 0x10000000 to 0x1fffffff . Does this mean I can write/read to all the address in this range ?

      2) Even if I change the address to 0x20000500, which is above that of SDRAM address range. I am not able to write anything here. SDRAM_test fails . So , why am I not able to access this range of address?

      3) Suppose I want addr from 0x20000000 - 0x2fffffff to store some initial input data for processing how should I specify in eclipse tool / qsys ,to access the same?

      regards,

      Yogesh

  • Hello Yogesh,


    Here are the answer to every single to your questions.


    1) Yes, you can write at this section of the memory

    2) Yes, the test fails because your accessible memory section is already defined. So, if you want to select other range or other section, you need to modify your platform design and rebuild the bsp.

    3)Same, QSYS is related with platform designer.


    Best regards,

    Isaac Vazquez.