Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
21615 Discussions

Flash Programmer and hex files

Altera_Forum
Honored Contributor II
3,292 Views

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
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
2,492 Views

there are hex2bin converters google for them if you need one.

0 Kudos
Altera_Forum
Honored Contributor II
2,492 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
2,492 Views

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
0 Kudos
Reply