Forum Discussion

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

I got a really strange experience

I use nios IDE to develop a test system, when put .sof files into the DE2 develop board and run C files of niosII, I can get a correct result. But when I change the C files, recompile it and run it, the result is remain the one of the last, that is to say it did not change. I must recompile the project in quartus, and redownload the .sof file to the DE2 board. Then I can get a new result.

I think the project of quartus is related to the hardware of my system, and the project of niosII is related to the software of my system. If i want to change my output data, I need only change my C files. But why when I only change the C files, the output on the PC screen is not changed. When I recompile the .sof file and redownload it, the output on the PC screen is what I want?

thanks!

7 Replies

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

    The initial contents of the FPGAs internal block RAM is stored in the .sof file. If your NIOS code is being stored in internal block RAM, then your compiled code will be part of the .sof file. If you change your C code, you will then obviously need to also regenerate the .sof file.

    Using the "Update Memory Initialization File" option on the Quartus "Processing" menu can be a short cut to recompiling the entire Quartus project.

    While developing, you can also download updated NIOS code using JTAG to save having to generate a new .sof file every time. For example, from the Nios II Command Shell you can do "nios2-download -g filename.elf". Once you are happy with the results, you can then generate a new .sof file to make the changes more permanent.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    now, I have one more question.

    if I want to use the niosII soft IP core, I should download the .sof file to the DE2 board, then the hardware of the system has been setup. And then, I run the niosII IDE to run software on the hardware which has been setup. It is right that I store the software on the FPGAs internal block RAM, but when I redownload the .sof file, the RAM in the FPGA should be cleared up. I definitely understand if I want to change the result of the program, I should clear the RAM of the system, but why I have to regenerate the .sof file which is stored in my PC not in FPGA.

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

    now, I have one more question.

    if I want to use the niosII soft IP core, I should download the .sof file to the DE2 board, then the hardware of the system has been setup. And then, I run the niosII IDE to run software on the hardware which has been setup. It is right that I store the software on the FPGAs internal block RAM, but when I redownload the .sof file, the RAM in the FPGA should be cleared up. I definitely understand if I want to change the result of the program, I should clear the RAM of the system, but why I have to regenerate the .sof file which is stored in my PC not in FPGA.

    thanks

    --- Quote Start ---

    The initial contents of the FPGAs internal block RAM is stored in the .sof file. If your NIOS code is being stored in internal block RAM, then your compiled code will be part of the .sof file. If you change your C code, you will then obviously need to also regenerate the .sof file.

    Using the "Update Memory Initialization File" option on the Quartus "Processing" menu can be a short cut to recompiling the entire Quartus project.

    While developing, you can also download updated NIOS code using JTAG to save having to generate a new .sof file every time. For example, from the Nios II Command Shell you can do "nios2-download -g filename.elf". Once you are happy with the results, you can then generate a new .sof file to make the changes more permanent.

    --- Quote End ---

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

    --- Quote Start ---

    It is right that I store the software on the FPGAs internal block RAM, but when I redownload the .sof file, the RAM in the FPGA should be cleared up.

    --- Quote End ---

    Downloading the .sof file does not necessarily clear the RAM. In addition to the hardware configuration, the .sof also contains the initial contents of the RAM. For some systems, the initial RAM contents may be clear, but it may also contain things such as your Nios code.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    kevin, I do what you told me to do.

    I used "Update Memory Initialization File" option on the Quartus "Processing" menu to recompile my project, but the result of nios code is remain the same. But several days ago when do this, the result is changed. That is to say, the situation is not stable, maybe sometimes it works, but sometimes it does not work. I don't know why, thanks very much.

    All the best.

    --- Quote Start ---

    The initial contents of the FPGAs internal block RAM is stored in the .sof file. If your NIOS code is being stored in internal block RAM, then your compiled code will be part of the .sof file. If you change your C code, you will then obviously need to also regenerate the .sof file.

    Using the "Update Memory Initialization File" option on the Quartus "Processing" menu can be a short cut to recompiling the entire Quartus project.

    While developing, you can also download updated NIOS code using JTAG to save having to generate a new .sof file every time. For example, from the Nios II Command Shell you can do "nios2-download -g filename.elf". Once you are happy with the results, you can then generate a new .sof file to make the changes more permanent.

    --- Quote End ---

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

    kevin, I have found the reason.

    After updating the memory, I have to reassemble the project.