Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

pof file for EPC4/EPC8/EPC16

Here's how to get a .pof file for the EPC4/EPC8/EPC16 configuration devices which include the FPGA configuration data as well as the NiosII boot code. This is for users who want to download their executable to the EPC flash and then use the EPC device's External Flash Interface to run the Nios from the EPC flash. This goes into detail on how to set up the SOPC Builder project and IDE to execute from flash, as well as how to generate the .pof file.

Users should refer to Altera's Configuration Handbook for configuration data sizes (section I, chapter 1) and the EPC memory map (Section I, chapter 3.)

-Determine the size of the configuration data in bytes (see the Configuration Handbook)

-Add 0x10000 to the config data size (see the EPC memory map.)

-Select an address above this for the start of the Nios II code.

-In SOPC Builder

-Click on the More "<cpu name>" Settings tab

-Set the "Memory Module" for the "Reset Address" to "<EPC flash device name>"

-Set the "Offset" to the address determined above

-Click "Generate" to re-generate the system

-Exit SOPC Builder

-In the IDE

-Select the software project&#39;s system library, right-click, and select "Properties"

-In the "Properties" window, select "System Library" on the right

-On the far right, set "Program memory" and "Read-only data memory" to "<EPC flash device name>"

-Click OK and re-build the project

-Open a NiosII SDK Shell

-In the SDK shell, cd to the SW project directory, then cd into "software/<project name>/Release

-Run the following command, replacing the stuff in <> to the right names:

nios2-elf-objcopy -O ihex <project name>.elf <file name>.hex

-In Quartus II, open the "Convert Programming Files" tool

-Select the EPC8 configuration device

-In the bottom window, click on "SOF Data" then click "Add File..." and select the .sof file for the device

-In that same window, click on "Main Block Data" then click "Add File..." and select the code hex file created above

-Make sure that the hex file properties are set to "Absolute Addressing" not "Relative Addressing"

-Select the output .pof file

-Click OK

-Program the EPC8 with the .pof file, configure the device and see that the Nios 2 is running.

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by wmoyer@Sep 19 2005, 05:00 PM

    -add 0x10000 to the config data size (see the epc memory map.)

    --- Quote End ---

    0x10040 for the EPC16 at least. Those extra 0x40 bytes are for the option settings.

    Also, you skipped the bit about creating a custom component for the EPC4/8/16 in SOPC Builder. There are a couple of gotchas. One is that, after creating the component, you have to go into its class.ptf file, go to the CLASS/MODULE_DEFAULTS/SLAVE/SYSTEM_BUILDER_INFO section, and add the line:

    Is_Nonvolatile_Storage = "1";

    This keeps it from giving you grief about the reset vector being in "volatile" memory, and this flag is also used in both the SOPC builder and the IDE for determining which memory devices are valid choices for things like the text/rodata/rwdata sections. (It&#39;s also used in other places like the eCos/Nios2 Config Tool.)

    Another is that you have to define the component&#39;s bus interface as an Avalon Tristate Bus, and add the appropriate bridge to the system. You need to make sure you wire the right address lines from the bus bridge to the pins on the EPC4/8/16; we were off by a bit the first time we tried (EPC16 has A20-A0, data sheet says not to use A20; bridge has A20-0; the correct way to wire it was connecting the bridge&#39;s A[20:1] to the EPC16&#39;s A[19:0]). Note that the LSB of the bridge&#39;s address always selects bytes.

    I&#39;m kind of impressed that you made this work, given that Altera doesn&#39;t have the data sheet for the underlying flash chip in the EPC8.