Forum Discussion
Altera_Forum
Honored Contributor
17 years agoProgramming 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? Valmar12 Replies
- Altera_Forum
Honored Contributor
Jake,
thank you for the nice explanation and the EPCS controller code. In the whole, I have understood it similarly. Though, at the moment, I don't look through yet all the details on that way, i.e. such as: - connection of my processor to the Avalon bus of the EPCS device (shouldn't be a problem); - possibility to make use of the HAL API functions/drivers for programming the EPCS memory (cannot judge yet); - how to replace the precompiled boot loader code in the EPCS controller compatible with the Nios II processor through the proper code for my TSK3000 (I find it most diffucult, if possible at all). That's why I have had a filling that using the ALTASMI_PARALLEL megafunction, which actually is the predecessor of the EPCS controller, might be more transparent and easier, in terms of connection to a non-NIOS processor. Or am I mistaken? Valmar. - Altera_Forum
Honored Contributor
Well let me first describe how things normally work.
1 - You can use the Quartus programmer to put any information you want into the EPCS device using the JTAG Indirect Programming method. This method uses the JTAG to program a firmware image into the FPGA which provides access to the EPCS controller. Then data is transferred via JTAG and programmed into the device. 2 - In the case of NIOS. NIOS processor can gain access to the EPCS flash by adding an EPCS controller to the processor bus. Then the NIOS can read/write the serial flash inside the EPCS device no problem. This also allows you to use software tools like "nios2-flash-programmer" to put the desired data in the flash In the case of the NIOS processor. The processor requires a boot loader that will copy the code out of the boot flash (EPCS or otherwise) and into memory before the program can begin to execute. If you don't already have something like this, then of course you'll have to create it. Your biggest problem is that you currently don't have any way for your processor to access the EPCS flash. I'm attaching a copy of the EPCS controller that gets generated by SoPC builder. This is the component that the NIOS processor uses to interface to the EPCS flash. With this code and the accompanying document: http://www.altera.com/literature/hb/nios2/n2cpu_nii51012.pdf You should be able to get something going on your system. Jake