my first nios ii for altera de2-115 board

Download My First  Nios  II for Altera DE2-115 Board

If you can't read please download the document

Upload: jetta

Post on 26-Feb-2016

98 views

Category:

Documents


10 download

DESCRIPTION

My First Nios II for Altera DE2-115 Board. 數位電路實驗 TA : 吳柏辰. Author: Trumen. Outline. Hardware Design NIOS II IDE Build Flow Programming the CFI Flash. Hardware Design. Introduction. - PowerPoint PPT Presentation

TRANSCRIPT

My First Nios II for Altera DE2-115 Board

My First Nios II for Altera DE2-115 BoardTA: Author: Trumen1OutlineHardware DesignNIOS II IDE Build FlowProgramming the CFI Flash2Hardware Design33IntroductionThis slides provides comprehensive information that will help you understand how to create a FPGA based SOPC system implementing on your FPGA development board and run software upon it.44Required Features (1/2)The Nios II processor core is a soft-core central processing unit (CPU) that you could program onto an Altera field programmable gate array (FPGA).This chapter illustrates you to the basic flow covering hardware creation and software building.5Required Features (2/2)The example NIOS II standard hardware system provides the following necessary components:Nios II processor core, thats where the software will be executed.On-chip memory to store and run the software.JTAG link for communication between the host computer and target.Hardware (typically using a USB-Blaster cable).LED peripheral I/O (PIO), be used as indicators.6Creation of Hardware Design7

123

123same as (top-level) file name8

91

1012for DE2-1153

1211

12

3412

121313

1(double-click)

142

1215

1612(double-click)

3JTAG = Joint Test Action GroupUART = Universal Asyncronous Receiver/Transmitter16

1217

12(double-click)

341818

1219

12(double-click)

34520

1(double-click)

221

2212

2312(double-click)

3

2412

251

261

2712

281

29

3012

3

45

3112

34

32133module NiosII ( clk, rst_n, led,);input clk, rst_n;output [7:0] led;DE2_115_QSYS DE2_115_QSYS_inst ( .clk_clk(clk), .reset_reset_n(rst_n), .led_export(led),);endmodule

34123

35123

3612

3437

12

38

3912

34

40123

4112

4212

4312

441245

create_clock -period 20 [get_ports clk]derive_clock_uncertaintyset_input_delay 0 -clock clk [all_inputs]set_output_delay 0 -clock clk [all_outputs]

4612

46345

471

481

491

50When configuration is complete, the FPGA is configured with the Nios II system, but it does not yet have a C program in memory to execute.NIOS II IDE Build FlowThis Chapter covers build flow of Nios II C coded software program.51IntroductionThe Nios II IDE build flow is an easy-to-use graphical user interface (GUI) that automates build and makefile management.In this section you will use the Nios II IDE to compile a simple C language example software program to run on the Nios II standard system configured onto the FPGA on your development board.52

5312

34

54123

5512356

1

57Project DescriptionWhen you create a new project, the NIOS II SBT for Eclipse creates two new projects in the NIOS II C/C++ Projects tab:Hello_NiosII is your C/C++ application project. This project contains the source and header files for your application.Hello_NiosII_bsp is a board support package that encapsulates the details of the Nios II system hardware.58Note: When you build the system library for the first time the NIOS II SBT for Eclipse automatically generates files useful for software development, including:

Installed IP device drivers, including SOPC component device drivers for the NIOS II hardware system

Newlib C library, which is a richly featured C library for the NIOS II processor.

NIOS software packages which includes NIOS II hardware abstraction layer, NicheStack TCP/IP Network stack, NIOS II host file system, NIOS II read-only zip file system and Micrium's C/OS-II real time operating system(RTOS).

system.h, which is a header file that encapsulates your hardware system.

alt_sys_init.c, which is an initialization file that initializes the devices in the system.

Hello_world_0.elf, which is an executable and linked format file for the application located in hello_world_0 folder under Debug.

SBT: Software Build Tools58

591(right-click)259

60

61231(right-click)1. right click61

62

Edit and Re-Run the Program631264#include #include "system.h"#include "altera_avalon_pio_regs.h"

int main(){ printf("Hello from Nios II!\n"); int count = 0; int delay; while(1) { IOWR_ALTERA_AVALON_PIO_DATA(LED_BASE, 1