How to set up a NIOS II development environment in 20 minutes

Publisher:喜茶我要七分糖Latest update time:2011-11-02 Keywords:NIOSII Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Software Installation
1. First, install the NIOS II development kit. Use virtual CD-ROM software, such as DAEMON, to map the NIOS II V1.0 BUILD316E.ISO file to the virtual CD-ROM.
Click the CD-ROM icon to automatically run the installation program.

Select the first option, Install.
Select the Next button.
When asked whether to accept the agreement, select Yes. Press Yes for the next option and continue.

If you are a beginner, you can choose the last option. You can choose a language you are familiar with for Examples. It is recommended to select all other options.

Select the installation directory of QuartusII. If it is not C: drive, specify it from the Browse option. For example, e: alterakits ios2.
Next, select a program group. Generally, just press Next.
Start the installation. It takes about a few minutes to copy files.
Click Finish. An IE format document pops up. It is recommended that you read the Example Designs option carefully. You can have a better understanding of the configuration and routines of the NIOS II CPU, which will be very helpful for future debugging.
In this way, the development software is installed. Let's run our first program quickly.

2. Hello LED program debugging
1. First, back up the Example directory. Because we are going to modify the files in the directory, it is better to keep a copy. Once the modification is damaged, it can be restored. Enter the directory E: alterakits ios2 (my QuartusII is installed in the E: drive), back up the example directory, and name it example_old.
2. Enter E: alterakits ios2examplesverilog iosII_cyclone_1c20, delete the low_cost directory, and copy the low_cost.rar file we provided, and compress it at the same time to extract a low_cost directory with the same name. 3. Start
QuartusII 4.1; select File -》Open Project, or Cntl+J to open the low cost project.

After opening the project, you can see a system named low_cost_1c20. The last option in the View menu can be used to select whether to display pin allocation information.
Select the appropriate chip model (EP1C6Q240C8 for EFA-CY1C6, EP1C12Q240C8 for EFA-CY1C6):
A. Select the Assignments menu, and then select the first item: Device.


B.

Select the model of the chip on the board in Available device

. The above dialog box appears. Be sure to select No, otherwise the pin assignment will be lost.
C. Set other unused pins.
First select Device & Pin Options and see the following screen.

Open the Unused Pins tab,

select the first item, and set all unused pins to input state and set them to tri-state.
After the above processing, you can compile and download the program.
Compile the project
. Select Start compilation from the Processing menu, or Cntl + L to start compiling. If a warning message appears, you can ignore it and wait for the compilation to end.

Configure FPGA
Select Programmer from the Tools menu, select JTAG mode and the corresponding sof file, click Start,
start downloading, and if successful, then start entering the software debugging environment.

Start NIOS II IDE environment
Close Programmer and open the top-level file. The shortcut is to click the icon

Double-click the low_cost_1C20 system module to enter SOPC Builder.

Select Run Nios II IDE to enter the IDE development environment.

Create a software project file
Select File -> New -> Project option.

Select C/C++ Application and click Next.

Select Hello LED from the template, set other settings as default, and click Finish.

Compile the project file
Select hello_led_0, right-click, and select Build Project
.
After the completion, the console in the lower right corner will prompt that the compilation is completed.

Run the program
Select Run -> Run... from the menu, and a dialog box will pop up Click New to automatically generate a system configuration. Click Apply, then click Run. Start downloading the program to SDRAM and running it. Observe the 4 LEDs on the board. The LEDs will flash once every 4 seconds. Congratulations, your first C program is running on the NIOSII CPU. If you are interested, you can modify the source file, then compile and run to see what changes the LED has . Here is an example to make the LED flash more frequently: int main (void) __attribute__ ((weak, alias ("alt_main"))); /* * Use alt_main as entry point for this free-standing application */ int alt_main (void) { alt_u8 led = 0x2; alt_u8 dir = 0; volatile int i; /* * Infinitly shift a variable with one bit set back and forth, and write * it to the LED PIO. Software loop provides delay element. */ while (1) { if (led & 0x09) // There are only 4 LEDs on our board, so when Bit3 and Bit0 of led are valid, // change direction; { dir = (dir ^ 0x1);





























}
if (dir)
{
led = led >> 1;
}
else
{
led = led << 1;
}
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, led);
/*
* The delay element in this design has been written as a while loop
* to avoid confusing the software debugger. A tight, one line software
* delay loop such as:
* for(i=0; i<200000; i++);
* can cause problems when it is stepped through using a software
debugger.
* The while loop below produces the same behavior as the for loop shown
* above, but without causing potential debugger problems.
*/
i = 0;
while (i<100000) //加快闪烁间隔
i++;
}
return 0;
}

Keywords:NIOSII Reference address:How to set up a NIOS II development environment in 20 minutes

Previous article:How to use and tips for electronic simulation software MultiSIM
Next article:Easy-to-understand modelsim learning notes

Recommended ReadingLatest update time:2024-11-16 15:49

Parallel multi-channel excitation signal generation module based on FPGA
Introduction There are two ways to implement parallel testing: software and hardware. The key to implementing parallel testing with software is the decomposition and scheduling of test tasks, but this may cause competition or deadlock. Therefore, it is difficult to implement parallel testing with software w
[Embedded]
Parallel multi-channel excitation signal generation module based on FPGA
Design and application of PID speed control system for DC motor based on NiosⅡ
0 Introduction In the past, DC motor speed control systems were usually controlled by single-chip microcomputers or DSPs . However, single-chip microcomputers require a large number of peripheral circuits, and the system has poor upgradeability. For example, if the controller is replaced, the entire
[Power Management]
Design and application of PID speed control system for DC motor based on NiosⅡ
Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号