Forum Discussion

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

Where does the boot loader come from

Hello:

I've got a NIOS 2 running out of DRAM. So I plan to put the configuration into epcs (done) and put the application program into a FLASH (also done).

I used elf2flash to create the srec filt that I loaded using a serial port bacause that's the way it will be done in the field.

I ran elf2flash --verbose --log=log.txt --input-Project.elf --output-ProjectOut.srec --base=0x09000000 --end=0x09FFFFFF --reset=0x08000000 -flash=U23 --boot=boot_loader_cfi.srec

All this ran OK and I found the boot_loader data infront of the applicatio code as expected.

My question are:

1. Is this the proper boot loader to use.

2. The sof file does not use a cfi interface but the flash device works since I can store data and erase blocks.

3. My flash interface is 16 bits wide but the boot loader looks like it's working 8 bits at a time.

4. How can I create a custom bot loader?

Thanks

George

14 Replies

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

    To close this topic.

    That boot loader was the correct one to use.

    The tools put together the proper load sequence and operate as advertized.

    The 8 bit transfer in the boot loader is fast enough.

    I had several problems all of which interfeared with proper operation.

    1.) I did a FLASH erase as a seperate process to loading code. My erase routine only erased every other block. I could not pass this off as a feature. SO I fixed it.

    2.) The FLASH devices were connected to the tri-state bus. That bus was not connected to the instruction and data master on the NIOS side.

    3.) The DMA transfers have not been tested since the 8 bit transfers are fast enough.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by gmm50@Oct 25 2005, 08:48 AM

    2.) the flash devices were connected to the tri-state bus. that bus was not connected to the instruction and data master on the nios side.

    --- Quote End ---

    Yeah, that's one of those mistakes everyone makes once and never again.

    BTW, the rationale for 8-bit transfers is that the various blocks of data in the program may not necessarily have sizes that are multiples of 2 or 4 bytes. It's barely alluded to in the bootloader source comments.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    "Yeah, that's one of those mistakes everyone makes once and never again."

    I sure hope so...........

    I thought an image aws an image so 16 bits would be 2x as fast as 8 bits???

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

    --- Quote Start ---

    originally posted by gmm50@Oct 26 2005, 03:44 PM

    i thought an image aws an image so 16 bits would be 2x as fast as 8 bits???

    --- Quote End ---

    That's correct. But reading 16 (or even 32) bits at a time would require 16 (or 32) bit alignment, which is not guaranteed by the toolchain. If the .data segment had an odd size (as it might if the last thing in it is an odd-sized char array, or maybe even just a bool or char global variable), things would get difficult fast.

    Generally speaking, though, initialization code runs only once, and isn't usually worth optimizing for speed like that.