Forum Discussion
Running multiple images from EPCS (Factory & User)
Hi,
I am aware that there have been many topics on subjects similar to these. I have read many of them and tried to make use of the suggestions and advice offered there but am still having a few issues. My aim is to have a fixed factory image at the base of the EPCS device which will allow a User image to be remotely programmed to a higher location in the EPCS. I have hardware and software images (based on AN429) which are able to write designs to the EPCS memory. I am now trying to configure the EPCS (and required custom bootloader) to load the user image and fall back to the remote configuration factory image if this fails. I have created a combined hardware and software image for both the factory design (including bootloader) and the user image and programmed them to the EPCS. However when i reboot the FPGA the factory image is always loaded. I think i have a reasonable understanding of the steps that are needed to achieve what I want but i may have misunderstood some parts or missed something out. If anyone could give me a few pointers that would be great. The steps i have taken are shown below I am using a Stratix II EP2S60 on a custom PCB and Quartus 7.2 (fully licensed). Thanks in advance, Andy -------------------------------- I have taken the following steps:- Remote Config Image - CPU reset vector is EPCS offset 0x0
- User image - CPU reset vector is EPCS offset 0x0
- Remote configuration image contains the SII remote update IP core created by jakobjones (showthread.php?t=3658)
- I have created a custom bootloader using the trio_bootloader example from this topic (showthread.php?t=20623) by replacing the system.h file with my file from the Remote config sofwtare image and running the makefile
- I have included the bootloader hex file in the Remote Config hardware project using the following assignment parameter:
epcs:the_epcs|altsyncram:the_boot_copier_rom INIT_FILE trio_boot_loader_epcs.hex Yes. This corresponds to the name of the EPCS controller in the design- I have created a .flash file for the remote update image as follows:
sof2flash --input=hw_rem.sof --output=hw_rem.flash --epcs
elf2flash --input=sw_rem.elf --output=sw_rem.flash --after=hw_rem.flash --epcs --boot=trio_boot_loader_epcs.srec
cat hw_rem.flash sw_rem.flash > rem_image.flash- I have created a .flash file for a sample user image project (basic hardware, software flashes LEDs) as follow:
sof2flash --input=hw_usr.sof --output=hw_usr.flash --epcs
elf2flash --input=sw_usr.elf --output=sw_usr.flash --after=hw_usr.flash --epcs --boot=trio_boot_loader_epcs.srec
cat hw_usr.flash sw_usr.flash > usr_image.flash- I have programmed the rem_image.flash image to the base of the EPCS and the usr_image.flash to the EPCS with an offset of 0x300000 (which equates to the line
in the bootloader.h part of the custom bootloader.#define TRIO_USER_IMAGE_ADDRESS 0x300000
13 Replies
- Altera_Forum
Honored Contributor
Hey Jens,
Its working!!!! Thank you very much for help!!!! - Altera_Forum
Honored Contributor
The bootloader makefile generates a .hex file which you have to copy in your Quartus project directory. Overwrite the SOPC-builder generated epcs_controller_boot_rom.hex. Then you have to run the Quartus Hex/Mif Update. The bootlaoder is stored in a small piece of onchip RAM which is separated from the code memory. Your application firmware (IDE project) is not affected. No clean is not necessary.
Jens - Altera_Forum
Honored Contributor
Hi Jens,
Just more one question. Do I need to clean my project on IDE, if I change the bootloader or I just recompile the Quartus Project? Hagen Thanks - Altera_Forum
Honored Contributor
Hi lehagen,
this bootloader is tested just with Stratix2 (S15, S30) devices. I don't know if it works also for Cyclone3. Furthermore I used uncompressed bitstreams. Try this. In the header (boot_loader.h) are two defines: in your case, should be correct # define EPCS_SRC_ADDR 0x100000 in my design EPCS_CONTROLLER is at 0x21000 in the SOPC, 0x400 offset for accessing the registers in the epcs controller # define EPCS_REGS_BASE 0x00021400 Please verify that. You should also verify if the nios program is stored correct at 0x100000 in EPCS. Some additonal informations and example for alternative boot methods you get in AN458. (http://www.altera.com/literature/lit-an.jsp) Jens - Altera_Forum
Honored Contributor
Hi Jens,
I dont know why its not working for me . Does this bootloader works to Cyclone III? I'm doing as you said. I'm just using the command "make" without any parameter then I replace the hex file on my Quartus project and recompile it. To create my bin files I'm doing the following steps: "$SOPC_KIT_NIOS2/bin/sof2flash" --epcs --compress --input="../../../cloro_gvce.sof" --output="ferro_aport.flash" # Creating .flash file for the project echo ------------------------------------------------ echo Creating safe and application flash files ... echo ------------------------------------------------ echo "$SOPC_KIT_NIOS2/bin/elf2flash" --epcs --input="Cloro_boot.elf" --output="Cloro_boot.flash" "nios2-elf-objcopy" -I srec -O binary Cloro_boot.flash Cloro_boot.bin "nios2-elf-objcopy" -I srec -O binary ferro_aport.flash ferro_aport.bin cat ferro_aport.bin Cloro_boot.bin > fpgaboot.bin I'm using the flash programmer to program the EPCS. ferro_aport.bin - offset 0x0 (FPGA IMAGE) Cloro_boot.bin - offset 0x100000 (EPCS_SRC_ADDR is equal) When I turn on my board the fpga is configured correctly but is not jumping to my app. Any idea? Thanks. - Altera_Forum
Honored Contributor
- Altera_Forum
Honored Contributor
Hello Jeans,
im using your bootloader sources but I'm getting this msg when I'm trying to compile it: # 2010.07.21.15.51.27 --- Compiling to obj/boot_loader_epcs.elf /cygdrive/c/altera/90/nios2eds/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gc c/nios2-elf/3.4.6/../../../../nios2-elf/bin/ld: warning: cannot find entry symbo l _start; defaulting to 00040000 Is it correct? And what is the CODE_BASE paramter? Is the offset of the fpga image on the EPCS? Thanks. - Altera_Forum
Honored Contributor
Andy, it would really helpful if you can organize the schematic of the board. Then you are able to determine on which MSEL pins you can get access. For example by removing some pullups or changing to pulldowns. May be you must scratch some PCB tracks or sold a new wire from the jumper to GND or VCC ...
For example, if the bord supports the AS (standard, 20MHz) then the MSEL[3..0] are 1101. If you can toggle MSEL0 and MSEL1 then you have the remote mode (1110). Jens - Altera_Forum
Honored Contributor
Or, if you are lucky, it might be 0110 PS with RU and 1110 AS with RU.
- Hippo - Altera_Forum
Honored Contributor
Sorry, what will really help me?
Andy