Forum Discussion

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

Writing EPCS64 Device For Remote Update

Hi,

I would like to use the Remote Update mode of Cyclone III device. I have achieved lots of things but I could not accomplish writing EPCS64. I want to write my factory image hw1+sw1 at base 0x00000000 and my application image hw2+sw2 at base 0x00200000 by using the tools in Quartus II 8.1 and Nios II 8.1 IDE but not using Nios II software tools of EPCS Flash Controller.

I could write my two .sof file to EPCS64 device by combining them in .jig file by using Convert Programming Files tool. However, I could not write my .elf files.

Could anyone help me about this issue?

Thanks.

19 Replies

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

    --- Quote Start ---

    No, the GUI isn't capable of doing what you're asking of it. You'll have to use (and understand) the command line tools (sof2flash, elf2flash, and nios2-flash-programmer) in order to do what you'd like.

    You'd only have to modify the bootloader for the second pair of images. The first pair of images can use the stock bootloader. Alternately, you can use the methodology presented in AN-458.

    Also, before you go through any of this sort of exercise, you'd better make sure you actually have enough space in the EPCS device to do what you'd like to do.

    Regards,

    slacker

    --- Quote End ---

    slacker thanks very much,

    I have tried the sof2flash and elf2flash commands before I asked the forum. The problem was that when I have tried to give an offset to sof2flash command for example --offset=0x00200000, the created flash beginning address was still 0x00000000. Then when I looked at the datasheet of EPCS devices, I saw that the offset command is valid only for CFI Flashes.

    What can I do so as to give an offset?

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

    --- Quote Start ---

    I have tried the sof2flash and elf2flash commands before I asked the forum. The problem was that when I have tried to give an offset to sof2flash command for example --offset=0x00200000, the created flash beginning address was still 0x00000000. Then when I looked at the datasheet of EPCS devices, I saw that the offset command is valid only for CFI Flashes.

    What can I do so as to give an offset?

    --- Quote End ---

    I've used Peter Miller's SRecord utilities to do this sort of thing in the past (available on Sourceforge), but (though I've not tried it) I think nios2-elf-objcopy could work as well. You just need something that shifts the addresses up to where you want your next hardware image to start.

    Cheers,

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

    Now that I look back at a past project where I did something similar, I see that I did in fact use the srecord (http://srecord.sourceforge.net/) utilities in my script file as slacker has just suggested.

    Using sof2flash and elf2flash I created the required .flash files (which are just s-record files AFAIK) all at offset zero. I then used srec_cat to apply an offset and combine all the files together. This combined file can be used with nios2-flash-programmer to actually program the flash.

    An example command line to combine and offset files with SRecord:

    
    srec_cat file1.flash --offset 0x10000 file2.flash --offset 0x20000 > combined.flash
    
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Kevin, thanks for replying.

    Kevin, I tried the srec_cat.exe, but it was not succesful. I have downloaded the version 1.47 from this link.

    http://sourceforge.net/projects/srecord/files/srecord-win32/srecord-1.47.zip/download

    Then, I executed the srec_cat.exe then wrote your command , but it gave an error like this: srec_cat: standard input :0x0002: warning: ignoring garbage lines.

    Actually, whatever I wrote it gives the same error.

    What can I do Kevin?

    Thanks again.

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

    --- Quote Start ---

    I executed the srec_cat.exe then wrote your command

    --- Quote End ---

    The example command line I gave in my previous post should be all executed as one command. If you just run srec_cat and then type the rest of the command you will get the error you are seeing.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Kevin,

    Thanks very much again,

    I had typed all command in one line as you said. Despite of this it gave the error. In other words, I run the srec_cat.exe then in the opened window I executed "srec_cat file1.flash --offset 0x10000 file2.flash --offset 0x20000 > combined.flash".

    Which location do the file1.flash and file2.flash have to be? Are they at the same location with srec_cat.exe? I did them at the same location, but it gave the error.

    What should I do so as to solve this problem?

    Thanks again,

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

    --- Quote Start ---

    I run the srec_cat.exe then in the opened window I executed...

    --- Quote End ---

    You need to run srec_cat from a command line instead of running it from the Windows GUI. You can use either the Windows "Command Prompt" or the "Nios II Command Shell". I would recommend using the Nios II Command Shell as it is easier to use the other Nios command line tools this way. On my system I have also added the location of srec_cat.exe to the system path so that it can be more conveniently executed from any location.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Kevin and slacker, thanks for answering my questions.

    I have solved the problem by using the method of Kevin, and finally I programmed my EPCS64 device with offsets. The only thing remaining is changing the bootlooder for second software.

    Thanks for everything.

    Best Regards,

    Sincerly,

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

    --- Quote Start ---

    You'd also have to modify the bootloader for the second pair or, like I've done in the past, just use a separate onchip memory for this bootloader.

    I can describe an approach for doing this, if you like, but I'd recommend reading the following AN (and, perhaps, playing with the source code) before that:

    http://www.altera.com/literature/an/an458.pdf

    --- Quote End ---

    Hi slacker,

    I have read the AN458 document however I could not do examples because I use Qautus 8.1 and Nios 8.1. How did you achieve remote update by using a seperate on-chip memory?

    best regards,

    thanks