Forum Discussion

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

Cyclone IV and Nios II Firmware Update

Hallo Everybody,

I would like you guys to suggest a solution for the problem below:

I have successfully updated the hardware and software configurations of my project on the EPCS device and have tested the device by resetting it. Everything works perfectly. Now I did my experiments with the Nios II flash programmer. And there were no problems.

now considering a situation where a connection through the jtag interface is not available, i would like to perform the update also through a fieldbus or ethernet. i have already read up on preparing the configuration files to be written to the flash (elf2flash, sof2flash). i can also transfer the files and store it in the flash memory. now my question is, if i am using the default epcs boot copier, do i write the fpga configuration first and then the software application, one after the other on to the flash?? or is there a specific rule, how i store these files on to the flash memory?

If there are any other posts or documentation that I can read with respect to this issue, please let me know.

Thank you very much

Cheers

kaushik.

24 Replies

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

    The bootloader is encapsulated in the fpga configuration, namely in the sof file.

    When you add a epcs controller, the default bootloader is automatically added to the project and built in fpga configuration. You should have a epcs_controller_boot_rom.hex in your Quartus project directory; if I recall correctly this is the default name associated to epcs, but you can change it in Quartus settings or in Qsys.

    If you need a custom bootloader you simply change the file and rebuild fpga.

    When you regenerate the Qsys component including epcs controller, the hex file is automatically overwritten with the default one. So you must pay attention to replace it with the custom version whenever you change anything in Qsys.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The bootloader is part of the EPCS controller integrated in the SOPC/QSys system. Just point the Nios CPU's reset vector to the EPCS controller and the bootloader will load the .elf file from the flash. The bootloader will jump over the .sof image, so the .elf just needs to be placed after the FPGA image in the flash.

    What file format are you using when you send data to your application, and how do you write it to the EPCS? The easiest format is probably .rbf, but IIRC with the EPCS flash you need to revert the bit order of every byte before you write them.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you very much for the reply. I have read the AN521 already and from your post I have read the related topics from other posts.

    I have achieved in successfully copying the required firmware files on to the Flash device. But now when I reset it it would not start. And I am guessing it has something to do with the Bootloader.

    I would like to first use the default bootloaders from Altera. the question is where should i specify which bootloader i would be using. should i be integrating the bootloader in to the sof or the elf file or should i copy it reperately to the epcs on-chip rom.