没有合适的资源?快使用搜索试试~ 我知道了~
首页Nios II Software Developer’s Handbook.pdf
Nios II Software Developer’s Handbook.pdf
需积分: 10 38 下载量 65 浏览量
更新于2023-03-16
评论
收藏 2.03MB PDF 举报
Nios II Software Developer’s Handbook.pdf
资源详情
资源评论
资源推荐
Copyright © 2004 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera logo, specific device des-
ignations, and all other words and logos that are identified as trademarks and/or service marks are, unless noted otherwise, the trademarks and
service marks of Altera Corporation in the U.S. and other countries. All other product or service names are the property of their respective holders. Al-
tera products are protected under numerous U.S. and foreign patents and pending applications, maskwork rights, and copyrights. Altera warrants
performance of its semiconductor products to current specifications in accordance with Altera's standard warranty, but reserves the right to make
changes to any products and services at any time without notice. Altera assumes no responsibility or liability arising out of the ap-
plication or use of any information, product, or service described herein except as expressly agreed to in writing by Altera
Corporation. Altera customers are advised to obtain the latest version of device specifications before relying on any published in-
formation and before placing orders for products or services.
Printed on recycled paper
ii Altera Corporation
Preliminary
Altera Corporation iii
Preliminary
Contents
Chapter Revision Dates ........................................................................... ix
About this Handbook ............................................................................... xi
How to Contact Altera ............................................................................................................................. xi
Typographic Conventions ....................................................................................................................... xi
Section I. Nios II Software Development
Revision History ....................................................................................................................... Section I–1
Chapter 1. Overview
Introduction ............................................................................................................................................ 1–1
Getting Started ...................................................................................................................................... 1–1
Development Environment .................................................................................................................. 1–1
Tools ................................................................................................................................................... 1–1
Consistent Development Environment ......................................................................................... 1–3
Consistent Runtime Environment ................................................................................................. 1–3
Third-Party Support .............................................................................................................................. 1–3
Migrating from the First-Generation Nios Processor ....................................................................... 1–4
Further Nios II Information ................................................................................................................. 1–4
Chapter 2. Tour of the Nios II IDE
Introduction ............................................................................................................................................ 2–1
The Nios II IDE Workbench ................................................................................................................. 2–1
Perspectives, Editors & Views ........................................................................................................ 2–2
Creating a New Project ......................................................................................................................... 2–3
Building & Managing Projects ............................................................................................................. 2–4
Running & Debugging Programs ........................................................................................................ 2–5
Programming Flash ............................................................................................................................... 2–9
Online Help .......................................................................................................................................... 2–10
Section II. The HAL System Library
Revision History ..................................................................................................................... Section II–1
Chapter 3. Overview of the HAL System Library
Introduction ............................................................................................................................................ 3–1
iv Altera Corporation
Preliminary
Contents Nios II Software Developer’s Handbook
Getting Started ....................................................................................................................................... 3–1
HAL Architecture .................................................................................................................................. 3–2
Services .............................................................................................................................................. 3–2
Applications vs. Drivers .................................................................................................................. 3–3
Generic Device Models .................................................................................................................... 3–3
C Standard Library—Newlib ......................................................................................................... 3–4
Supported Peripherals .......................................................................................................................... 3–5
Chapter 4. Developing Programs using the HAL
Introduction ............................................................................................................................................ 4–1
The Nios II IDE Project Structure ........................................................................................................ 4–1
The system.h System Description File ................................................................................................ 4–2
Data Widths & the HAL Type Definitions ......................................................................................... 4–3
UNIX-Style Interface ............................................................................................................................. 4–4
File System .............................................................................................................................................. 4–5
Using Character-Mode Devices ........................................................................................................... 4–6
Standard Input, Standard Output & Standard Error .................................................................. 4–7
General Access to Character Mode Devices ................................................................................. 4–7
C++ Streams ...................................................................................................................................... 4–8
/dev/null .......................................................................................................................................... 4–8
Using File Subsystems .......................................................................................................................... 4–8
Using Timer Devices ............................................................................................................................. 4–8
The HAL System Clock ................................................................................................................... 4–9
Alarms ................................................................................................................................................ 4–9
High Resolution Time Measurement .......................................................................................... 4–11
Using Flash Devices ............................................................................................................................ 4–12
Simple Flash Access ....................................................................................................................... 4–12
Block Erasure or Corruption ......................................................................................................... 4–14
Fine-Grained Flash Access ............................................................................................................ 4–15
Using DMA Devices ............................................................................................................................ 4–18
DMA Transmit Channels .............................................................................................................. 4–19
DMA Receive Channels ................................................................................................................. 4–20
Memory-to-Memory DMA Transactions .................................................................................... 4–21
Reducing Code Footprint ................................................................................................................... 4–23
Enable Compiler Optimizations ...................................................................................................4–23
Use Small Footprint Device Drivers ............................................................................................ 4–23
Reduce the File Descriptor Pool ................................................................................................... 4–24
Use /dev/null ................................................................................................................................. 4–24
Use UNIX not ANSI C File I/O ....................................................................................................4–24
Use the Small Newlib C Library ..................................................................................................4–25
Eliminate Unused Device Drivers ............................................................................................... 4–27
Use _exit() for No Clean Exit ........................................................................................................ 4–27
Disable Instruction Emulation ...................................................................................................... 4–27
Boot Sequence and Entry Point ......................................................................................................... 4–28
Hosted vs. Free-Standing Applications ...................................................................................... 4–28
Boot Sequence for HAL-Based Programs ................................................................................... 4–29
Customizing the Boot Sequence ..................................................................................................
.4–30
Altera Corporation v
Preliminary
Contents Contents
Memory Usage ..................................................................................................................................... 4–30
Memory Sections ............................................................................................................................ 4–30
Assigning Code & Data to Memory Partitions .......................................................................... 4–31
Placement of the Heap & Stack .................................................................................................... 4–32
Boot Modes ...................................................................................................................................... 4–33
Paths to HAL System Library Files ................................................................................................... 4–33
Finding HAL Files .......................................................................................................................... 4–33
Overriding HAL Functions ........................................................................................................... 4–34
Chapter 5. Developing Device Drivers for the HAL
Introduction ............................................................................................................................................ 5–1
Integration into the HAL API ......................................................................................................... 5–1
Peripheral-Specific API ................................................................................................................... 5–1
Before You Begin .............................................................................................................................. 5–2
Development Flow for Creating Device Drivers .............................................................................. 5–2
SOPC Builder Concepts ........................................................................................................................ 5–2
The Relationship between system.h & SOPC Builder ................................................................ 5–2
Using SOPC Builder for Optimal Hardware Configuration ...................................................... 5–3
Components, Devices & Peripherals ............................................................................................. 5–3
Accessing Hardware ............................................................................................................................ 5–3
Creating Drivers for HAL Device Classes ......................................................................................... 5–4
Character-Mode Device Drivers .................................................................................................... 5–5
File Subsystem Drivers .................................................................................................................... 5–7
Timer Device Drivers ....................................................................................................................... 5–8
Flash Device Drivers ........................................................................................................................ 5–9
DMA Device Drivers ..................................................................................................................... 5–10
Ethernet Device Drivers ................................................................................................................ 5–12
Integrating a Device Driver into the HAL ....................................................................................... 5–15
Directory Structure for HAL Devices .......................................................................................... 5–15
Device Driver Files for the HAL .................................................................................................. 5–15
Summary ......................................................................................................................................... 5–19
Providing Reduced Footprint Drivers .............................................................................................. 5–19
Namespace Allocation ........................................................................................................................ 5–19
Overriding the Default Device Drivers ............................................................................................ 5–20
Section III. Advanced Programming Topics
Revision History .................................................................................................................... Section III–1
Chapter 6. Exception Handling
Introduction ............................................................................................................................................ 6–1
Nios II Exceptions Overview ............................................................................................................... 6–1
HAL Implementation ............................................................................................................................ 6–2
_irq_entry .......................................................................................................................................... 6–2
alt_irq_handler() ............................................................................................................................... 6–3
software_exception .......................................................................................................................... 6–4
剩余227页未读,继续阅读
磁场OS
- 粉丝: 35
- 资源: 636
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 2023年中国辣条食品行业创新及消费需求洞察报告.pptx
- 2023年半导体行业20强品牌.pptx
- 2023年全球电力行业评论.pptx
- 2023年全球网络安全现状-劳动力资源和网络运营的全球发展新态势.pptx
- 毕业设计-基于单片机的液体密度检测系统设计.doc
- 家用清扫机器人设计.doc
- 基于VB+数据库SQL的教师信息管理系统设计与实现 计算机专业设计范文模板参考资料.pdf
- 官塘驿林场林防火(资源监管)“空天地人”四位一体监测系统方案.doc
- 基于专利语义表征的技术预见方法及其应用.docx
- 浅谈电子商务的现状及发展趋势学习总结.doc
- 基于单片机的智能仓库温湿度控制系统 (2).pdf
- 基于SSM框架知识产权管理系统 (2).pdf
- 9年终工作总结新年计划PPT模板.pptx
- Hytera海能达CH04L01 说明书.pdf
- 数据中心运维操作标准及流程.pdf
- 报告模板 -成本分析与报告培训之三.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0