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++
12600 Discussions

nios2-flash-programmer error code 1

Altera_Forum
Honored Contributor II
1,785 Views

Hi guys. I am new to FPGA world and seems like I am having some difficulties with the flash programmer that I cannot understand. Its giving me an error code 1 which I am unable to find a reference to.  

 

Purpose of the implementation: test out different functionality of the DE2-115 board. The FPGA part of the program includes SW, KEY, LED, and lcd, all of which is connected to the nios system generated from Qsys 

 

Qsys: includes clk, cpu, onchip memory, jtag uart, sysid, epcs flash controller and a bunch of PIOs. 

 

Here is what I did: 

1. set cpu reset vector to epcs. 

2. export externals of epcs flash controllers. it gives me the following input/outputs: 

epcs_flash_controller_external_dclk => CONNECTED_TO_epcs_flash_controller_external_dclk, -- epcs_flash_controller_external.dclk epcs_flash_controller_external_sce => CONNECTED_TO_epcs_flash_controller_external_sce, -- .sce epcs_flash_controller_external_sdo => CONNECTED_TO_epcs_flash_controller_external_sdo, -- .sdo epcs_flash_controller_external_data0 => CONNECTED_TO_epcs_flash_controller_external_data0 --  

 

 

3. apply terisic patch. as suggested in their manuals to include nios-2-flash-override 

# EPCS64N(lead-free)sector_size = 65536 sector_count = 128 # EPCS128N(lead-free) sector_size = 262144 sector_count = 64 

3. import some predefined pin assignments given by terasic. 

4. On the Dual-purpose pins page (Assignments > Devices > Device and Pin Options), thefollowing pins are assigned to "Use as regular I/O": Data[0], Data[1], DCLK = Use as regular I/O, FLASH_nCE/nCS0 

5. perform port map 

u0 : component test_niosqsys port map ( clk_clk => CLOCK_50, -- clk.clk lcd_external_RS => LCD_RS, -- lcd_external.RS lcd_external_RW => LCD_RW, -- .RW lcd_external_data => LCD_DATA, -- .data lcd_external_E => LCD_EN, -- .E pio_key_external_connection_export => KEY, -- pio_key_external_connection.export pio_sw_external_connection_export => SW, -- pio_sw_external_connection.export poi_led_external_connection_export => dataop, -- poi_led_external_connection.export reset_reset_n => KEY(0), -- reset.reset_n epcs_flash_controller_external_dclk => DCLK, -- epcs_flash_controller_external.dclk epcs_flash_controller_external_sce => FLASH_nCE, -- .sce epcs_flash_controller_external_sdo => DATA1, -- .sdo epcs_flash_controller_external_data0 => DATA0 -- .data0 -- reset.reset_n );  

Node Direction Fitter Location Data0 Input PIN_AA14 Data1 Output PIN_V1 dclk Output PIN_AG12 FLASH_nCE Output PIN_AD14  

 

6. program the fpga. 

7. open nios IDE, select BSP Editor from where all components of Settings->Advanced->hal->linker we disabled 

8) built the program and select run as NIOS II hardware. At this point the program is correctly loaded and starts execution. however, upon pressing nios 2 reset key, the program stops since the epcs has not been flashed. 

 

9. open up nios ii flash programmer from nios2 ide. confirmed timestamp and system id to be a match. add the sof and elf files with default settings. ... press start; and end up with an error saying 

elf2flash --input="/media/rash-ed-u/ubuntu/altera/workspace/nios_cpu/software/prog/prog.elf" --output="/media/rash-ed-u/ubuntu/altera/workspace/nios_cpu/flash/prog_epcs_flash_controller.flash" --epcs --after="/media/rash-ed-u/ubuntu/altera/workspace/nios_cpu/flash/nios_test2_epcs_flash_controller.flash" --verbose nios2-flash-programmer "/media/rash-ed-u/ubuntu/altera/workspace/nios_cpu/flash/prog_epcs_flash_controller.flash" --base=0x81000 --epcs --sidp=0x82040 --id=0x0 --timestamp=1425416806 --device=1 --instance=0 '--cable=USB-Blaster on localhost ' --program --verbose Error: Error code: 1 for command: nios2-flash-programmer "/media/rash-ed-u/ubuntu/altera/workspace/nios_cpu/flash/nios_test2_epcs_flash_controller.flash" --base=0x81000 --epcs --sidp=0x82040 --id=0x0 --timestamp=1425416806 --device=1 --instance=0 '--cable=USB-Blaster on localhost ' --program --verbose  

 

any idea what might be wrong with what i am doing? 

 

Thanks 

 

Cheers 

Rashed
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
963 Views

found the fix: 

 

These scripts are not compatible with dash, so modify the first line from# !/bin/sh to# !/bin/bash in the folowing files: 

sof2flash elf2flash elf2hex bin2flash sh_jar.sh 

 

reference: 

http://www.alterawiki.com/wiki/quartus_for_debian_wheezy
0 Kudos
Altera_Forum
Honored Contributor II
963 Views

found the fix: http://www.alterawiki.com/wiki/quartus_for_debian_wheezy 

 

These scripts are not compatible with dash, so modify the first line from# !/bin/sh to# !/bin/bash in the folowing files: 

sof2flash elf2flash elf2hex bin2flash sh_jar.sh
0 Kudos
Reply