Forum Discussion

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

Programming and booting a non-NIOS embedded apllicatio

Hi,

I wonder if anybody have already tried or can share ideas how to load a non-NOIS embedded program into a configuration EPCS device or separate SPI or CFI flash by means of the Quartus/NIOS programmer (or somehow else) and how to boot this embedded non-NIOS code when powering the board on.

My interest in solving this problem has two reasons:

1) Generally, it would be very useful to know such a solution in cases of FPGA-redesigning out-dated electronics containing hard µPs for which there already exist softcore equivalents, especially when the software is complex and been written in assembler.

2) At the moment, I have to transfer to a production board one Cyclone-targeted design made in Altium Designer (AD) and utilizing the TSK3000 processor (32-bit, MISP-like) from Altium. Actually, the AD IDE calls Quartus for synthesis getting back all configuration (and report) files including .pof, .sof, .jam etc.

The embedded tool chain of the AD IDE generates output files in .elf, .sre, and .hex formats.

From within AD IDE, I can load my configuration data into the target Cyclone FPGA on the production board using the Altium NB1 development board we have and the JTAG connection between the boards. But it is apparently impossible to load the Cyclone configuration as well as the processor program code into any flash memory to use for power-on or reset booting. Altium's technical support was not able to give any useful advise on my request regarding this issue, just promised to study it and answer.

Meanwhile, by means of the Quartus programmer (in JTAG mode) and the USB Blaster cable, I have fairly easily managed to program my configuration data into the EPCS4 device, which is done by making use of the Altera Serial Flash Loader megafunction.

But writing the embedded code into the EPCS device or another flash memory and (especially) booting it into SRAM seems to me to require more complex and tricky solutions.

I think, and I have proved it already (maybe I am wrong) that the NIOS programmer cannot be used in this case.

The reason apparently is that it uses the EPCS controller, that is absent in my design, so I get a message like “no NIOS processor in design”.

Currently I am going to further deliberate as possible solutions :

- altasmi_parallel megafunction controlled by the TSK3000 processor to load the program code into an EPCS memory. I can instantiate the altasmi_parallel megafunction in my design.

- some SPI (maybe CFI) flash controller which is controlled by the TSK3000 and loads the program code into a SPI/CFI flash.

In both cases a corresponding bootloader has to be developed for the TSK3000. For that, the NIOS II bootloaders source code might probably help a great deal. In application note AN 458, “Alternative Nios II Boot Methods“ an advanced boot copier example is described written in C with this link to the design files (citation):# a hyperlink to the design files appears next to this document on the Nios II literature page. Visit www.altera.com/literature/lit-nio2.jsp.# Unfortunately I didn’t find anything of the sort there. Does anyone have the package or correct link to download it?

Any experience or ideas how to solve the described task?

Valmar

12 Replies

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

    --- Quote Start ---

    Hi,

    I wonder if anybody have already tried or can share ideas how to load a non-NOIS embedded program into a configuration EPCS device or separate SPI or CFI flash by means of the Quartus/NIOS programmer (or somehow else) and how to boot this embedded non-NIOS code when powering the board on.

    My interest in solving this problem has two reasons:

    1) Generally, it would be very useful to know such a solution in cases of FPGA-redesigning out-dated electronics containing hard µPs for which there already exist softcore equivalents, especially when the software is complex and been written in assembler.

    2) At the moment, I have to transfer to a production board one Cyclone-targeted design made in Altium Designer (AD) and utilizing the TSK3000 processor (32-bit, MISP-like) from Altium. Actually, the AD IDE calls Quartus for synthesis getting back all configuration (and report) files including .pof, .sof, .jam etc.

    The embedded tool chain of the AD IDE generates output files in .elf, .sre, and .hex formats.

    From within AD IDE, I can load my configuration data into the target Cyclone FPGA on the production board using the Altium NB1 development board we have and the JTAG connection between the boards. But it is apparently impossible to load the Cyclone configuration as well as the processor program code into any flash memory to use for power-on or reset booting. Altium's technical support was not able to give any useful advise on my request regarding this issue, just promised to study it and answer.

    Meanwhile, by means of the Quartus programmer (in JTAG mode) and the USB Blaster cable, I have fairly easily managed to program my configuration data into the EPCS4 device, which is done by making use of the Altera Serial Flash Loader megafunction.

    But writing the embedded code into the EPCS device or another flash memory and (especially) booting it into SRAM seems to me to require more complex and tricky solutions.

    I think, and I have proved it already (maybe I am wrong) that the NIOS programmer cannot be used in this case.

    The reason apparently is that it uses the EPCS controller, that is absent in my design, so I get a message like “no NIOS processor in design”.

    Currently I am going to further deliberate as possible solutions :

    - altasmi_parallel megafunction controlled by the TSK3000 processor to load the program code into an EPCS memory. I can instantiate the altasmi_parallel megafunction in my design.

    - some SPI (maybe CFI) flash controller which is controlled by the TSK3000 and loads the program code into a SPI/CFI flash.

    In both cases a corresponding bootloader has to be developed for the TSK3000. For that, the NIOS II bootloaders source code might probably help a great deal. In application note AN 458, “Alternative Nios II Boot Methods“ an advanced boot copier example is described written in C with this link to the design files (citation):# a hyperlink to the design files appears next to this document on the Nios II literature page. Visit www.altera.com/literature/lit-nio2.jsp.# Unfortunately I didn’t find anything of the sort there. Does anyone have the package or correct link to download it?

    Any experience or ideas how to solve the described task?

    Valmar

    --- Quote End ---

    Hmmm.... Did you not see the SPI bootloader that is provided by Altium? It was added to the library - I believe - some time around Altium Designer 6.8 (When the NB2 was first released).

    It is a simple state machine slave core to the tSK3000 (or NIOS-II) that uses a Wishbone multi-master to write the boot code from an SPI flash device to the program memory (SRAM).
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hmmm.... Did you not see the SPI bootloader that is provided by Altium? It was added to the library - I believe - some time around Altium Designer 6.8 (When the NB2 was first released).

    It is a simple state machine slave core to the tSK3000 (or NIOS-II) that uses a Wishbone multi-master to write the boot code from an SPI flash device to the program memory (SRAM).

    --- Quote End ---

    Yes, I know this module and even wanted to use it at the beginning, but afterwards decided to use SPI_WB (w/o the HW-coded booting), having implemented both programming the flash with my application and booting it to the program SRAM from within my program. Besides, I use the same flash to save and read the application's non-volatile data.

    This way seemed to me to be more controllable and after all consumed less LE resources then it would be with WB_BOOTLOADER.

    Valmar