Forum Discussion
29 Replies
- Altera_Forum
Honored Contributor
1 - You can use the remote update core to trigger a reconfiguration.
2 - What I do for production ... . a - Install the Quartus II standalone programmer on the production PC. . b - Copy the following files from your development PC and package them with your programming files... . nios2-flash-programmer.exe . cygwin1.dll . jtag_atlantic.dll This should be all you need to run the nios2 flash programmer on the production PC. It's a whole lot faster than using the jtag indirect method with the quartus II programmer. Jake - Altera_Forum
Honored Contributor
Hi Jake, could you please share your modified boot loader? I change the boot_loader_epcs_bits_sii_siii_ciii.S under C:\altera\81\nios2eds\components\altera_nios2\boot_loader_sources, make the boot loader, convert boot_loader_epcs_bits_sii_siii_ciii.elf to hex and then update the SOF but my application image never booted.
I used Cyclone III, EPCS16, factory sof + sw image is at offset 0 of the EPCS while the application sof and its sw image is at offset 0x100000 of the EPCS. I change line 99 of the assemble code from movi r_flash_ptr, 0 to movi r_flash_ptr, 0x100000 TIA - Altera_Forum
Honored Contributor
I will reply to this later today.
Jake --- Quote Start --- Hi Jake, could you please share your modified boot loader? I change the boot_loader_epcs_bits_sii_siii_ciii.S under C:\altera\81\nios2eds\components\altera_nios2\boot_loader_sources, make the boot loader, convert boot_loader_epcs_bits_sii_siii_ciii.elf to hex and then update the SOF but my application image never booted. I used Cyclone III, EPCS16, factory sof + sw image is at offset 0 of the EPCS while the application sof and its sw image is at offset 0x100000 of the EPCS. I change line 99 of the assemble code from movi r_flash_ptr, 0 to movi r_flash_ptr, 0x100000 TIA --- Quote End --- - Altera_Forum
Honored Contributor
Have you or anyone tried to read the Remote Update hardware in the boot loader to get the starting address of the config/software? It seems to me this would make the boot loader generic for anyone using the Remote update allowing the image to be stored at any address in flash and allowing either EPCS or CFI flash to work.
Bill - Altera_Forum
Honored Contributor
OK, so I made the change (quite simple) to use the Remote Update boot address to boot from. How do I get the new SREC file into the SOF file? I see no options to add a file to the EPCS component.
Bill - Altera_Forum
Honored Contributor
Okay sorry it's taken me so long to respond. So here is the way I do it:
1 - Modify the existing epcs bootloader and compile it. Then create a HEX file out of it (using elf2hex). 2 - In Quartus, use the assignment editor to override the "INIT_FILE" parameter of the RAM block located inside the EPCS controller. Give it the name of the HEX file you created that contains your bootloader. So from within Quartus: Assignments->Assignment Editor. The assignment type is "parameter". The parameter name is "INIT_FILE". Here is what an example from one of my QSF files looks like:
As far as an example of how to modify the bootloader, I've attached one of mine to this post but I'm afraid I don't have time to explain it and it's not documented. But feel free to ask questions. This specific one is for a Stratix II GX part and works in conjunction with my own remote_update core found here: http://www.alteraforum.com/forum/showthread.php?t=3658&referrerid=2226 I've tried to optimize it for my application so I've stripped out all the code that searched the SOF image looking for a device ID. Jakeset_parameter -name INIT_FILE trio_boot_loader_epcs.hex -to "trio_sopc:trio_sopc_inst|epcs_controller:the_epcs_controller|altsyncram:the_boot_copier_rom" - Altera_Forum
Honored Contributor
Thanks Jake,
I don't understand the usage of the TRIO_USER_IMAGE_PAGE and TRIO_SAFE_IMAGE_PAGE in your bootloader. And about the reconfig status, let me confirm as following. Am I correct? 0x00: Load factory configuration image upon device power-up 0x01: Reload factory configuration image upon core nCONFIG assertion 0x02: Reload factory configuration image upon watchdog timer time out in application configuration image 0x04: Reload factory configuration image upon nSTATUS assertion in application configuration image 0x08: Reload factory configuration image upon configuration CRC error during application configuration 0x10: Reload factory configuration image upon external nCONFIG assertion in application configuration image --- Quote Start --- // Here is the drill ... // If the status word contains a 0x00, or a 0x04, we will load the safe image, // If the status word contains a 0x01, 0x02, 0x08, or 0x10, we stay in factory and load // the factory software --- Quote End --- I don't understand why we load the safe image if the status word contains a 0x00, or a 0x04? - Altera_Forum
Honored Contributor
Okay well the bootloader you are looking at was designed to allow me to have two FPGA images in FLASH (safe and user) along with two software images (safe and user). Basically whenever the board first powers up, the safe image is loaded. What we want to do is get the user image up and running as fast as possible. However, there is the possibility that the user image is corrupt. If the user image is corrupt, we want to stay in safe mode and load the safe software. This provides enough functionality so the user can download a new user image to the board.
Now remember this is a stratix II so the registers are not the same as a cyclone III. Here is what the status register bits are for stratix II: 0x00 - Normal configuration (first boot). 0x01 - Configuration occured due to a CRC error (we tried to configure and failed). 0x02 - nStatus caused the reconfiguration (I don't remember what this means. I think this is the case when it was programmed via JTAG). 0x04 - Core nCONFIG caused the reconfiguration. This is when we triggered the configuration. In other words, I told the FPGA to reconfigure. 0x08 - nConfig caused the reconfiguration. 0x10 - A watchdog timeout caused the reconfiguration. In addition the the status register bits, the Stratix II reconfig core also has a control register with a "AnF" bit that tells whether we're in factory or application mode. So here is the sequence: 1 - boot 2 - Are we in application or factory mode? 2a - If we are in application (user) mode, we go ahead and load the user software. 2b - If we are in factory (safe) mode, we continue on. 3 - Why are we in factory mode? 3a - If we are in factory mode because of a first boot or because we explicitly triggered a reconfig (like new user code was downloaded), we try to reboot using the application (user) image. 3b - If we are in factory image because of a failure (watchdog timeout, CRC error, etc.) then we assume that we must have tried to boot the application image but it failed. So we load the factory software image and we're done. It's up to the user to download a new valid application image and try again. So it looks like there is a typo in my comments and they should read: --- Quote Start --- // If the status word contains a 0x00, or a 0x04, we will load the USER image, --- Quote End --- Jake - Altera_Forum
Honored Contributor
It's clear now. Thank you very much, Jake.
- Altera_Forum
Honored Contributor
avtx30, did you get this going? I'm having trouble reconfiguring and knowing in that load that I'm not in factory mode. Param 0 is always reading 0, not 1 after a reconfigure. Are you having any better luck than I am?
Bill