Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12732 Discussions

qspi driver in NIOS bsp in Cyclone 10

ZhiqiangLiang
New Contributor I
2,252 Views

Hi,

 

I am running NIOS II in Cyclone 10 LP 10CL120YF484.

The flash I am using is M25P64 which is qspi interface.

 

The problem is that EPCS flash controller is not compatible for Cyclone 10.

I am going to run qspi flash driver in NIOS so that I can read and write the flash.

 

The question is:

is qspi friver available? Could you please tell me the related resource of qspi driver and API?

0 Kudos
23 Replies
Archer_Altera
Employee
1,899 Views

Hi Zhiqiang,

 

You may use Quartus version 20.1 Standard or later version. Then you can find GSFI IP in Platform Designer tool and refer to document description in link below to implement the booting from GSFI flash solution.


https://community.intel.com/cipcp26785/attachments/cipcp26785/fpga-wiki/926/1/Generic_Serial_Flash_Interface_design_example_quick_start_guide_final_updated.pdf

On page 8, it describes how to change the example driver to match the device from other flash vendor.

 

Hope it is helpful.

 

0 Kudos
ZhiqiangLiang
New Contributor I
1,834 Views

@Archer_Altera 

Thank you for your reply!
This question is very critical for my design.

Is there a way by which I can run the GSFI IP on Quartus 18.1?

 

0 Kudos
Archer_Altera
Employee
1,800 Views

Hi Zhiqiang,

 

I look at quartus 18.1std tool, it has GSFI IP too. Please try it. 

 

Archer_Altera_0-1747961876259.png

 

The example design in quick start guide document is created in quartus 18.1std.1. So quartus 18.1std.1 should be OK to use this IP.

Cyclone® V FPGA – Generic Serial Flash Interface and Nios® II Processor Booting Design Example

 

If you are OK to upgrade to 18.1std.1 version, you may go to Intel® Quartus® Prime Standard Edition Design Software Version 18.1 for Windows and download update 1 setup package shown as below. 

 

Archer_Altera_1-1747962562780.png

 

Hope this is helpful.

 

0 Kudos
ZhiqiangLiang
New Contributor I
1,753 Views

@Archer_Altera 

Thank you!

 

I have already found a good IP(Serial Flash Controller Intel FPGA IP) that supports EPCS64 flash.

I have already tried this IP. I can program jic file via Quartus--> Tools--> Programmer.

but I can't program elf file via Eclipse--> NIOS II --> Flash Programmer.

 

Is there any way to program elf file or binary of C code if I use Serial Flash Controller Intel FPGA IP?

 

ZhiqiangLiang_0-1748100125200.png

 

0 Kudos
Archer_Altera
Employee
1,704 Views

Hi Zhiqiang,

 

Please refer to ug_nios2_flash_programmer document in link below, it provides the method of programming SOF and ELF file into EPCS flash.

 

https://cdrdv2.intel.com/v1/dl/getContent/666773?explicitVersion=true

 

Hope this is helpful.

0 Kudos
ZhiqiangLiang
New Contributor I
1,690 Views

@Archer_Altera 

Thank you!

I have already read the pdf you mentioned.   The picture I pasted is the result when I follow the pdf.

0 Kudos
Archer_Altera
Employee
1,649 Views

Hi Zhiqiang,

 

Below table shows the minimum component set required. Have you enabled JTAG debug module level1 or greater?

 

Archer_Altera_0-1748224273263.png

 

0 Kudos
ZhiqiangLiang
New Contributor I
1,644 Views

@Archer_Altera 

Thank you!

please see the following picture.

I don't know how to set JTAG debug level.

 

ZhiqiangLiang_0-1748226041808.png

 

0 Kudos
Archer_Altera
Employee
1,596 Views

Hi Zhiqiang,

 

It is set in Nios II processor IP shown as below. 

 

Archer_Altera_0-1748246450443.png

 

0 Kudos
ZhiqiangLiang
New Contributor I
1,592 Views

@Archer_Altera 

Thank you!

 

By default, Platform Designer set JTAG Debug mode. I have never set or changed it.

Let's go back to my question:

I followed the settings in your link pasted above, but I am still facing the issue that NIOS II Flash Programmer can't find the device.

 

Could you please tell me how to solve that issue?

If it is possible, could you please contact me by me personal email: dpstill@126.com

 

ZhiqiangLiang_0-1748247784850.png

 

0 Kudos
Archer_Altera
Employee
1,533 Views

Hi Zhiqiang,

 

Since you can download JIC file, one possible solution is to convert elf file into hex file, and then add hex file into JIC file.

 

There are detailed online descriptions for your reference as below.

 

https://www.intel.com/content/www/us/en/support/programmable/articles/000076639.html

 

https://www.cnblogs.com/xiaomeige/p/6709991.html

 

 

0 Kudos
ZhiqiangLiang
New Contributor I
1,511 Views

@Archer_Altera 

Thank you!
If I convert elf into hex file according to your link, the questions are:

1) how to specify the start flash address  of hex data?

2) how does NIOS know the start flash address of hex data?

3) will any component copy hex data from flash to RAM when NIOS boots?

 

0 Kudos
Archer_Altera
Employee
1,446 Views
0 Kudos
ZhiqiangLiang
New Contributor I
1,429 Views

@Archer_Altera 

Thank you!

I read the description related to EPCS in your link which is really helpful.

 
There are 3 steps to generate elf image hex file:
sof2flash --input= TFT_SRAM.sof --output=hwimage.flash --epcs –verbose
elf2flash --input=tft_touch.elf --output=swimage.flash --epcs --after=hwimage.flash –verbose
nios2-elf-objcopy --input-target srec --output-target ihex swimage.flash swimage.hex
 
my questions are:
1) My flash is EPCS64, in the upper commends, should I use --epce64 or --epcs? 
 
2) If I follow your link to program jic file, I don't need to generate ROM in Platform Designer, right? I should remove the ROM in the design in the following picture, right?
After I remove ROM in my design, I add "Serial Flash Controller Intel FPGA IP". 
I set NIOS II reset vector memory in the following picture.
"Serial Flash Controller Intel FPGA IP " is connected to NIOS II shown in the following picture.
 
3) when I run sof2flash command, I encountered the issue:
May 28, 2025 2:53:38 PM - (FINE) sof2flash: Starting
foo:10A10CL120YF484I7GMay 28, 2025 2:53:38 PM - (SEVERE) sof2flash: Unrecognized device family in SOF.
The sof2flash utility takes an FPGA configuration file in SOF format and
translates it to a FLASH file that can be programmed into the flash
memory connected to an Altera FPGA.
 
The device model I am using is: Cyclone 10 LP 10CL120YF484.
 
 
4) I follow the steps blow :
quartus_cpf -c --device=EPCS64 -o auto_create_rpd=on -o rpd_little_endian=on NIOS_BF5V.sof NIOS_ONLY_sof.pof
nios2-elf-objcopy -I binary -O srec --srec-forceS3 --srec-len 32 NIOS_ONLY_sof_auto.rpd NIOS_ONLY_sof.flash
nios2-elf-objcopy -I srec -O ihex NIOS_ONLY_sof.flash hwimage.hex
elf2flash --input=BF5V_C.elf --output=swimage.flash --epcs --after=NIOS_ONLY_sof.flash --verbose
nios2-elf-objcopy -I srec -O ihex swimage.flash swimage.hex
 
I can generate the hex file. however,  when I do Eclipse-->Run-->Run Configurations and  Run, Eclipse report the following error.
 
 
 
ZhiqiangLiang_0-1748432819540.png

 

ZhiqiangLiang_1-1748432850011.png

 

ZhiqiangLiang_4-1748439249278.png

 

 
ZhiqiangLiang_0-1748411118443.png

 

ZhiqiangLiang_2-1748433058691.png

 

ZhiqiangLiang_3-1748433567894.png

 

 
0 Kudos
Archer_Altera
Employee
1,351 Views

Hi Zhiqiang,

 

The steps in item 4 as you described are the right solution to solve unrecognized SOF issue when run SOF2FLASH command.

 

Now you can generate hex file. Have you tried to add it into JIC file and program into flash as described in link below? Can your system boot from epcs flash now?

 

https://www.cnblogs.com/xiaomeige/p/6709991.html

 

About error  when you try Eclipse-->Run-->Run Configurations and  Run, please kindly create a new case for it. Thank you for your cooperation.

0 Kudos
ZhiqiangLiang
New Contributor I
1,346 Views

@Archer_Altera 

Thank you!

After I generate sw hex file, I add it to Convert Programming File tool with sof file, and generate jic file and then burn it to flash with Quartus-->Tools--> Programmer tools. The programming is reported successfully.

when I generate hex file, I cannot understand those parameters, could you please help to explain them? or paste the link about the explanation of those parameters? For example, what is auto_create_rpd? why is it on? what is it for? what is  rpd_little_endian? why is it on? 

what is srec-forceS3? what is  srec-len?

 

After the upper programming, I don't know whether the SW(C code ) could be run in NIOS(FPGA) as I cannot debug it from Eclipse. The reason is pasted in my upper post.

 

Please see the third picture in my upper post. Eclipse report: Verify failed between address 0x1000000 and 0x100FFFF. 

I doubt there is a mistake in my operations. when I generate jic file, there is a map file generated. please the the map file below pasted.

My doubt is:

swimage start address in flash is: 0x00367F06,  why did Eclipse very the address 0x1000000 and 0x100FFFF?

where and how can I tell Eclipse the sw image start address?

 

 

BLOCK START ADDRESS END ADDRESS

Page_0 0x00000000 0x00367F05
swimage.hex 0x00367F06 0x00380875


Configuration device: 10CL120Y
Configuration mode: Active Serial
Quad-Serial configuration device dummy clock cycle: 8


Notes:

- Data checksum for this conversion is 0x49A89CF7

- All the addresses in this file are byte addresses

0 Kudos
SueC_Altera
Employee
1,241 Views

Hi ZhiqiangLiang,

Your original question has been answered.  For the follow on question, please start a new thread.

 

If you are looking for term definitions, please use Google or some other search engine to find definitions.  

 

Thanks,

Sue

0 Kudos
ZhiqiangLiang
New Contributor I
1,002 Views

@SueC_Altera @Archer_Altera 

The question is not answered, why should I start a new thread?
 if I created a new thread, should I copy all comments/questions to the new thread?

0 Kudos
Archer_Altera
Employee
988 Views

Hi Zhiqiang,

 

About the error you see when you do Eclipse-->Run-->Run Configurations and  Run, Eclipse report the following error. My understanding is that you want to use eclipse tool to debug your design. It is an issue related to the design or tool usage. So, I suggest you to create a new thread.

 

About the issue of programming ELF file into flash, if you still need help, we can discuss it using this thread continuously.

 

Thank your for your understanding and cooperation.

0 Kudos
ZhiqiangLiang
New Contributor I
976 Views

@Archer_Altera 

 

1) about the programming ELF question, I have asked many questions. please read previous post. For example, I have asked what those parameters means when I convert elf to hex file. I asked the question when I convert Programming Files to hex.

 

2) The issue I am facing when I debug the  C code in eclipse is outwardly related with Eclipse, but it is inwardly related with the hex file and offset address when I generated hex file.

 

in addition, I don't know which region you are in, so I wait for your reply and post new questions immediately.  However, you usually answer the new posted questions on the second day.  I don't know why the answer is so slow.

 

 

ZhiqiangLiang_0-1748928796916.png

 

0 Kudos
Reply