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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

How to read flash using nios2-flash-programmer?

Altera_Forum
Honored Contributor II
2,961 Views

I'm trying to read flash using nios2-flash-programmer. The target is a Cyclone-II based board with a CFI flash. Following the example in the users guide, I've tried this:$ ./nios2-flash-programmer --debug --base=0 --read=test.srec --read-bytes=0,256 There are no Nios II processors available which match the values specified. Please check that your PLD is correctly configured, downloading a new SOF file if necessary. 

OK, it appears that I need to download a design into the FPGA before I can use nios2-flash-programmer (presumably that's the first step performed by nios2-flash-programmer when programming flash?). 

 

Assuming one does not want to program flash, how does one download a design into the FPGA so that the above nios2-flash-programmer example will work? 

 

I've found nios2-download, but that appears to be for downloading application software to a nios2 processor, not download design info to an FPGA.
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
1,755 Views

Hey 

 

Before you can load your application into the flash, you indeed have configure the FPGA first. You can do this easily in your QUARTUS 2 software off course. 

 

QUARTUS 2 >> TOOLS >> Programmer  

 

Just scan for devices and load your FPGA .sof file into your corresponding FPGA. 

 

Now, a volatile FPGA configuration is loaded into your FPGA by JTAG. After power down this configration get lost. So, therefore you have to store your fpga data into a non-volatile memory such as your CFI flash. 

 

So, after you have loaded the .sof file you will be able to use the nios2-flash-programmer command. 

 

Regards 

Karel
0 Kudos
Altera_Forum
Honored Contributor II
1,755 Views

 

--- Quote Start ---  

originally posted by karel van haver@Dec 4 2006, 02:12 AM 

before you can load your application into the flash, you indeed have configure the fpga first. you can do this easily in your quartus 2 software off course. 

--- Quote End ---  

 

I don't have QUARTUS 2 software. 

 

Isn't there a way to configure the FPGA via command line using something from the NIOS2 development toools?
0 Kudos
Altera_Forum
Honored Contributor II
1,755 Views

 

--- Quote Start ---  

originally posted by karel van haver@Dec 4 2006, 02:12 AM 

before you can load your application into the flash 

--- Quote End ---  

It's not my application I'm concerned about, it's the .flash file with the FPGA configuration data. 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

you indeed have configure the FPGA first. You can do this easily in your QUARTUS 2 software off course.[/b] 

--- Quote End ---  

Just to be clear, are you saying The nios2_flash_programmer doesn&#39;t know how to configure the FPGA? So getting the FPGA configuration .flash file into CFI is a two step process that requires QUARTUS and nios2_flash_programmer?
0 Kudos
Altera_Forum
Honored Contributor II
1,755 Views

The flash programmer doesn&#39;t program/configure the FPGA. To do so (if you think about it), would be rather difficult, if not impossible. There is no common, hard-coded flash interface on an FPGA... It&#39;s all soft IP that is programmed at configuration time, or via the Quartus II programmer. Additionally, the flash programmer uses the same "jtag conduit" code as the QII programmer, so, if you can&#39;t use the QII programmer, you&#39;re not going to be able to use the flash programmer. There is a nios2-configure-sof command, but it is just a thin wrapper around the QII programmer. 

 

You should, however, be able to install a subset of Quartus II only for programming the device.... ("basically" the jtag-related DLLs or SOs from a QII installation) If you&#39;ve used the flash programmer (at all), you already have this subset. Try typing "jtagconfig -n", when connected to a board with a configured FPGA and you should see some useful information. Something like the following: 

1) USB-Blaster  020B40DD   EP2C35    Node 11104600    Node 0C006E00 

In the above case, the first line represents the jtag conduit medium (in this case a USB Blaster), the second line represents the type of device I&#39;m connected to (a 2C35), and the other two lines represent the CPU&#39;s jtag debug module and the jtag_uart. Think of Altera&#39;s on-FPGA JTAG implementation as a "hub" with many possible nodes. [jtag_uart, jtag_debug, Signaltap, etc.] 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,755 Views

 

--- Quote Start ---  

originally posted by slacker+dec 4 2006, 03:02 pm--><div class='quotetop'>quote (slacker @ dec 4 2006, 03:02 pm)</div> 

--- quote start ---  

the flash programmer doesn&#39;t program/configure the fpga.  to do so (if you think about it), would be rather difficult, if not impossible.[/b] 

--- quote end ---  

that makes sense. i missed it the first time through, but it&#39;s stated clearly in the users guide: 

<!--quotebegin-nios ii flash programmer user guide 

the target design must be running on the fpga before you can run the 

nios ii flash programmer on the host. 

--- Quote End ---  

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

if you can&#39;t use the QII programmer, you&#39;re not going to be able to use the flash programmer.  There is a nios2-configure-sof command, but it is just a thin wrapper around the QII programmer.[/b] 

--- Quote End ---  

Bingo -- that&#39;s the program I was looking for. I&#39;m going to try to get that running. 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

You should, however, be able to install a subset of Quartus II only for programming the device.... ("basically" the jtag-related DLLs or SOs from a QII installation).[/b] 

--- Quote End ---  

I do have the jtag stuff and can run the nios2 gdb proxy. 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

If you&#39;ve used the flash programmer (at all), you already have this subset.  Try typing "jtagconfig -n", when connected to a board with a configured FPGA and you should see some useful information.[/b] 

--- Quote End ---  

Here&#39;s what I get: 

$ ./jtagconfig --enum     1) USB-Blaster  020B30DD   EP2C20  020A10DD   EPM240The first is the Cyclone-II part (which is the one I&#39;m concerned with), the second is a Max-II part that&#39;s not relevent to this thread). If I can coax nios2-configure-sof to work, then I should be all set and won&#39;t have to have my board towed into the shop every time I manage to accidentally muck up the flash contents.
0 Kudos
Altera_Forum
Honored Contributor II
1,755 Views

nios2-configure-sof should be a snap to use... It will even browse your CWD for a SOF if you don&#39;t specify any arguments. 

 

Good luck! 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,755 Views

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

nios2-configure-sof should be a snap to use... It will even browse your CWD for a SOF if you don&#39;t specify any arguments.[/b] 

--- Quote End ---  

 

No joy. 

 

$ ./nios2-configure-sof dm_1port.sof Searching for SOF file: in .  dm_1port.sof Internal Error: Sub-system: DEV, File: /quartus/ddb/dev/dev_family_info_mgr_body.cpp, Line: 2005 Failed reading FGEN-generated ASCII family info data /home/grante/h/dev_part_manager_auto.part Stack Trace: 0x373A    : ERR_STACKWALKER::get_stack_trace(ERR_STACKWALKER::NEXT_INSTRUCTION**, int, int, void*) + 0x2C (ccl_err) 0x4DC6E   : MSG_INTERNAL_ERROR::report(char const*, char const*, char const*, int) + 0xBE (ccl_msg) 0x1725D3  : DEV_FAMILY_INFO_MGR_BODY::read_default_family_data() + 0x21B (ddb_dev) 0x16FC2E  : DEV_FAMILY_INFO_MGR_BODY::load_data_from_pdb(DEV_FAMILY_ENUM, DEV_FAMILY_INFO_MGR_BODY::DEV_FAMILY_DATA_TYPE, FIO_PATH const*) + 0x5AA (ddb_dev) 0x16C7B7  : DEV_FAMILY_INFO_MGR_BODY::get_desc_of(DEV_FAMILY_ENUM) + 0xA5 (ddb_dev) 0x11BE47  : DEV_FAMILY_MANAGER::test_trait_of(DEV_FAMILY_ENUM, DEV_FAMILY_TRAIT_ENUM) const + 0x223 (ddb_dev) 0xA0307   : PGMIO_DEVICE_MANAGER::pgmio_process_parts_file(FIO_PATH, bool) + 0x973 (pgm_pgmio) 0xA2277   : PGMIO_DEVICE_MANAGER::PGMIO_DEVICE_MANAGER() + 0x42D (pgm_pgmio) 0x9DA10   : PGMIO_DEVICE_MANAGER::get_device_mgr() + 0x66 (pgm_pgmio) 0x9CEBC   : PGM_DEVICE_INDEX::lookup_device(_Dinkum_std::basic_string<char, _Dinkum_std::char_traits<char>, MEM_STL_ALLOCATOR<char> > const&) + 0x36 (pgm_pgmio) 0x109EF   : QPGM_FRAMEWORK::create_chain() + 0x239 (quartus_pgm) 0x11B74   : QPGM_FRAMEWORK::process_operation(_Dinkum_std::basic_string<char, _Dinkum_std::char_traits<char>, MEM_STL_ALLOCATOR<char> >*) + 0x806 (quartus_pgm) 0xDB0A    : QPGM_FRAMEWORK::post_check_arguments() + 0x1A4 (quartus_pgm) 0x1C563   : (comp_qexe) 0x27DCE   : qexe_standard_main(QEXE_FRAMEWORK*, QEXE_OPTION_DEFINITION const**, int, char const**) + 0x26 (comp_qexe) 0x136E2   : qpgm_main(int, char const**) + 0x56 (quartus_pgm) 0x3B3F1   : msg_exe_main(int, char const**, int (*)(int, char const**)) + 0xB7 (ccl_msg) 0x1372A   : main + 0x40 (quartus_pgm) 0x15896   : __libc_start_main + 0xE6 (c.so.6) 0xA1E1    : __gxx_personality_v0 + 0x81 (quartus_pgm) End-trace
0 Kudos
Altera_Forum
Honored Contributor II
1,755 Views

 

--- Quote Start ---  

originally posted by grante@Dec 4 2006, 10:20 PM 

<div class='quotetop'>quote  

--- quote end ---  

 

--- quote start ---  

nios2-configure-sof should be a snap to use... it will even browse your cwd for a sof if you don&#39;t specify any arguments. 

--- Quote End ---  

 

No joy. 

 

$ ./nios2-configure-sof dm_1port.sof Searching for SOF file: in .  dm_1port.sof Internal Error: Sub-system: DEV, File: /quartus/ddb/dev/dev_family_info_mgr_body.cpp, Line: 2005 Failed reading FGEN-generated ASCII family info data /home/grante/h/dev_part_manager_auto.part Stack Trace: 0x373A    : ERR_STACKWALKER::get_stack_trace(ERR_STACKWALKER::NEXT_INSTRUCTION**, int, int, void*) + 0x2C (ccl_err) 0x4DC6E   : MSG_INTERNAL_ERROR::report(char const*, char const*, char const*, int) + 0xBE (ccl_msg) 0x1725D3  : DEV_FAMILY_INFO_MGR_BODY::read_default_family_data() + 0x21B (ddb_dev) 0x16FC2E  : DEV_FAMILY_INFO_MGR_BODY::load_data_from_pdb(DEV_FAMILY_ENUM, DEV_FAMILY_INFO_MGR_BODY::DEV_FAMILY_DATA_TYPE, FIO_PATH const*) + 0x5AA (ddb_dev) 0x16C7B7  : DEV_FAMILY_INFO_MGR_BODY::get_desc_of(DEV_FAMILY_ENUM) + 0xA5 (ddb_dev) 0x11BE47  : DEV_FAMILY_MANAGER::test_trait_of(DEV_FAMILY_ENUM, DEV_FAMILY_TRAIT_ENUM) const + 0x223 (ddb_dev) 0xA0307   : PGMIO_DEVICE_MANAGER::pgmio_process_parts_file(FIO_PATH, bool) + 0x973 (pgm_pgmio) 0xA2277   : PGMIO_DEVICE_MANAGER::PGMIO_DEVICE_MANAGER() + 0x42D (pgm_pgmio) 0x9DA10   : PGMIO_DEVICE_MANAGER::get_device_mgr() + 0x66 (pgm_pgmio) 0x9CEBC   : PGM_DEVICE_INDEX::lookup_device(_Dinkum_std::basic_string<char, _Dinkum_std::char_traits<char>, MEM_STL_ALLOCATOR<char> > const&) + 0x36 (pgm_pgmio) 0x109EF   : QPGM_FRAMEWORK::create_chain() + 0x239 (quartus_pgm) 0x11B74   : QPGM_FRAMEWORK::process_operation(_Dinkum_std::basic_string<char, _Dinkum_std::char_traits<char>, MEM_STL_ALLOCATOR<char> >*) + 0x806 (quartus_pgm) 0xDB0A    : QPGM_FRAMEWORK::post_check_arguments() + 0x1A4 (quartus_pgm) 0x1C563   : (comp_qexe) 0x27DCE   : qexe_standard_main(QEXE_FRAMEWORK*, QEXE_OPTION_DEFINITION const**, int, char const**) + 0x26 (comp_qexe) 0x136E2   : qpgm_main(int, char const**) + 0x56 (quartus_pgm) 0x3B3F1   : msg_exe_main(int, char const**, int (*)(int, char const**)) + 0xB7 (ccl_msg) 0x1372A   : main + 0x40 (quartus_pgm) 0x15896   : __libc_start_main + 0xE6 (c.so.6) 0xA1E1    : __gxx_personality_v0 + 0x81 (quartus_pgm) End-trace 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=19827)</div> 

[/b] 

--- Quote End ---  

 

 

Haven&#39;t seen that one before. In general, if nios2-download and debug (GDB or Insight) function, then all else should just work. They all use the same jtag interface to access the FPGA. 

 

What platform (OS and version of tools....Quartus II, Nios II, etc.) are you running? It might be a known issue, though I&#39;ve not heard of it. If you&#39;re running any sort of unsupported OS, especially some odd Linux flavor, it always takes more tweaking to get things functional. I run AMD64-based Gentoo Linux, with just a few modifications for setup/initialization and library path detection issues. 

 

Cheers, 

 

- slacker
0 Kudos
Reply