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
--- 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
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 --- 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
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 --- 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
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
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
--- 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 --- Thank you for your reply! I just tried your code and got the correct .hex file. But now I am falling in another confusing issue. This afternoon I found another solution which is more complicate than yours. I just modified the "boot_loader_epcs_bits_sii_siii_ciii.S" file as st_f introduced in# 4 of this thread. After executing "make" command in Shell, I then used this command
to get the address information of the boot loader code. By checking the info.txt file, I found the boot loader codes start at address 0x1054, not 0x0. I have attached the info.txt file. I think that's why the commandnios2-elf-objdump -D boot_loader_epcs_sii_siii_ciii.elf > info.txt
will generate a .hex file with all 0. So I changed the command parameters to "--base=0x1054 --end=1453" and I got the correct boot loader code file(.hex file). I also opened your .bat file and found you use the elf2hex command with "--base=0". But your .bat file can generate the correct .hex file. I want know why this happen and what's the difference? -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 - Altera_Forum
Honored Contributor
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 Start --- set PATH=%PATH%;C:\altera\11.1\quartus\bin; -> set PATH=%PATH%;C:\altera\12.0\quartus\bin; --- Quote End --- - Altera_Forum
Honored Contributor
hallodu
I am also facing the same problem. When I use the following command --- Quote Start --- elf2hex --input="boot_loader_epcs_sii_siii_ciii.elf" --output="kernel_epcs_boot_rom_synth.hex" --base=0 --width=32 --end=1023 --record=4 --lower --- Quote End --- The .hex file is filled by 0. If I add --no-zero-fill option, the .hex file has only one line. Do you fix it? Thank you