Forum Discussion

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

How to boot from SPI Flash?

I have design with spi flash to store my firmware and sdram to run it from.

My EPCS is too small to run code from it.

Can anyone give me boot-loader code to boot my system from SPI Flash?

My SPI flash is ST M25Pxx.

If I understand well, the boot-loader can integrate to the NIOS within the hardware image. Is that correct?

3 Replies

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

    Hi motal,

    > I have design with spi flash to store my firmware and sdram to run it from.

    > My EPCS is too small to run code from it.

    You really shouldn't need much code to load a small application (a 2nd stage

    boot loader) that pulls your code in from an SPI device. How much room

    is left on your EPCS?

    > If I understand well, the boot-loader can integrate to the NIOS within the

    > hardware image. Is that correct?

    Yes -- or you could try to replace/modify the default bootloader in the EPCS

    peripheral -- have it load from your SPI device rather than the EPCS device.

    From a practical point-of-view, the EPCS is just an SPI device that you

    don't get to do pin assignments for ;-)

    Regards,

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

    --- Quote Start ---

    originally posted by smcnutt@Jan 25 2007, 06:48 PM

    how much room is left on your epcs?

    --- Quote End ---

    After compression of my hardware image it's allways fit exactly to my EPCS1 - 128KB = 1MBit.

    So I can't put any software (even a little boot-loader) on the EPCS.

    I could write the low-level code to access the SPI Flash myself, but I'll be glad to get ready code, if someone already write that.

    2nd option. I saw SPI Flash core in OpenCores.com - it is possible to tell the SOPC Builder to reset from SPI memory with this core? - normally the SOPC Builder doesn't recognize SPI interfaced as memory.

    How can I add this core to SOPC builder?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi motal,

    > After compression of my hardware image it's allways fit exactly to my EPCS1 - 128KB = 1MBit.

    ...

    > I saw SPI Flash core in OpenCores.com - it is possible to tell the SOPC Builder to reset from

    > SPI memory with this core?

    Logic, code, whatever ... if you have no room left on your configuration device you're in an

    unfortunate position. Perhaps you should use a bigger configuration device. ;-)

    In any regard, I don't think I was very clear in my last post:

    > or you could try to replace/modify the default bootloader in the EPCS peripheral.

    The EPCS controller uses on-chip memory that contains a small bootloader. If you are _already_

    using the EPCS controller, you can try to replace the existing bootloader. Provided your

    (bootloader) implementation is smaller than the default, it should fit in your EPCS.

    Regards,

    --Scott