--- Quote Start ---
I'm still having problems booting my Nios II from an EPCS16 device. I thought reducing the EPCS flash controller clock might fix it but no. I think the clock reduction is still needed so it has been reduced from 72MHz to 12MHz. The Nios II core still runs at 72MHz - could this be a problem?
My system looks like this :-
EPCS_flash_controller located at 0x00100000; Nios II reset vector set to 0x00100000. There is 64kB of on-chip memory starting at 0x01010000 and the Nios II exception vector is set to 0x01010020. The Nios II program runs correctly when using the debugger so the code's ok.
I use these commands to generate the programming files
sof2flash --epcs --input=C3D.sof --output=C3D.flash
elf2flash --epcs --after=C3D.flash --input=C3D_comms.elf --output=C3D_comms.flash
nios2-elf-objcopy –input-target srec –output-target ihex C3D_comms.flash C3D_comms.hex
Next I use the Convert Programming File utility in Quartus II to combine the .sof and .hex into a .pof. The map file created looks ok with the .hex file starting from the next address after the end of the .sof. Looks like this
BLOCK START ADDRESS END ADDRESS
Page_0 0x00000000 0x00122F6B
C3D_comms.hex 0x00122F6C 0x00126E8B
Then I program the EPCS but when I try to run the program it fails.
Any help much appreciated.
--- Quote End ---
Follow these steps:
Nios II Booting using Default EPCS Bootloader:
1- Add EPCS Flash Controller in Qsys
2- Connect the Clk input of EPCS Flash Loader IP to a separate clock of < 25Mhz
3- Set Reset Vector offset of NiosII to the Base Address of EPCS Flash Loader.
4- Set Exception vector to any On Chip RAM
5- Generate Qsys
6- Open BSP Editor and set all linker regions to SDRAM / onchip memory
7- Generate BSP and Build the BSP project
8- Build Your C code and obtain *.elf
9- Goto make targets->Build and run "mem_init_generate"
10- From mem_init folder include *.qip file in your Quartus project and recompile to get *.SOF
11- copy *.SOF and *.elf files in a separate folder i.e /output
12- perform following in NiosII command Shell:
1. Create a flash file for the hardware and software image
sof2flash --input=<hwimage>.sof --output=hwimage.flash --epcs --verbose
elf2flash --input=<elf file>.elf --output=swimage.flash --epcs --after=hwimage.flash --verbose
2. Convert the flash images into Hex files
nios2-elf-objcopy -I srec -O ihex hwimage.flash hwimage.hex
nios2-elf-objcopy -I srec -O ihex swimage.flash swimage.hex
3. Generate *.JIC file
Create your jic file using Quartus® II Convert Programming File tool, add the Flash Loader and
both hex files with absolute addressing option selected.