Digital Signal Processing Reference
In-Depth Information
#include "rpds_software.h"
int main( void ) {
unsigned char led_val = 1;
/* Print message to the Nios II IDE console via UART */
printf( "Hello World\n" );
while(1) {
/* Output a 8-bit value to the LEDs */
IOWR_ALTERA_AVALON_PIO_DATA( LEDS_BASE, (led_val & 0xFF) );
if( led_val == 0x80 )
led_val = 1;
else
led_val = led_val << 1;
/* Wait for 0.5 seconds */
usleep( 500000 );
}
return(0);
}
Figure 16.8 This is your first C program's main source file.
16.7 Downloading the Nios II Hardware and Software Projects
To execute your software on a Nios II processor, you must configure the FPGA
with the Nios II hardware reference design and then you can download the
compiled program code to the processor's program memory.
Connect the USB cable. Verify that the Run/Prog switch on the DE board is set
to Run , and then turn on the DE board. Select Tools Quartus II
Programmer… to configure the FPGA. When the Quartus II Programmer
appears, click on Add File… and select the rpds16.sof file from your project
directory. Click Open to add the selected file to the download chain. Check the
Program/Configure box on the row with your configuration file on it, and
click Start to begin hardware configuration.
Return to the Nios II IDE window. From the Nios II IDE window, right click
the rpds_software item in the Nios II C/C++ Projects pane and select Build
Project from the drop-down menu. This will begin a full compilation of all
libraries in your project.
IMPORTANT: In the reference hardware design, SW9 is used as the Nios II
processor's reset signal. Before code can be downloaded to the processor, it
must be brought out of reset by setting SW9 in the up (or on) position.
To download the compiled code to the Nios II processor executing on the
FPGA, right click the rpds_software item in the Nios II C/C++ Projects pane
Search WWH ::




Custom Search