Forum Discussion
Altera_Forum
Honored Contributor
20 years agoHi Trey,
> So in the code below you are parsing data that is in the .sof > file and not the actual memory of the EPCS, correct? No, it's parsing data that was read directly from the epcs device (after the necessary bit reversal) into a buffer in the Nios-II memory space. > Also you mention that I start programming the EPCS at offset 0. > Is offset 0 on the EPCS writable? Yes ... provided the sector is not protected. > 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. You need to make sure the sector is not protected ... then erase the sector ... then write your data. If you don't erase, you can only change a 1 to a 0. > So just to clear on this, the .elf data comes IMMEDIATELY after the .sof data. Yes > Meaning the byte after the last byte of data of the .sof is .elf data, regardless > of boundries? Yes. The byte immediately following the sof data is the first byte of the length field. Each record in the sequence is formatted as: length - 4 bytes address - 4 bytes data - 'length' bytes of data If the length is zero, the address is the entry point (target address of a JMP). Take a look at boot_loader.S and boot_loader_epcs_bits.S in: nios2\components\altera_nios2\sdk\src\boot_loader_sources to see how the data is organized. If you want to experiment with this you can use u-boot ... it has full command line support for epcs read, write, protect, erase, programe etc ... and the 'epcs info' command provides the length of the configuration data. You can use u-boot's kermit or tftp support to load your binary files onto your target ... or you can just hoist some of the u-boot code to play with or just review. Regards, --Scott