Forum Discussion
Altera_Forum
Honored Contributor
16 years agoFollow these steps to generate "images" (hardware using sof2flash and software using elf2flash):
- Point the "Reset Address" of your system at the base of your epcs_controller (in SOPC Builder).
- Use sof2flash (with the --epcs option) to create a flash (it's really an SREC) file for the EPCS.
- Use elf2flash (with the --after option) to create your ELF file.
- Program your flash with the contents of these to files using nios2-flash-programmer.
- Refer to the Flash Programmer User Guide for help.
nios2-elf-objcopy -I srec -O binary <ELF or SOF .flash file> <resulting_binary.bin file> You may want to re-consider using binary as the binary file won't contain any addressing information (you'd have to make sure your SOF file size doesn't change...). I'm assuming you can handle capturing the data from the UART and storing it in EPCS block-sized buffers, so the only bit which you may need some pointers on are the writing to EPCS. I would use alt_flash_erase-block() followed by alt_flash_write_block()...provided by Nios II's HAL to erase and program the EPCS one block at a time. Keep in mind that you'll have to handle boundary conditions properly when doing this or you could easily destroy data. The collateral for AN-429 has a ProgFlash() function that does this properly. You're welcome to contact me with further questions, but you should be able to find more information about what I've mentioned in this post using Altera's site search. Cheers, and Good luck! - slacker