EPCS based Remote System Update (RSU) example on BeMicro SDK

From Altera Wiki
Jump to: navigation, search


Last Updated

January 30, 2012


This example demonstrates one way of implementing a robust method of for remote system update, it is a high availability and fault tolerant flow. This example deploys on the BeMicro SDK evaluation board. This board has a Cyclone IV EP4CE22 FPGA on it which gets configured from an EPCS16 flash device in Active Serial configuration mode. This example uses a Nios II processor running from onchip RAM and a basic compliment of peripherals to implement the remote system update flow. The Nios II processor is programmed to accept new update images for both software and hardware which it programs into the EPCS flash and it can then be commanded to restart the software program or trigger a hardware reconfiguration using the RSU logic in the FPGA. It can also automatically make this decision if it sees credible data in the flash as the factory boot software application executes.

Points of interest that this example contains:

  • RSU register programming of ALTREMOTE_UPDATE block.
  • a light weight onchip ROM based EPCS boot loader for Nios II applications. 4KB ROM and 2KB RAM.
  • a method of validating the system hardware ID and TS prior to executing alt_main()
  • a method of stripping the EPCS flash drivers down for read only requirements.
  • EPCS flash reading, writing, erasing, from Nios II application.
  • light weight menu driven console application running on Nios II via JTAG UART
  • a non-blocking / safe printf routine that allows the Nios II program to print thru the boot process without having a host querying the JTAG UART.
  • crc32 calculation in Nios II software application
  • base64 decoding in Nios II application
  • flash image packaging scripts that extract the data required and create headers for the image and package the combined image for download.


This example consists of an archive of the source material to build the entire hardware and software projects required to execute the demo on the BeMicro SDK board. There is also a PDF file that documents how this example is put together and the high level functionality that it performs.


Archive Download and Extraction

Download the archive for this example and place it in a directory on your system that does not include spaces in the path name. The entire path name of this directory must not contain spaces, so on Windows systems you should avoid putting this in the "My Documents" folder, or on your "Desktop" since these locations are subdirectories of the "Documents and Settings" path, and that would mean that these locations inherit the spaces in that part of the path name.

In order to extract the archives after downloading them, it is recommended that you run the "tar xzf <filename>" command from a bash shell. For linux users you should have ready access to a bash shell. For windows users, you may need to install the Altera development tools to gain access to a bash shell. On Windows it is recommended that you install the complete Altera ACDS development tools which includes the Nios II EDS development tools. Once these tool chains are properly installed on your workstation, you can launch a bash shell by running:

"Start -> Programs -> Altera -> Nios II EDS X.x -> Nios II X.x Command Shell"

Once you are in the bash shell, you can "cd" into the directory containing the archives that you've downloaded, and running the following command to extract them:

tar xzf <archive_filename>

Note that if you use some other archiving software to extract these archives, like WinZip, you may lose the execution privileges on some of the shell scripts within the archives that are used to perform various activities associated with building and using the example. If this happens, you can restore execute privileges from within a bash shell with the command "chmod +x <filename>". It is recommended that you avoid this situation by using "tar" to extract the archives from within a bash shell and avoid using any Windows oriented archive utilities with these archives.

Building the example.

Once the archive is extracted, you should locate a readme.txt file in the top level of the archive directory. Read the contents of that file for additional information about building and running the example.


This example was created and tested with the Altera ACDS 11.0sp1 development tools. Once built, the example runs on the BeMicro SDK evaluation board.

See Also

BeMicro SDK

Update History

20120130 - Updated rsu_cyclone4 component to correct a defect in the way that it derived waitrequest. In Qsys systems that create back to back transactions into the rsu_cyclone4 core with no clocks in between them, the first transaction would be seen but subsequent transactions would be missed. The rsu_cyclone4.v source file contains a 1 line modification, and the hw.tcl file that defines the component has been updated to version 1.1 from 1.0.

20111003 - Initial posting.

Outdated Releases

© 2011 Altera Corporation.
The material in this wiki page or document is provided AS-IS and is not
supported by Altera Corporation. Use the material in this document at your own
risk; it might be, for example, objectionable, misleading or inaccurate.
Personal tools