Главная » Просмотр файлов » DE0_Nano_User_Manual_v1.9

DE0_Nano_User_Manual_v1.9 (1162589), страница 9

Файл №1162589 DE0_Nano_User_Manual_v1.9 (Семинары) 9 страницаDE0_Nano_User_Manual_v1.9 (1162589) страница 92019-09-20СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 9)

(hello_world_0 is default name)c. Select the target hardware system’s PTF file that is located in the previously created hardwareproject directory, as shown in Figure 7-55.120Figure 7-55 Nios II IDE New Project Wizard5. Click Finish. The NIOS II IDE creates the hello_world_0 project and returns to the NIOS IIC/C++ project perspective, as shown in Figure 7-56.121Figure 7-56 Nios II IDE C++ Project Perspective for hello_world_0When you create a new project, the NIOS II IDE creates two new projects in the NIOS II C/C++Projects tab:■ hello_world_0 is your C/C++ application project.

This project contains the source and headerfiles for your application.■ hello_world_0_syslib is a system library that encapsulates the details of the Nios II systemhardware.Note: When you build the system library for the first time the NIOS II IDE automatically generatesfiles useful for software development, including:● Installed IP device drivers, including SOPC component device drivers for the NIOS II hardwaresystem● Newlib C library: a richly featured C library for the NIOS II processor.● NIOS II software packages which includes NIOS II hardware abstraction layer, NichestackTCP/IP Network stack, NIOS II host file system, NIOS II read-only zip file system and Micrium’sµC/OS-II realtime operating system (RTOS).● system.h: a header file that encapsulates your hardware system.122● alt_sys_init.c: an initialization file that initializes the devices in the system.● Hello_world_0.elf: an executable and linked format file for the application located inhello_world_0 folder under the Debug directory.7.5 Build and Run the ProgramIn this section you will build and run the program.To build the program, right-click the hello_world_0 project in the Nios II C/C++ Projects tab andselect Build Project.

The Build Project dialog box appears and the IDE begins compiling theproject. When compilation completes, a message ‘Build complete’ will appear in the Console tab, asshown in Figure 7-57.Figure 7-57 Nios II IDE hello_world_0 Build CompletedNote: If there appears in the console tab, an error, “region onchip_memory2 isfull(hello_world_0.elf section .text).

Region needs to be XXX bytes larger.” , please right-clickhello_world_0 , select System Library Properties menu, then pop a window. In the System LibraryProperties window, select Small C Library, then click OK to close the window. Rebuild the project.123After a successful compilation, right-click the hello_world_0 project, select Run As > NIOS IIHardware.

The IDE will download the program to the target FPGA development board and beginexecution. When the target hardware begins executing the program, the message ’Hello from NiosII!’ will appear in the NIOS II IDE Console tab, as shown in Figure 7-58 for an example.Figure 7-58 Hello_World_0 Program OutputNow you have created, compiled, and run your first software program based on NIOS II. And youcan perform additional operations such as configuring the system properties, editing and re-buildingthe application, and debugging the source code.7.6 Edit and Re-Run the ProgramYou can modify the hello_world.c program file in the IDE, build it, and re-run the program toobserve your changes, as it executes on the target board. In this section you will add code that willmake the green LEDs, on the DE0-Nano board, blink.Perform the following steps to modify and re-run the program:1.

In the hello_world.c file, add the text shown in blue in the example below:#include <stdio.h>124#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(PIO_LED_BASE, count & 0x01);delay = 0;while(delay < 2000000){delay++;}count++;}return 0;}2. Save the project.3. Recompile the project by right-clicking hello_world_0 in the NIOS II C/C++ Projects tab andchoosing Run > Run As > Nios II Hardware.Note: You do not need to build the project manually; the Nios II IDE automatically re-builds theprogram before downloading it to the FPGA.4.

Orient your development board so that you can observe LEDs blinking.1257.7 W hy the LED BlinksThe Nios II system description header file, system.h, contains the software definitions, name,locations, base addresses, and settings for all of the components in the Nios II hardware system. Thesystem.h file is located in the in the hello_world_0_syslib\Debug\system_description directory,and is shown in Figure 7-59.Figure 7-59 The system.h fileIf you look in the system.h file for the Nios II project example used in this tutorial, you will noticethe pio_led function.

This function controls the LEDs. The Nios II processor controls the PIO ports(and thereby the LEDs) by reading and writing to the register map. For the PIO, there are fourregisters: data, direction, interruptmask, and edgecapture. To turn the LED on and off, theapplication writes to the PIO’s data register.The PIO core has an associated software file altera_avalon_pio_regs.h. This file defines the core’sregister map, providing symbolic constants to access the low-level hardware. Thealtera_avalon_pio_regs.h file is located in the directory,altera\10.1\ip\sopc_builder_ip\altera_avalon_pio.When you include the altera_avalon_pio_regs.h file, several useful functions that manipulate thePIO core registers are available to your program.

In particular, the macroIOWR_ALTERA_AVALON_PIO_DATA(base, data)126can write to the PIO data register, turning the LED on and off. The PIO is just one of many SOPCperipherals that you can use in a system. To learn about the PIO core and other embedded peripheralcores, refer to Quartus II Version 10.1 Handbook Volume 5: Embedded Peripherals.When developing your own designs, you can use the software functions and resources that areprovided with the Nios II HAL. Refer to the Nios II Software Developer’s Handbook for extensivedocumentation on developing your own Nios II processor-based software applications.7.8 Debugging the ApplicationBefore you can debug a project in the NIOS II IDE, you need to create a debug configuration thatspecifies how to run the software.

To set up a debug configuration, perform the following steps:1. In the hello_world.c , double-click the front of the line where you would like to set breakpoint,as shown in Figure 7-60.Figure 7-60 Set Breakpoint2. To debug your application, right-click the application, hello_world_0, and select Debug as >Nios II Hardware.3. If the Confirm Perspective Switch message box appears, click Yes.After a moment, the main() function appears in the editor.

A blue arrow next to the first line of codeindicates that execution stopped at that line.1275. Select Run > Resume to resume execution.When debugging a project in the Nios II IDE, you can pause, stop or single step the program, setbreakpoints, examine variables, and perform many other common debugging tasks.Note: To return to the Nios II C/C++ project perspective from the debug perspective, click the twoarrows >> in the top right corner of the GUI.7.9 Configure System Librar yIn this section you will learn how to configure some advanced options in the Nios II IDE.

Byperforming the following steps, you can change all the available settings:1. In the Nios II IDE, right-click hello_world_0 and select System Library Properties. TheProperties for hello_world_0_syslib dialog box opens.2. Click System Library in the tree on the left side. The System Library page contains settingsrelated to how the program interacts with the underlying hardware. The settings have names thatcorrespond to the targeted NIOS II hardware.3. In the Linker Script box, observe which memory has been assigned for Programmemory(.text), Read-only data memory(.rodata), Read/write data memory(.rwdata), Heapmemory, and Stack memory, see Figure 7-61.

These settings determine which memory is used tostore the compiled executable program. You can also specify which interface you want to use forstdio , stdin, and stderr. You can also add and configure an RTOS for your application and configurebuild options to support C++, reduced device drivers, etc.4. Select onchip_memory2 for all the memory options in the Linker Script box, as shown inFigure 7-61.128Figure 7-61 Configuring System Library Properties5. Click OK to close the Properties for hello_world_0_syslib dialog box and return to the IDEworkbench.Note: If you make changes to the system properties you must rebuild your project. To rebuild,right-click the hello_world_0 project in the Nios II C/C++ Projects tab and select Build Project.129Chapter 8DE0DE0-Nano Demonstrations8.1 System RequirementsMake sure Quartus II and NIOS II are installed on your PC.8.2 Breathing LEDsThis demonstration shows how to use the FPGA to control the luminance of the LEDs by means ofpulse-width modulation (PWM) scheme.

Характеристики

Тип файла
PDF-файл
Размер
13,88 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов семинаров

Семинары
Part 1
Seminar 1
DE0_CV
DE0_CV.qsf
Datasheet
Clock
CDCLVC1104PWR.pdf
EPCQ
EPCQ64.pdf
FPGA
cyclone5_handbook.pdf
cyclone_5_datasheet.pdf
IR Receiver and Emitter
IR12_21C_TR8.pdf
IRM_V538_TR1.pdf
Power
BZX84C5V1.pdf
Optimizing_TPS62130_Output_Filter.pdf
TPS62130EVM.pdf
tps62085.pdf
tps62130.pdf
tps73701.pdf
SDRAM
IS42S16320D.pdf
UART TO USB
DS_FT232R.pdf
VIDEO-DAC
ADV7123.pdf
DE0_Nano
DE0_Nano.qsf
DE0_Nano_Datasheets
ADC.pdf
DE0_Nano_Schematic.pdf
Digital_Accelerometer.pdf
Flash_Memory.pdf
I2C_2K_EEPROM.pdf
Linear_Regulator.pdf
SDRAM.pdf
Seminar 3
modules
adder.v
fsm.v
fsm.v.bak
register.v
Seminar 4
simulation_lab
funcitonal
db
serial.db_info
serial.sld_design_entry.sci
serial.qpf
serial.qsf
serial.qws
serial.v
serial_assignment_defaults.qdf
Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6536
Авторов
на СтудИзбе
301
Средний доход
с одного платного файла
Обучение Подробнее