- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd like to add a firmware upgrade capability to my NIOS system. Since the end user won't have a development system with JTAG I'd like to add a way of reprogramming the EPCS with FPGA configuration and/or my application code.
My question: how do I reformat the programming files (e.g. SOF) to program into the EPCS with a call to the HAL API? I imagine the flash API wants a memory buffer with the raw bytes in it but I'm not sure I understand exactly how the data is formatted in the EPCS and how to generate that format starting with the SOF file. I'll start by reverse engineering what's in the EPCS right now and comparing it to the various formats I can generate with the Altera tools but I'm sure someone already knows the answer. Thanks, AndrewLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by queisser@Jul 13 2006, 01:53 PM i'd like to add a firmware upgrade capability to my nios system. since the end user won't have a development system with jtag i'd like to add a way of reprogramming the epcs with fpga configuration and/or my application code.
my question: how do i reformat the programming files (e.g. sof) to program into the epcs with a call to the hal api? i imagine the flash api wants a memory buffer with the raw bytes in it but i'm not sure i understand exactly how the data is formatted in the epcs and how to generate that format starting with the sof file.
i'll start by reverse engineering what's in the epcs right now and comparing it to the various formats i can generate with the altera tools but i'm sure someone already knows the answer.
thanks,
andrew
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16876)
--- quote end ---
--- Quote End --- What I did to figure this out with CFI was erase the flash completely, use the flash programmer to program my design, and then dump the entire flash contents to a file and examine them with a hex editor. It turned out that all the flash programmer was doing was placing binary images of the flash files at the specified offsets in flash. For instance, if I specified that a CPU's reset address was 0x00100000 in flash, then the code I compiled for that CPU would be loaded at 0x00100000 in flash. SOF files were loaded at either 0x00800000 (user) or 0x00C00000 (factory). To get the binary images, search for a tool called srec2bin and run that on the flash files. I don't see why this would be any different with an EPCS device except for the code you'd use to get the data in and out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right. The .flash format is really just SREC minus a few of the S<n> types. I would probably use nios2-elf-objcopy to convert a .flash (SREC) file into a binary file.
It would be better still if you could write an SREC parser to convert (and store) the contents of these SRECs (.flash files) on the fly. The HAL flash abstraction makes writing to CFI or EPCS transparent. Cheers, - slacker- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thanks for the tips. I'm starting with the FPGA config file, though, not the elf file of the application. I assume the same stuff applies but I don't see a flash file being generated for the FPGA configuration. What I do see is a .sof, .pof and .rbf.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you've ever programmed the SOF to flash, you should see a <sof_name>.flash file in the Debug|Release subdirectory of your project. There's also an auto-generated <project_name>_programmer.sh script which should make it apparent how all this stuff works....
This script uses: 1. sof2flash to generate the <sof_name>.flash file. and 2. nios2-flash-programmer to program it to the flash device. Cheers, - slacker- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please let us know what you find out and how you decided to do it. I am also interested in doing this with a cyclone2 and an EPCS64.
My method is that after I build the .elf file, I go into a NIOS SDK Shell and go to the debug or release directory and run: nios2-elf-objcopy -O srec MyProg.elf MyProg.srec This creates my srec file which I can open in any text editor. I used the site: http://www.amelek.gda.pl/avr/uisp/srecord.htm (http://www.amelek.gda.pl/avr/uisp/srecord.htm) to explain the record format. Since our cyclone based device is a PC peripheral connected via usb, we wrote an app on the pc to download the srec. Everything is fine to here. Right now I am working on writing it all to flash... I have seen this question asked before, I may have even asked it before myself. I KNOW someone at Altera has done this, and done this several times. It would sure be nice for someone at Altera to post some sample code on this forum for the benefit of the developer community.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by slacker@Jul 13 2006, 04:08 PM if you've ever programmed the sof to flash, you should see a <sof_name>.flash file in the debug|release subdirectory of your project. there's also an auto-generated <project_name>_programmer.sh script which should make it apparent how all this stuff works....
this script uses:
1. sof2flash to generate the <sof_name>.flash file.
and
2. nios2-flash-programmer to program it to the flash device.
cheers,
- slacker
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16880)
--- quote end ---
--- Quote End --- Ahh, thanks, that explains it. I work on two machines, Windows for Quartus and Linux for NIOS IDE and I was looking on the Linux box which wasn't used to program the sof to flash. So it looks like reading SREC or .flash is the most convenient file format to use for a in-system ugrade utility.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page