Forum Discussion
Altera_Forum
Honored Contributor
14 years agoRemote update controller issue
Hi everyone,
I'm using the remote update controller (cyclone III) on my Cyclone IV GX dev board with a EPCS128 flash memory. I wish to have two firmwares in my EPCS (factory and application). Actually, I placed the firmware like this in the EPCS: 0x000000 Factory image (hw0 + sw0) 0x440000 Application image (hw1 + sw1) (I'm not using the flash programmer to load the image in flash memory) The nios II boots correctly on the factory image when I start the board. But when I try to reconfig the FPGA with the application image using the remote update controller, the Factory image is loaded... I write 0x110000 to the remote update controller, then start the reconfig for loading the application image. Is this address correct? I think my problem comes when I'm creating the application image. Here is my script to create the .flash: --- Quote Start --- java -jar C:\altera\11.0\nios2eds\bin\sof2flash.jar --epcs --input="..\..\2Dcam.sof" --output="2Dcam_sof.flash" --verbose java -jar C:\altera\11.0\nios2eds\bin\elf2flash.jar --epcs --after="2Dcam_sof.flash" --input="..\2DCam\2DCam.elf" --output="2DCam_elf.flash" --offset 0 rem merge the two files copy /b /y 2Dcam_sof.flash+2DCam_elf.flash 2DCam.flash --- Quote End --- I create factory and application image (.flash) with this script. And load the factory image at address 0x000000 and the application at address 0x440000 in EPCS. Do I have to make something different for the application image, because her address is not 0x000000? Has anyone the same problem? Best regards37 Replies
- Altera_Forum
Honored Contributor
I figure out the difference. When executing "make" command, I should do it like this:
Then the generated code in boot_loader_epcs_sii_siii_ciii.elf will start at address 0x0. Now by virtue of this commandmake CODE_BASE=0
the required boot loader code file(i.e. the .hex file) will be generated. -weielf2hex --input=obj/boot_loader_epcs_sii_siii_ciii.elf --output=kernel_epcs_boot_rom_synth.hex --width=32 --base=0 --end=0x3ff --record=4 --lower - Altera_Forum
Honored Contributor
Thank you hallodu, your solution for creating the bootloader for a User Image works fine for me in a Cyclone IV device with Quartus 12.0.
Cheers :o --- Quote Start --- Hi, Attached is my solution. In the .zip, you have all the files needed for the .bat. 1) Enter your application address (IMAGE_START) in boot_loader_epcs_bits_sii_siii_ciii.S file 2) running this .bat 3) copy SOPC_2Dcam_epcs_flash_controller_0_boot_rom_synth.hex in your <project>/SOPC_folder/synthesis/submodules/ 4) In Quartus, Processing -> Update Memory Initialization File 5) In Quartus, Processing -> Start -> Start Assembler Be careful, the .bat is for Quartus v11.1, if you are using another version. Open the .bat file with a text editor and change all 11.1 with your version number. for example: --- Quote End --- - Altera_Forum
Honored Contributor
--- Quote Start --- Hi, The source code for the default bootloader is included in the Quartus distribution (C:\altera\11.1\ip\altera\nios2_ip\altera_nios2\boot_loader_sources) and must be modified for the application image. First you change the assembly file boot_loader_epcs_bits_sii_siii_ciii.S so that the bootloader for the application image jumps to the Nios code for the application image (which is just after the FPGA configuration for EPCS). Here is one way to change to this code: 1) Add a define to the offset to the application image:# define IMAGE_START 0x00440000 2) Replace all occurencs of the following code : (several places in the code) movi r_flash_ptr, xx with: movhi r_flash_ptr, %hi(IMAGE_START) ori r_flash_ptr, r_flash_ptr, xx 3) Add the following statement before fp_short_circuit: orhi r_flash_ptr, r_flash_ptr, %hi(IMAGE_START) This should work if the 16 lower bits of IMAGE_START are 0. Then run make (Last time I tried it I only got it working with the gcc3 quartus 10.0, not with gcc4). Then go to the obj directory and run: elf2hex --input="boot_loader_epcs_sii_siii_ciii.elf" --output="epcs_controller_boot_rom.hex" --base=0 --width=32 --end=1023 --record=4 --lower You must then replace the boot rom file in your design with this file. In Quartus 11.1 the file name may be changed to epcs_flash_controller_boot_rom_synth.hex. Note that you do not have to recompile the whole design, you just select 'Update Memory Iniialization File' in Quartus and run the asssembler after changing the bootloader. I have tested this for Stratix II,III,IV and Cyclone IV. --- Quote End --- Hi st_f, Do you have an idea how to change the bootloader on Quartus 12.1sp1 for a Cyclone IV GX? Thanks Regards - Altera_Forum
Honored Contributor
If the bootloader does not work for Cyclone IV GX it may be the valdation test fail on the Device ID in the epcs configuration data (in boot_loader_epcs_bits_sii_siii_ciii.S) . You may include the ID for Cyclone IV GX or you may skip the test as it is not nescessary. It is a simple code to understand.
I do not know were to obtain the Device ID, but you may get it from the flash file. This bootloader does however work for Cyclone IV (device ID 0xf7). - Altera_Forum
Honored Contributor
--- Quote Start --- If the bootloader does not work for Cyclone IV GX it may be the valdation test fail on the Device ID in the epcs configuration data (in boot_loader_epcs_bits_sii_siii_ciii.S) . You may include the ID for Cyclone IV GX or you may skip the test as it is not nescessary. It is a simple code to understand. I do not know were to obtain the Device ID, but you may get it from the flash file. This bootloader does however work for Cyclone IV (device ID 0xf7). --- Quote End --- Thanks for your reply! I tried to skip ID test, but it changes nothing. Attached is my file. Can I write my Image at address 0x00600000? I'm using now Quartus v12.sp1, but use boot loader sources file from v11.1. Can this create problem? Boot loader sources file from v12.sp1 are different. How must I to modify it? - Altera_Forum
Honored Contributor
Cannot find anything wrong in your changes. You should be able to change image address to 0x00600000.
I have tested the bootloader code with Quartus/SOPC Builder 12.1 and that worked. I have also been using older versions of the compiled bootloader code on newer Quartus versions without problems. - Altera_Forum
Honored Contributor
--- Quote Start --- Cannot find anything wrong in your changes. You should be able to change image address to 0x00600000. I have tested the bootloader code with Quartus/SOPC Builder 12.1 and that worked. I have also been using older versions of the compiled bootloader code on newer Quartus versions without problems. --- Quote End --- Have you tested it on a cyclone IV GX or a cyclone IV? - Altera_Forum
Honored Contributor
--- Quote Start --- Have you tested it on a cyclone IV GX or a cyclone IV? --- Quote End --- I have tested it on Cyclone IV (not GX) - Altera_Forum
Honored Contributor
OK!
I think the problem comes from the device (cyclone IV gx). I tried my bootloader with a cyclone IV and that worked. Do you have another idea what can be the problem? - Altera_Forum
Honored Contributor
I am not sure what the problem is. Does the default bootloader (from Qsys/SoPC builder) work?
Does the bootloader compiled by you work in factory mode or is the problem to restart in user mode?