Forum Discussion
Problems with generating a flash file with elf2flash
I seem to be having issues using the Flash programmer to burn my elf and sof file into flash so it can boot from this location. I have a couple of questions. I have read and followed the documentation on how to do this, but with no success.
- When I use the elf2flash utility I get a flash file of 32 bytes. That does not seem right. I get no errors from the utility and the elf file is there, loads on the hardware and executes properly using JTAG. I know the elf file is good. I looked at the flash file and it has 2 numbers in it. The elf file is about 1.1MB.
- Also when the flash programmer attempts to program the flash files into flash, it fails when it gets to the flash file I generated from my elf file. It says it can’t program or verify empty file. I am using the utility to generate the flash files and program the flash, using the sof and elf files.
- Once these issues are resolved, what do I need to do with my reset to get the system to boot from flash on power up.
6 Replies
- Altera_Forum
Honored Contributor
Hi,
Really need to know how you're calling elf2flash. What's the command like you're using? Mark. - Altera_Forum
Honored Contributor
--- Quote Start --- Hi, Really need to know how you're calling elf2flash. What's the command like you're using? Mark. --- Quote End --- Mark, Originally I was letting the Flash Programmer determine that given my BSP, sof, and elf file, but I tried a simple version in the Nios Shell. elf2flash --input=ICETest.elf --output=ICETest.flash --base=0x4000000 --end=0x6000000. The base and end were taken from what the Flash Programmer was using. I just wanted to see if a .flash file was being generated based on my elf. The flash files were generated, but they were only 32 bytes. This is consistent with the Flash Programmer generated files. - Altera_Forum
Honored Contributor
I have additional information. When I use the above command and this is similar to the command used in the Flash Programmer, it generates a .flash file of size 32 bytes. If I change the command to the following, "elf3flash --input=ICETest.elf --output=ICETest.flash --base=0x0 --end=0x4000000", it generates a 157k ,flash file. I'm confused.
- Altera_Forum
Honored Contributor
Looking at this further, maybe I don't understand the --base and --end address. When I convert the sof file to flash, what flash address to i use? It is defined in the settings.bsp file as 0x4000000 and in the linker section in the bsp editor. Do i use that same address when I convert my elf to flash? That seems to be a problem. If I use 0x0, I get something in my elf to flash file. Does anyone have a good example?
- Altera_Forum
Honored Contributor
I'm getting the identical symptom using the Board Update Portal of a CycloneIV Eval board. I'm entering the following into the NIOS2 Cygwin shell (exactly as instructed by the Altera html served by the Eval board - except reset vector is changed to match my QSYS):
elf2flash --base=0x08000000 --end=0x8ffffff --reset=0x09720000 --input=./myfile.elf --output=myfile_sw.flash --boot/$sopc_kit_nios2/components/altera_nios2/boot_loader_cfi.srec --verboseThere are no errors or warnings, and the .flash file generated is 2 words for a total of 32 bytes. (my input .elf file is 1.2kB ) Does anyone have a solution or idea what's happening? Thanks.
- Altera_Forum
Honored Contributor
Culleyd,
Once i set my reset vector correctly in quartus, the flash command worked. I opened the flash programmer from the nios II eclipse. I created a new project using my sopcinfo file. I then added my elf file. and selected start. It is working.