Forum Discussion

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

Flash Programmer and hex files

Hi everyone,

I have a quartus2 project with a nios2 processor. I have made a C code to run on the cpu. I download both HD and SW in an EPCS flash memory. On start-up everything goes well.

Now I'd like to add some data in the free memory of the epcs. I have created an hex file with quartus where I have written my data. This file's size is the size of a sector in the ecps (65536 bytes). Then in the flash programmer in nios IDE, I have checked "add a file into file memory", selected my file.hex, set the memory as "ecps_flash_controller" and set an offset big enough to avoid data overlaping (i-e : my data will be written in the last sector of the epcs memory).

When I click on program, the first two steps are ok (HW and SW programming) but when the IDE tries to program the hex file, an error occurs :

# creating .flash file for the datafile

"$sopc_kit_nios2/bin/bin2flash" --base=0x00011800 --location=0x40000 --input="d: /1846/ix_electronic/nios/test_on_ep3c10/factory_modes.bin" --output="factory_modes.flash"

# programming flash with the datafile

"$sopc_kit_nios2/bin/nios2-flash-programmer" --epcs --base=0x00011800 --cable='byteblastermv [lpt1]' --sidp=0x00012128 --id=810685876 --timestamp=1242721512 --go "factory_modes.flash"

using cable "byteblastermv [lpt1]", device 1, instance 0x00

resetting and pausing target processor: ok

reading system id at address 0x00012128: verified

input file is too large to fit (device size = 0x80000)

leaving target processor paused

What I see is that the IDE should use a file ".bin". Can someone tell me how to create such a file?

thank you

3 Replies

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

    I usually use an objcopy (like nios2-elf-objcopy) for things like this. In this case, I think an:

    objcopy -I ihex -O srec <input file.hex> <output file.srec>

    will work

    Cheers, and Good luck!

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

    Hey,

    I have solved my problem. I convert the hex file with the "Nios II Command Shell" :

    nios2-elf-objcopy -I ihex -O binary <input file.hex> <output file.bin>

    Thanks MSchmitt and Ura