Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 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

    Ok.. Here is the thing. I used the flash file i am programming, and used the Nios2-flash-programmer to program my flash. It works great. See below the log.

    bash-3.1$ nios2-flash-programmer --epcs --base=0x3001800 "c:/User/kaushik/WIDri

    ve/flash/Firmware.flash" --program --erase-all --go

    Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

    Resetting and pausing target processor: OK

    Checksummed/read 896kB in 21.2s

    Erased 7680kB in 95.1s (80.7kB/s)

    Programmed 881KB +15KB in 6.8s (131.7KB/s)

    Did not attempt to verify device contents

    Starting processor at reset vector (0x03001800)

    If you see the last but one line it says, programmed 881KB + 15kB. What is this 15 kB.. Is it more metadata required for the correct booting of the system??
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No the Nios2 programmer just flashes the contents it reads from the given .flash file, it doesn't write anything else. My guess about the +15kB is that it zero fills the last flash page, but I can't be sure.

    There are two things I see in your set of commands: first when you write this:
    cat SoftwareFirmware.bin HardwareFirmware.bin > Firmware.bin
    the software will be put in the flash before the hardware, and the FPGA will not boot. You need to put your two binary files in the other order. Second I'm not sure about the use of nios2-elf-objcopy to translate a srec file to binary. I've never used it that way and I don't know if it gives the expected results... Maybe you could try to use another tool (such as the very good srec_cat (http://srecord.sourceforge.net/)) to generate the binary file. srec_cat can also to the concatenation of the two .flash files, using the addresses to place the data correctly, so you are sure they it will always be put in the right order in your resulting binary file.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hallo,

    Well I actually saw that error myself today morning and guess what, I changed the order and VOILA!! The update is working perfectly.. Well it was a very dumb mistake from my part, when from the start of this thread everybody has been saying something about the order of files. I must have seen it sooner. Anyway, this problem is now solved and this thread has been very educational.

    I would like to thank everybody for your patience and your responses. Especially Daixiwen, for your timely replies.

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

    I'm glad it works now! If it can be any comfort I didn't see it the first time I read your commands, it was only when I was re-reading my answer that I got the idea and read your message again ;)