Forum Discussion

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

using flashprogrammer to program application image

I hope someone will have a quick answer.

Below is the script I am running to create a concatenated application image that I would like placed at location 100000 in a EPCS16.

I have already loaded the factory image into the EPCS16 at location 0.

Here is the programming command:

nios2-flash-programmer --epcs --base 0x00101000 max_app_pg16.flash --go

The problem is when go is executed it jumps to 0x0001000 which is the reset

vector for the factory image. I went in and tried to change the reset vector for the application load in SOPC but sopc does not like the 100000 offset. I thought the reset vector was altered using the

nios2-elf-objcopy --target srec --change-addresses 0x100000 max_app_comb.flash max_app_pg16.flash

command, but apparently not.

Thanks,

John

--------------------------------------------------------------------# H/W config image conversion

echo ">> Converting sof to flash..."

sof2flash --epcs --input=top.sof --output=top_hw.flash# Appcode (elf) must fall just after the H/W image (thus the --after param)

echo ">> Converting elf to flash..."

elf2flash --epcs --after top_hw.flash --input=max_application.elf --output=max_app.flash# Combine srec images - just cat them

echo ">> Combining HW and SW flash images..."

cat top_hw.flash max_app.flash >> max_app_comb.flash# Now get the flash base address (0x100000) inserted in the image

echo ">> Adjusting base address for combined image..."

nios2-elf-objcopy --target srec --change-addresses 0x100000 max_app_comb.flash max_app_pg16.flash

echo ">> DONE making combined flash image"

# nios2-flash-programmer --epcs --base 0x00101000 --erase-all max_app_pg16.flash --go

3 Replies

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

    Are you planning to have two images in the flash?

    When the FPGA powers up, it will always load the configuration at address 0 of the EPCS. If you want it to load another configuration, you need to use the remote update component.

    For the software, the default bootloader included with the EPCS controller always load into RAM the software placed in the EPCS, just after the configuration at address 0. If you want to boot from somewhere else, you'll have to make your own bootloader, as explained in application note 458 (http://www.altera.com/literature/an/an458.pdf).
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for the reply,

    Yes I would like two images in the FPGA and Yes I have the sopc remote configuration controller built into both FPGAs. I was just trying to work out

    my build scripts and get both images in the FPGA. I don't have the download

    portion in my design, so I was just trying to see the basic aspects of remote

    working.

    I cant't believe that you still have to build a custom bootloader. This had to be done back with stratix II and early remote reconfiguration. You would think the tools would have improved with regards to the bootloader. This makes multi-image management cubersome. Basically if I have 6 images then I have to maintain 6 distinct loads based on the loads location in flash. Good grief! Lucky for me I only need one.

    Dear Altera,

    Please add a automatic bootloader creation tool based on the images

    location in flash.

    Thanks Daixiwen,

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

    Ok,

    So I am in for a custom bootloader. Based on what I have discovered AN458 assumes you are using the NEEK and the following is an understatement:

    This example is designed to run on the Altera Nios II Embedded

    Evaluation Kit, Cyclone III Edition (NEEK). If you are using a

    different development kit, you may need to alter some of the

    steps and board support package (BSP) files as appropriate.

    I am trying to wade through and modify the build scripts, but I still have one fundemental question, where should I tell the tool that my image is?

    I want my application image at 0x100000 in a EPCS16. this is right in the

    middle of the device. Is this what I should use for the# define BOOT_IMAGE_1_ADDR ( 0x00100000 )?

    Thanks,

    John

    ------------------------------------------------------------------# elif BOOT_METHOD == BOOT_EPCS_FROM_ONCHIP_ROM

    // In an EPCS, the data is not present in the CPU's memory map, so we just

    // specify the image addresses as offsets within the EPCS. The CopyFromFlash

    // routine will work out the details later.

    // It is important to carefully choose the offsets at which to place boot images

    // in EPCS devices, ensuring they do not overlap FPGA configuration data. These

    // offsets should be sufficient for a Cyclone II 2C35 development board.# define BOOT_IMAGE_1_ADDR ( 0x00100000 )# define BOOT_IMAGE_2_ADDR ( 0x00100000 )