Forum Discussion

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

Flash Programmer Question

Can anybody explain to me does Altera Flash Programmer places boot loader automatically before main programm at flash for copying main program to sdram or not?

Or I must write my own boot loader and then tell Flash Programmer to program it before my main program?

18 Replies

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

    Hm, may be you know what raw binary file (.rbf) contains? You can produce .rbf file from QuartusII File Menu->Convert Programming FIles.

    Is it that file I can write directly to user hardware image location (0x0060000) at flash for remote update of my system?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    i have a little workaround to get a valid EPCS file for updating boards out in the field.

    I use my board at the lab, which is equipped with a jtag connector and a RS232 port, program it, using the NIOS 2 IDE flash-programmer. Then i wrote a little c-program, which dumps the EPCS content to the RS232 port. I simply use the run feature of the IDE to transfer it to the target, overwriting the main application in ram. A terminal program is used to save the output, which is formated as iHex file, in a file.

    Thats it - it is not perfect, but it works for me...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by macshiz@Dec 7 2004, 03:05 AM

    hm, may be you know what raw binary file (.rbf) contains? you can produce .rbf file from quartusii file menu->convert programming files.

    is it that file i can write directly to user hardware image location (0x0060000) at flash for remote update of my system?

    --- Quote End ---

    I'm not sure if I understand you right.

    The .rbf file is one of several alternatives to store the data generated by quartus to make a FPGA working. I use this type of file when I initialize a blank FPGA via microcontroller. These databytes are transfered 1:1 to FPGA when it is in configuration mode. If you want to use a parallel flash you need an additional configuration controller to select and serialize this data (cyclone series) on power up.

    Besides configuration data, you need firmware to run a NIOS. This firmware must be loaded to RAM after FPGA configuration is done. A bootloader manages this step. Configuration data, bootloader and firmware can be merged together and stored for example, in a serial Flash (EPCS). This is build by quartus flash programmer together with a custom design and described in 'ug_nios2_flash_programmer.pdf'.

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

    mir

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    The .rbf file is one of several alternatives to store the data generated by quartus to make a FPGA working. I use this type of file when I initialize a blank FPGA via microcontroller. These databytes are transfered 1:1 to FPGA when it is in configuration mode[/b]

    --- Quote End ---

    Thanks. This is that I want to know.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    MiR,

    The .flash file should be a standard .SREC file, and looks like one to me. See the boot-loader sources in components/altera_nios2/sdk/src/boot_loader_sources, particularly the comments in the .S file.

    When I build a flash for use with a parallel (CFI) flash chip then my .flash file contains a bootloader followed by the data blocks for the bootloader to write into memory. Each of these consists of length, address, data as you suggest.

    For EPCS the bootloader is stored in an on-chip ROM so the .flash file here should contain a set of data blocks, each containing length, address, data. This sounds like what you&#39;ve got. This data stream needs to be added on to the end of the data stream for the .sof file, becaue the bootloader (within the .S file) starts reading the data blocks from here. It sounds as though elf2flash is starting from offset 0 because it doesn&#39;t know the real start address where the data blocks should be stored.

    If you can work out how big the device configuration data is then you should be able to add the offset manually and merge the files using objcopy. I know this isn&#39;t ideal but it may be easier than writing your own boot loader.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by macshiz@Dec 8 2004, 03:27 AM

    MiR[/b]

    <div class='quotetop'>QUOTE

    --- Quote End ---

    --- Quote Start ---

    The .rbf file is one of several alternatives to store the data generated by quartus to make a FPGA working. I use this type of file when I initialize a blank FPGA via microcontroller. These databytes are transfered 1:1 to FPGA when it is in configuration mode[/b]

    --- Quote End ---

    Thanks. This is that I want to know.[/b]

    --- Quote End ---

    You can use menu:

    &#39;Assignments->Device->Device & Pin Options->Programming Files&#39;

    to select several file types you want to be generated.

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

    --- Quote Start ---

    originally posted by wombat@Dec 8 2004, 06:00 AM

    mir,

    .......

    for epcs the bootloader is stored in an on-chip rom so the .flash file here should contain a set of data blocks, each containing length, address, data. this sounds like what you&#39;ve got.

    .......

    --- Quote End ---

    There is obviously a difference in .flash files generated by NIOS IDE after linking to .elf (" ... Post-processing to create epcs_controller_boot_rom.flash ") and .flash files generated by the Flash Programmer.

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

    --- Quote Start ---

    originally posted by wombat@Dec 8 2004, 06:00 AM

    mir,

    the .flash file should be a standard .srec file, and looks like one to me. see the boot-loader sources in components/altera_nios2/sdk/src/boot_loader_sources, particularly the comments in the .s file.

    --- Quote End ---

    Hi wombat,

    thanks for your interest in my issue. Meanwhile I agree with you that .flash files are SREC files. My problem arose from comparing the .flash file produced by GUI flash programmer and the patterns I&#39;ve got when reading the EPCS content in the running application.

    Reading EPCS results in several 0xFFs followed by 0x56. A dump of the EPCS .flash file showed 0x6A as the first non FF byte. The miracle is: reading EPCS data shows content in reverse bit order:

    0x56 = %01010110

    0x6A = %01101010

    ((reading is done by &#39;alt_read_flash()&#39;)

    regards

    Mike