- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Some of you will probably know how to create .flash filew with the sof2flash and elf2flash tools. I need however a tool that converts a srec file to a flash file. Basically I create an srec file for my application, and add some lines to it for some custom initialisations of memory locations during program load. I looked to some tools, there is a nios2-srec2flash, but I don't think this will give me tha correct result. StefaanLink Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The .flash file is a binary file (a memory image that is programmed into flash). Why not add the custom initialization to the .flash file instead? I do this in my builds and it works well.
Bill- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The .flash file _is_ an SREC file with very minor differences. A conversion program (if even necessary) should be trivial.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ewww, you're right! Sorry about that - we convert it to binary and *then* add our extra stuff to it!
Bill- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- The .flash file _is_ an SREC file with very minor differences. A conversion program (if even necessary) should be trivial. --- Quote End --- Indeed it looks like an srec file packed in an srec file. I think a conversion is needed, because the destination addresses in the file are for the EPCS device. The data section should contain the information about where to store the instructions/data in the main memory of the processor. Is there a description of how the .flash looks like in detail. Creating a conversion program is not the problem, but with a description, it saves me lot of time. Is there a possibility to get the source code of the elf2flash utility program? I think that the elf2flash utility creates a standard srec anyway in the background first of all... Stefaan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stefaan,
I doubt there's a description of it, but I recall that the delta was _very_ minor. Here's what you can do to determine the difference between SREC and .flash.- Convert the .flash to binary using objcopy.
- Create an SREC from that binary, again using objcopy. (format it to closely match the original .flash).
- Compare the two SREC files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Slacker,
I think there is a mistake here : What I want :- generate an elf file of my software with nios2-elf-objcopy
- concatenate to this srecord some other lines (things to write to some addresses in the system), also in srecord format
- take this combined file to use with nios2-download : works great
- also use the same file for putting in the epcs to be able to use the board without jtag connection
- create a flash file for the sof : sof2flash ok
- create a flash file for the software : elf2flash ok
- program these two with the flash programmer : ok
- BUT : the extra initialisations I want in the boot process is not available.
- the elf2flash creates an image for the processor system : data x must go on address y... (this data is also in the srecord if generated with nios2-elf-objcopy, see above)
- all (x,y) data is packed as information for the bootloader (where to write content) : call it BOOTDATA
- the BOOTDATA is packed in an srecord file to instruct the flash programmer where to program DATA in the EPCS. so the address information in this srecord is not related to BOOTDATA in any way
- the bootloader in the epcs sopc component handles BOOTDATA, decodes the records and uses (x,y) for initialising memories...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An alternative approach might be to add the additional initialisation into the object file than contains the rest of the software.
(ie as C/asm initialised data in a named section and get the linker to place it at the correct address.) Of course, the problem might be in the way the bootloader code processes the information stored in the flash. For instance (I've no idea if this is true) if it always did byte copies any hardware initialisation would likely be wrong. For our systems we have a PCIe slave interface - and all the code is written through that.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page