Forum Discussion

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

several elf files in flash

Hi all...

How can I do to write several nios2 applications (elf files) sequentially in flash (without boot_copier) ?

Is there a way to set a address where the programmer starts to write in flash?

Thanks.

6 Replies

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

    You should be able to use elf2flash and specify the offset using the --offset flag - just cat the files together and run use nios2-flash-programmer

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

    --- Quote Start ---

    originally posted by jdhar@Mar 29 2006, 07:47 PM

    you should be able to use elf2flash and specify the offset using the --offset flag - just cat the files together and run use nios2-flash-programmer

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=13905)

    --- quote end ---

    --- Quote End ---

    Hello jdhar, thanks for your answer...

    The offset flag wasn&#39;t specified in the elf2flash help..... thanks...

    But I couldn&#39;t generate the flash without boot_loader... I want to write several applications in the flash, each one in determined address. My goal is to create a software that copy a determined application to exception area of a processor (there is 3 nios2) to be run. Therefore the boot_loader isn&#39;t necessary, but I don&#39;t know how to generate the .flash without it.

    Follow the command that Im using:

    elf2flash --silent --input=myprogram --output=./myprogram.flash --sim_optimize=0 --base=0x00000000 --end=0x007fffff --reset=0x00000000 --boot=C:/altera/kits/nios2_51/components/altera_nios2/boot_loader_cfi.srec --ofset=0x00100000

    It occurs an error without --boot tag.

    Regards,

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

    Try relocate your elf to binary with nios2-elf-objcopy, then use bin2flash.

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

    Hello...

    Thanks for your instructions...

    I followed them and I got the .flash without boot loader, but the size of final .flash file (elf=>bin=>flash) is greater that size of old flash file (elf => flash, with boot loader). I analyzed the two flash files and I could see that there were 65 words (32bits) whith 0x00000000 value in bin=>flash file. I think that nios2-elf-objcopy filled some section with 0, but I don&#39;t know what happened...

    Any idea?

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

    what is the result size?

    Or try strip symbols,

    nios2-elf-strip apps
    nios2-elf-objcopy -O binary apps apps.bin
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello...

    The difference between the file sizes (file_bin->flash - file_elf->flash) is 160 bytes. I tested 5 different examples, and there was the same result.

    Follow the result of test with a program:

    (The blue area is the data to be writed in flash, the green word is the beginning of boot_loader code, and the red word is the beginning of program code).

    [u][b]S012000068656C6C6F5F62696E2E666C61736805

    S3250000000004FF7FEF7A3031004C0000C6260300C03A313100260100C004010006344000C6CB

    S32500000020045300C6170000C63A6800C000000000000000000000000000000000000000005E

    S3250000004000000000000000000000000000000000000000000000000000000000000000009A

    S3250000006000000000000000000000000000000000000000000000000000000000000000007A

    S3250000008000000000000000000000000000000000000000000000000000000000000000005A

    S325000000A000000000000000000000000000000000000000000000000000000000000000003A

    S325000000C000000000000000000000000000000000000000000000000000000000000000001A

    S325000000E00000000000000000000000000000000000000000000000000000000000000000FA

    S325000001000000000000000000000000000000000000000000000000000000000000000000D9

    S3250000012000000000000000000000000000000000000000003480C0060400C0DE7440800663

    S32500000140049383D67440400004AD6308744080000402B01026038008150000080401400884

    ...

    </span>

    In file_elf->flash, the first word (3A700100) is the first word of boot_loader too. The boot_loader part finishes before the red word (04FF7FEF), wich is the beginning of the program.

    In file_bin->flash is writed 11 words and the rest are zeros (528 zeros). After the zeros, two words is missing (orange words in file_elf->flash), and the remaining is the same for two files.

    I don&#39;t know why it writed these 528 zeros.

    I tryed to use strip, but the result is the same like bin->flash...