Hey Scott,
I have further questions and they are detailed in red below.
Thanks again for the information, it is most helpful.
-Trey
Hi Trey,
> What comes right after the configuration data? The .elf or the .sof?
When I refer to the "configuration data", I'm talking about the data contained in
the sof (or pof) that is used to program the FPGA (the logic you're downloading).
This data is contained in a data "packet" within the pof/sof file and ends up
getting programmed starting at offset zero in the epcs device. The length of this
data can be determined from header information contained in the data itself:
So in the code below you are parsing data that is in the .sof
file and not the actual memory of the EPCS, correct?
If this is the case then have you run the .sof through sof2flash, or
something else?
Also you mention that I start programming the EPCS at offset 0.
Is offset 0 on the EPCS writable? I try and change its value and I always
read a value of 0x8A. I can change the value at other locations on the EPCS
flash so maybe I am missing something.
Here's a snippet from the u-boot sources. Assume that the fist 128 bytes
of the epcs memory were read into a buffer (buf), and that 'sz' is an
32-bit unsigned value. Also, assume that the bit-reversals have already been
performed.
/* Search for the starting 0x6a which is followed by the
* 4-byte 'register' and 4-byte bit-count.
*/
p = buf;
while (p < buf + sizeof(buf)-8) {
if ( *p == 0x6a ) {
/* Point to bit count and extract */
p += 5;
sz = *p++;
sz |= *p++ << 8;
sz |= *p++ << 16;
sz |= *p++ << 24;
/* Convert to byte count */
sz += 7;
sz >>= 3;
break;
} else if (*p == 0xff) {
/* 0xff is ok ... just skip */
p++;
continue;
} else {
/* Not 0xff or 0x6a ... something's not
* right ... report 'unknown' (sz=0).
*/
break;
}
}
return (sz);
The 'elf' sections immediately follow the FPGA configuration data. So, if the size
of your configuration data is 0x1008c for example, the Nios-II elf sections start
at offset 0x1008c in the epcs device. NOTE: The Nios-II application is not stored
elf format ... it is insted, a sequence of length-address-data records so the loader
can load individual sections to the appropriate addresses. This conversion (from elf
to length-address-data) occurs during elf2flash.
So just to clear on this, the .elf data comes IMMEDIATELY after the .sof data.
Meaning the byte after the last byte of data of the .sof is .elf data, regardless
of boundries?
> Is there code to concatenate both the .elf and .sof into one image that gets
> written after the configuration data?
If your goal continues to be a single binary file that contains both configuration and
Nios-II application data for run-time updates, I would recommend you discuss this
more with Mike -- and take him up on his code offer -- and his experience with
this -- I'm sure Mike can steer you away from alot of "gotchas".
Regards,
--Scott
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=10791)</div>