Altera Nios II Spezifikationen

Stöbern Sie online oder laden Sie Spezifikationen nach Prozessoren Altera Nios II herunter. Altera Nios II Specifications [en] Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 468
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 0
Nios II Classic Software Developer’s
Handbook
Subscribe
Send Feedback
NII5V2
2015.05.14
101 Innovation Drive
San Jose, CA 95134
www.altera.com
Seitenansicht 0
1 2 3 4 5 6 ... 467 468

Inhaltsverzeichnis

Seite 1 - Handbook

Nios II Classic Software Developer’sHandbookSubscribeSend FeedbackNII5V22015.05.14101 Innovation DriveSan Jose, CA 95134www.altera.com

Seite 2 - Contents

alt_alarm_start()... 14-10alt_a

Seite 3

Copied BSP FilesTable 4-7: Copied BSP FilesFile Name FunctionHAL Directory Contains HAL source code files. These are all copied files. The src directo

Seite 4

HAL BSP After BuildHAL BSP After Buildmy_hal_bspsettings.bsppublic.mklinker.xmemory.gdbmem.init.mksystem.halt_sys_init.clinker.hMakefileHALsrc (*.c,*.

Seite 5

Linker Map ValidationWhen a BSP is generated, the SBT validates the linker region and section mappings, to ensure that theyare valid for a HAL project

Seite 6

For more information, refer to an example of custom Tcl script usage in the “Creating Memory Initializa‐tion Files” chapter.Note: Any settings you spe

Seite 7

# and return immediately. if { [regexp .*stdio.* $module_name] } { return $slave_desc}# Assume it is a JTAG UART if the module class name

Seite 8

if {$first_jtag_uart == "none"} { set first_jtag_uart $slave_desc } } # Track last character device in case no JTAG UARTs

Seite 9

Related InformationRegenerating Your BSP on page 4-30How to Rebuild Your BSPIn the Nios II SBT for Eclipse, right-click the BSP project and click Buil

Seite 10 - Altera Corporation

• You change your hardware design, but all BSP system-dependent settings remain consistent with thenew .sopcinfo file. The following are examples of s

Seite 11

Updating Your BSPWhen you update a BSP, you recreate the BSP settings file based on the current hardware definition andprevious BSP settings.Note: You

Seite 12

For more information about preserving all settings, including the default settings, use the DONT_CHANGEkeyword, described in the “Top Level Tcl Script

Seite 14 - Nios II EDS Development Flows

By recreating the BSP settings file with a Tcl script that specifies all BSP settings, you can reproduce theoriginal BSP while ensuring that system-de

Seite 15 - Nios II Programs

Script Level Summarybsp-timer-utils.tcl Helper Specifies system timer device setting.bsp-linker-utils.tcl Helper Specifies memory regions and section

Seite 16 - BSP Project

The bsp-set-defaults.tcl script sets the following defaults:• stdio character device (bsp-stdio-utils.tcl)• System timer device (bsp-timer-utils.tcl)•

Seite 17 - Software Examples

finds no slave descriptors fitting either description, it chooses the last character device slave descriptorconnected to the Nios II processor. If bsp

Seite 18

• hal.linker.allow_code_at_reset• hal.linker.enable_alt_load_copy_rodata• hal.linker.enable_alt_load_copy_rwdata• hal.linker.enable_alt_load_copy_exce

Seite 19 - Development

specific procedure in the helper scripts, if you want to invoke some of the default Tcl functionality withoutrunning the entire default Tcl script.The

Seite 20

Table 4-11: Memory Types Recognized when Making Decisions about Your Boot Configura‐tionMemory Type Examples IsFlash IsNonVolatileStorageFlash Common

Seite 21 - Interface

Run from Initialized Memory ConfigurationThe reset address points to the beginning of the application in memory (no boot loader). The resetmemory must

Seite 22 - Creating a Project

For more information about how each GUI is primarily a thin layer providing graphical control of thecommand-line tools, refer to “The Nios II Command-

Seite 23 - Specifying the BSP

plugins for access to the Nios II SBT, enabling you to create applications based on the Altera HAL, anddebug them using the JTAG debugger.You can laun

Seite 24 - Configuring the FPGA

nios2-bsp-console...15-21alt-file

Seite 25

For more information, refer to the “GNU Compiler Tool Chain” chapter.For more information about launching the Nios II Command Shell, refer to the &quo

Seite 26

Nios II Software Build ToolsThe Nios II SBT utilities and scripts provide the functionality underlying the Nios II SBT for Eclipse. Youcan create, mod

Seite 27

Utility Descriptionelf2dat Converts a .elf file to a .dat file format appropriate for VerilogHDL hardware simulators.elf2flash Converts a .elf file to

Seite 28

Tool Descriptionjtagconfig Allows you configure the JTAG server on the hostmachine. It can also detect a JTAG chain and set up thedownload hardware co

Seite 29

Date Version ChangesMay 2008 8.0.0• Advanced exceptions added to Nios II core.• Added instructions for writing instruction-related exceptionhandler.•

Seite 30

Overview of the Hardware Abstraction Layer52015.05.14NII5V2SubscribeSend FeedbackThe HAL is a lightweight embedded runtime environment that provides a

Seite 31 - Creating a Simple BSP

For more information about creating a new project with the Nios II SBT, refer to the Getting Started fromthe Command Line chapter of the Nios II Softw

Seite 32 - Eclipse Source Management

developers. Device drivers communicate directly with hardware through low-level hardware accessmacros.For further details about the HAL, refer to the

Seite 33 - User Source Management

hardware, rather than calling your driver routines directly. Therefore, the usage of your driver is alreadydocumented as part of the HAL API.C Standar

Seite 34 - Using the BSP Editor

• Character mode devices• UART core• JTAG UART core• LCD 16207 display controller• Flash memory devices• Common flash interface compliant flash chips•

Seite 35 - The Command Area

Overview of Nios II Embedded Development12015.05.14NII5V2SubscribeSend FeedbackThe Nios II Software Developer's Handbook has been divided into tw

Seite 36 - The Drivers Tab

For more information about Altera-provided peripherals, refer to the Embedded Peripherals IP UserGuide.Related InformationEmbedded Peripherals IP User

Seite 37 - The Linker Script Tab

Date Version ChangesMarch 2009 9.0.0• Reorganized and updated information and terminology to clarifyrole of Nios II Software Build Tools.• Corrected m

Seite 38 - The Console Area

Developing Programs Using the HardwareAbstraction Layer62015.05.14NII5V2SubscribeSend FeedbackThis chapter discusses how to develop embedded programs

Seite 39 - Creating a New BSP

Related Information• The system.h System Description File on page 6-3• Getting Started with the Graphical User Interface on page 2-1• Nios II Software

Seite 40 - BSP Validation Errors

For more information about how the SBT keeps your BSP up-to-date with your hardware system, refer to“Revising Your BSP” in the "Nios II Software

Seite 41 - The Debugger Tab

Data Widths and the HAL Type DefinitionsFor embedded processors such as the Nios II processor, it is often important to know the exact width andprecis

Seite 42 - Optimizing Project Build Time

• ioctl()• isatty()• kill()• lseek()• open()• read()• sbrk()• settimeofday()• stat()• usleep()• wait()• write()The most commonly used functions are th

Seite 43 - Road Map

The HAL file infrastructure also allows you to manipulate character mode devices with UNIX-style pathnames. The HAL registers character mode devices a

Seite 44 - Import a Supporting Project

Example 6–3. Hello World#include <stdio.h>int main (){printf ("Hello world!");return 0;}When using the UNIX-style API, you can use th

Seite 45 - Packaging a Library for Reuse

printed in response to several conditions. Altera logging can be enabled and disabled independently ofany normal stdio output, making it a powerful de

Seite 46 - Creating a Software Package

Nios II Software Development EnvironmentThe Nios II EDS provides a consistent software development environment that works for all Nios IIprocessor sys

Seite 47

completes initialization, run the nios2-terminal command from the Nios II Command Shell toaccept the Altera logging output.Extra Logging OptionsIn add

Seite 48 - Starting the Flash Programmer

Name DescriptionJTAG startuplogPurpose At JTAG UART driver initialization, print out a line with thenumber of characters in the software transmit buff

Seite 49

Name DescriptionBoot logPurpose Prints out messages tracing the software boot process. The boot logis turned on by default when Altera logging is enab

Seite 50 - Flash Programmer Options

Example: Creating a BSP with Logging• System clock log• JTAG startup log• JTAG interval log, logging twice a second• No write echoExample 6–6. Creati

Seite 51 - Program Files

Location File Namecomponents/altera_hal/HAL/src/ alt_log_printf.ccomponents/altera_nios2/HAL/src/ alt_log_macro.SNote: All file locations are relative

Seite 52

The following features and restrictions apply to the host based file system:• The host-based file system makes the Nios II C/C++ application project d

Seite 53

At runtime, you can obtain the current value of the system clock by calling the alt_nticks() function.This function returns the elapsed time in system

Seite 54 - Nios II GCC Tool Chain

.../* The alt_alarm must persist for the duration of the alarm. */static alt_alarm alarm;...if (alt_alarm_start (&alarm,alt_ticks_per_second(),my_

Seite 55

printf ("time in func1 = %u ticks\n",(unsigned int) (time2 - time1));printf ("time in func2 = %u ticks\n",(unsigned int) (time3 -

Seite 56 - Eclipse Usage Notes

Simple Flash AccessThis interface consists of the functions alt_flash_open_dev(), alt_write_flash(),alt_read_flash(), and alt_flash_close_dev().For mo

Seite 57 - Renaming Nios II Projects

The Nios II SBT for Eclipse is based on the popular Eclipse framework and the Eclipse C/C++ develop‐ment toolkit (CDT) plugins. The Nios II SBT create

Seite 58 - CDT Limitations

Then the second write begins, but before writing to the second block, the block is erased. At this point,t(3), the flash contains 4 KB of 0xAA and 4 K

Seite 59

return 0;}alt_get_flash_info()alt_get_flash_info() gets the number of erase regions, the number of erase blocks in each region, andthe size of each er

Seite 60 - Build Configurations in SBT

int alt_erase_flash_block ( alt_flash_fd* fd, int offset, int length )The flash memory is identified by the handle fd. The block is identified as bein

Seite 61

return 0;}alt_lock_flash()Prototypeint alt_lock_flash(alt_flash_dev * flash_info,alt_u32 sectors_to_lock)Commonly Called ByC/C++ programsDevice driver

Seite 62

Using DMA DevicesThe HAL provides a device abstraction model for direct memory access (DMA) devices. These areperipherals that perform bulk data trans

Seite 63

DMA Transmit ChannelsDMA transmit requests are queued using a DMA transmit device handle. To obtain a handle, use thefunction alt_dma_txchan_open(). T

Seite 64 - Utilities

alt_dma_rxchan_prepare() function to post receive requests. The prototype foralt_dma_rxchan_prepare() is:typedef void (alt_rxchan_done)(void* handle,

Seite 65 - Command Summary

} else { /* Post the receive request */ if (alt_dma_rxchan_prepare (rx, buffer, 1024, dma_done, NULL) < 0)

Seite 66

Null)) < 0){printf ("Failed to post transmit request, reason = %i\n", rc);exit (1);}/* Post the receive request */if ((rc = alt_dma_rxcha

Seite 67 - Tcl Scripts

Enable Compiler OptimizationsTo enable compiler optimizations, use the -Os command-line option for the nios2-elf-gcc compiler. The-Os option sets a co

Seite 68 - Prerequisites

Nios II Software Project TypesApplication ProjectA Nios II C/C++ application project consists of a collection of source code, plus a makefile. A typic

Seite 69

input through stdin. You can control the assignment of stdin, stdout, and stderr channels bymanipulating BSP settings.Use a Smaller File I/O LibraryUs

Seite 70 - Debugging hello_world

Limitation Functions AffectedNo support for opening/closing FILE *. Only pre-openedstdout, stderr, and stdin are available. The functions listedare no

Seite 71

For more information about the GCC small newlib C library, refer to the newlib documentation installedwith the Nios II EDS. On the Windows Start menu,

Seite 72 - Creating a BSP with a Script

but all other library functionality is available. You can refer to stdin, stdout, and stderr as you would toany other file descriptor. You can also re

Seite 73

alt_getchar()Equivalent to getchar(). In conjunction with the lightweight device driver API, this function furtherreduces code footprint. In the absen

Seite 74 - Argument Purpose

Eliminate All Exit CodeMany embedded systems never exit at all. In such cases, exit code is unnecessary. You can eliminate allexit code through a BSP

Seite 75 - Running make

Boot Sequence for HAL-Based ProgramsSystem Initialization Code Boot SequenceThe HAL provides system initialization code in the C runtime library (crt0

Seite 76

Function alt_main() calls function main(). After main() returns, the default alt_main() enters aninfinite loop. Alternatively, your custom alt_main()

Seite 77

In a memory device containing the reset or exception address, the linker creates a normal (nonreserved)memory section above the .entry or .exceptions

Seite 78 - Makefiles

• .text—All remaining code• .rodata—The read-only data• .rwdata—Read-write data• .bss—Zero-initialized dataYou can control the placement of .text, .ro

Seite 79 - Makefile Targets

Name DescriptionHost file system Refer to the "Developing Programs Using theHardware Abstraction Layer" chapter.Related Information• Etherne

Seite 80 - Applications and Libraries

representation of memory showing unused or overlapping regions. You start the BSP Editor fromthe Nios II Command Shell. For details about using the BS

Seite 81 - Board Support Packages

Figure 6-4: Small Global Data SectionsRAM.rwdata.bss.sbss2.sbss.sdata2.sdataIf the total size of the small global data structures is more than 64 KB,

Seite 82

Boot ModesThe processor’s boot memory is the memory that contains the reset vector. This device might be anexternal flash or an Altera EPCS serial con

Seite 83 - Common BSP Tasks

For more information about what happens when you regenerate a BSP, refer to “Revising your BSP” inthe "Nios II Software Build Tools" chapter

Seite 84 - Using Version Control

Date Version ChangesMay 2007 7.1.0• Added table of contents to “Introduction” section.• Added Referenced Documents section.March 2007 7.0.0 Maintenanc

Seite 85

Developing Device Drivers for the HardwareAbstraction Layer72015.05.14NII5V2SubscribeSend FeedbackEmbedded systems typically have application-specific

Seite 86 - Linking and Locating

The HAL Peripheral-Specific APIIf the peripheral does not belong to one of the HAL generic device model classes, you need to provide adevice driver wi

Seite 87 - Target Operation

Nios II Hardware Design ConceptsThis section discusses some basic concepts behind the Altera Qsys and SOPC Builder system integrationtools. These conc

Seite 88

The _regs.h header file defines the following access macros for the component:• Register access macros that provide a read and/or write macro for each

Seite 89

Creating Embedded Drivers for HAL Device ClassesThe HAL supports a number of generic device model classes. By writing a device driver as described int

Seite 90

Each BSP example directory contains a create-this-bsp script. After this script is run, each softwareexample directory contains the following files:•

Seite 91 - Other BSP Tasks

For more information about open(), close(), read(), write(), lseek(), fstat(), and ioctl(), refer tothe "HAL API Reference" chapter of the N

Seite 92 - Managing Device Drivers

Function Default Behaviorwrite Calls to write() for this device always fail.lseek Calls to lseek() for this device always fail.fstat The device identi

Seite 93 - Controlling the stdio Device

int alt_fs_reg (alt_dev* dev)This function takes a single input argument, which is the device structure to register. A negative returnvalue indicates

Seite 94

Flash Device DriversCreate a Flash DriverFlash device drivers must provide an instance of the alt_flash_dev structure, defined in sys/alt_flash_dev.h.

Seite 95 - Details of BSP Creation

Register a Flash DeviceAfter creating an instance of the alt_flash_dev structure, you must make the device available to theHAL system by calling the f

Seite 96

The prepare() function must be defined. If the ioctl field is set to null, calls toalt_dma_rxchan_ioctl() return -ENOTTY for this device.After creatin

Seite 97 - HAL BSP Files and Folders

Layered Software ModelArchitectural Layers of a Nios II MicroC/OS-II software applicationApplication Application-specific system initialization Niche

Seite 98 - File Name Function

You need not edit the NicheStack TCP/IP Stack source code to implement a NicheStack-compatibledriver. Nevertheless, Altera provides the source code fo

Seite 99

net structure internally to define its interface to device drivers. The net structure is defined in net.h, in<iniche path>/src/downloads/30src/h

Seite 100 - Copied BSP Files

Related Information• Header Files and alt_sys_init.c on page 7-28• Provide a Software Initialization Function on page 7-15Provide a Software Initializ

Seite 101 - HAL BSP After Build

The Nios II Processor Reference Handbook defines the processor hardware architecture and features,including the instruction set architecture.The Embed

Seite 102 - Tcl Scripts for BSP Settings

Assumptions and RequirementsTypically, you are developing a device driver or software package for eventual incorporation in a BSP. Thedriver or packag

Seite 103 - Simple Tcl Script

The Nios II BSP GeneratorThis section describes the process by which the Nios II BSP generator adds device drivers and softwarepackages to your BSP. T

Seite 104 - 2015.05.14

No Specific RequestsIf no specific device driver is requested, and no compatible device driver is located for a particularhardware module, the BSP gen

Seite 105 - Revising Your BSP

Driver and Software Package Tcl Script CreationThis section discusses writing a Tcl script to describe your software package or driver. The exact cont

Seite 106 - Regenerating Your BSP

Figure 7-1: Example Device Driver File Hierarchy and NamingHardware system generation filescustom_component_sw.tclcustom_component_regs.hHALinccustom_

Seite 107 - How to Regenerate Your BSP

Creating and Naming the Driver or PackageThe first command in any driver or software package Tcl script must be the create_driver orcreate_sw_package

Seite 108 - Updating Your BSP

Specifying an Operating SystemMany drivers and software packages do not require any particular operating system. However, you canstructure your softwa

Seite 109 - Recreating Your BSP

To support this functionality in Nios II BSPs, you must set the set_sw_property command’sauto_initialize argument to true using the following Tcl comm

Seite 110 - Specifying BSP Defaults

Device drivers (but not software packages) can use the min_compatible_hw_version andspecific_compatible_hw_version arguments to establish compatibilit

Seite 111 - Related Information

Table 7-4: Data Type SettingsData Type Setting Value NotesBooleandefinitionboolean_define_onlyA definition that is generated whentrue, and absent when

Seite 112 - Argument Name Argument Value

ContentsOverview of Nios II Embedded Development... 1-1Prerequisites for Understanding the Nios II Em

Seite 113

Date Version ChangesFebruary 2011 10.1.0 Removed "Referenced Documents" section.July 2010 10.0.0 Installation method changed; Nios II EDS al

Seite 114

Table 7-5: Destination File SettingsDestination File Setting Value Notessystem.h system_h_defineThis destination file is recommended in mostcases. You

Seite 115 - Memory Types

Related InformationNios II Software Build Tools Reference on page 15-1Setting DescriptionThe description argument of add_sw_setting contains a brief d

Seite 116 - Boot from Flash Configuration

Creating a Custom Device Driver for the HALThis section describes how to provide appropriate files to integrate your device driver in the HAL.For more

Seite 117

altera_avalon_jtag_uart.h Defining MacrosFor example, altera_avalon_jtag_uart.h must define the macros ALTERA_AVALON_JTAG_UART_INSTANCE andALTERA_AVAL

Seite 118 - The Nios II SBT for Eclipse

Provide Reduced Footprint DriversThe HAL defines a C preprocessor macro named ALT_USE_SMALL_DRIVERS that you can use in driversource code to provide a

Seite 119 - The Nios II Command Shell

• ALT_DRIVER_READ(instance, buffer, len, flags)• ALT_DRIVER_WRITE(instance, buffer, len, flags)• ALT_DRIVER_IOCTL(instance, req, arg)These macros are

Seite 120 - GNU Compiler Tool Chain

Overriding the HAL Default Device DriversAll components can elect to provide a HAL device driver.For more information, refer to Integrating a Device D

Seite 121 - File Format Conversion Tools

Date Version ChangesMarch 2009 9.0.0• Reorganized and updated information and terminology to clarifyrole of Nios II Software Build Tools.• Incorporate

Seite 122 - Other Command-Line Tools

Exception Handling82015.05.14NII5V2SubscribeSend FeedbackThis chapter discusses how to write programs to handle exceptions in the Nios® II processor a

Seite 123 - Restrictions

• Application context—The status of the Nios II processor and the HAL during normal programexecution, outside of exception funnels and handlers.• Cont

Seite 124 - Date Version Changes

Getting Started with the Graphical UserInterface22015.05.14NII5V2SubscribeSend FeedbackThe Nios II Software Build Tools (SBT) for Eclipse is a set of

Seite 125 - Send Feedback

• Software exception—An exception caused by a software condition; that is, any exception other than ahardware interrupt. This includes unimplemented i

Seite 126 - Applications versus Drivers

When an external hardware interrupt occurs, the Nios II processor transfers control to an individualvector address, which can be unique for each inter

Seite 127 - Generic Device Models

Latency and Response TimeException (interrupt) latency, as defined in the previous section, is the time required for the hardware torespond to an exce

Seite 128 - Supported Peripherals

The processor’s response to hardware interrupts depends on which interrupt controller is implemented.The following sections describe the hardware beha

Seite 129 - Provide Partial HAL Support

When you create a board support package (BSP) project, the build tools include all needed device drivers.You do not need to write HAL ISRs unless you

Seite 130 - MMU Support

In determining the interrupt API to use, the SBT ignores any devices whose interrupts are not connectedto the Nios II processor associated with the BS

Seite 131

The SBT inserts the following symbol definitions in system.h, indicating the configuration of theprocessor’s interrupt-related hardware options:• NIOS

Seite 132 - Abstraction Layer

• alt_irq_register()• alt_irq_disable()• alt_irq_enable()• alt_irq_disable_all()• alt_irq_enable_all()• alt_irq_interruptible()• alt_irq_non_interrupt

Seite 133

HAL ISR RestrictionsWhen your system has an EIC, the HAL interrupt support imposes the following restrictions:• Nonmaskable hardware interrupts must u

Seite 134

The HAL funnel code is called from the vector table.Running in a Restricted EnvironmentISRs run in a restricted environment. A large number of the HAL

Seite 135 - UNIX-Style Interface

Any number of editors can be open at once, but only one can be active at a time. The main menu bar andtoolbar for the workbench window contain operati

Seite 136 - File System

Registering an ISR with the Enhanced Interrupt APIBefore the software can use an ISR, you must register it by calling alt_ic_isr_register(). Theprotot

Seite 137 - Using Character-Mode Devices

For more information about alt_ic_isr_register(), refer to the "HAL API Reference" chapter.Note: The HAL legacy interrupt API provides a dif

Seite 138 - Altera Logging Functions

The driver for an EIC can provide specialized functions to manage any implementation-specific featuresof the EIC. An example would be modifying interr

Seite 139 - Enabling Altera Logging

• Button is pressed, generating an IRQ.• The ISR gains control.• With the IIC, the HAL general exception funnel gains control of the processor, and di

Seite 140 - Extra Logging Options

Table 8-2: HAL Interrupt Legacy and Enhanced API Functions toLegacy API Function Enhanced API Functionalt_irq_register() alt_ic_isr_register()alt_irq_

Seite 141 - Name Description

Implement Time-Intensive Algorithms in HardwareProcessor-intensive tasks must often transfer large amounts of data to and from peripherals. A general-

Seite 142 - Logging Levels

• Cache and Tightly-Coupled MemoryUse a Separate Exception StackThe HAL implements two types of separate exception stack. Their availability depends o

Seite 143 - Altera Logging Files

Table 8-3: Separate Exception Stack UsageInterrupt ControllerBSP SettingsApplicationStackGeneralExceptionStackHardware InterruptStackSeparateGeneralEx

Seite 144 - Using File Subsystems

Use Nested Hardware InterruptsBy default, the HAL disables interrupts when it dispatches an ISR. This means that only one ISR canexecute at any time,

Seite 145 - Using Timer Devices

Related InformationManaging Pre-Emption on page 8-12Locate ISR Body in Vector TableIf you are using a vectored EIC, and you have a critical ISR of sma

Seite 146

Related InformationSpecifying the BSP on page 2-3For more information about how the SBT also creates a folder to contain BSP project files.Specifying

Seite 147 - Timestamp Driver

Use Vectored Hardware InterruptsBy default, the Nios II processor has a nonvectored IIC. The HAL provides software to dispatch eachhardware interrupt

Seite 148 - Using Flash Devices

Add a DMA ControllerA DMA controller performs bulk data transfers, reading data from a source address range and writing thedata to a different address

Seite 149 - Block Erasure or Corruption

generally invalid by the time you return the processor to normal execution. You must reset the processorto return the system to a valid state.With the

Seite 150 - Fine-Grained Flash Access

With an EIC, the general exception funnel handles only software exceptions. An IRQ causes the processorto transfer control to one of the interrupt fun

Seite 151

Figure 8-1: HAL Exception Handling System with the Internal Interrupt ControllerHardwareinterruptsenabled?Hardwareinterruptspending?Handlesoftware exc

Seite 152

Interrupt Funnels for External Interrupt ControllersWith the EIC interface, the Nios II processor supports a potentially unlimited number of hardwarei

Seite 153

Software exception handling depends on options selected in the BSP. If you have enabled unimplementedinstruction emulation, the software exception fun

Seite 154 - Using DMA Devices

Note: An exception handler must never execute an unimplemented instruction. The HAL exceptionhandling system does not support nested software exceptio

Seite 155 - DMA Receive Channels

For more information, refer to the “The Nios II Instruction-Related Exception Handler” chapter for adescription of the instruction-related exception h

Seite 156

• Instruction Set Reference• Programming ModelInvalid InstructionsAn invalid instruction word contains invalid codes in the OP or OPX field. For norma

Seite 157

BSP in the list. The Create and Import buttons to the right of the existing BSP list provide convenientways to add BSPs to the list.Creating the Proje

Seite 158 - Using Interrupt Controllers

alt_u32 addr, alt_u32 bad_addr );The instruction-related exception handler’s return value is a flag requesting that the HAL either re-execute the ins

Seite 159 - Use /dev/null

Exception CauseCodeCause Symbol (8)Supervisor-only InstructionAddress9 NIOS2_EXCEPTION_SUPERVISOR_ONLY_INST_ADDRSupervisor-only Instruction 10 NIOS2_E

Seite 160 - Limitation Functions Affected

For more information, refer to “Settings Managed by the Software Build Tools” in the "Nios II SoftwareBuild Tools Reference" chapter of the

Seite 161

Date Version ChangesMay 2008 8.0.0 Maintenance release.October 2007 7.2.0 Maintenance release.May 2007 7.1.0• Added table of contents to “Introduction

Seite 162 - Emulate ANSI C Functions

Cache and Tightly-Coupled Memory92015.05.14NII5V2SubscribeSend FeedbackNios II embedded processor cores can contain instruction and data caches. This

Seite 163

Related InformationNios II Core Implementation DetailsDefining Cache PropertiesThe details for a particular Nios II processor system are defined in th

Seite 164 - Eliminate Unneeded Exit Code

Assembly Code to Initialize the Instruction CachePlace the initi instruction in a loop that executes initi for each instruction cache line address.Exa

Seite 165 - Boot Sequence and Entry Point

For HAL UsersThe HAL provides the C-language macros IORD and IOWR that expand to the appropriate assemblyinstructions to bypass the data cache. The IO

Seite 166 - Customizing the Boot Sequence

stw r4, 0(r5)flushd 0(r5)flushi r5flushpNote: Notice that this example uses the stw/flushd pair instead of the stwio instruction. The stwioinstruction

Seite 167 - Memory Usage

Bit-31 cache bypass is only provided in the Nios II/f core, and must not be used with other Nios II cores.The other Nios II cores limit their maximum

Seite 168 - Simple Placement Options

The project directory for your hardware design contains an SRAM Object File (.sof) along withthe .sopcinfo file. The .sof file contains the hardware d

Seite 169 - Advanced Placement Options

Date Version ChangesMay 2011 11.0.0 No changeFebruary 2011 10.1.0 Removed “Referenced Documents” section.July 2010 10.0.0 Maintenance release.November

Seite 170 - Global Pointer Register

MicroC/OS-II Real-Time Operating System102015.05.14NII5V2SubscribeSend FeedbackOverview of the MicroC/OS-II RTOSMicroC/OS-II is a popular real-time ke

Seite 171

LicensingAltera distributes MicroC/OS-II in the Nios II Embedded Design Suite (EDS) for evaluation purposesonly.Note: Micrium offers free licensing fo

Seite 172 - Working with HAL Source Files

Figure 10-1: Architecture of MicroC/OS-II Programs in Relation to the HAL APIUser ProgramC Standard LibraryHAL APIDeviceDriverDeviceDriver...DeviceDr

Seite 173 - Hardware Abstraction Layer

Related Information• Developing Device Drivers for the Hardware Abstraction LayerFor more information about developing device drivers.• Developing Dev

Seite 174

Macro Defined inHeaderMicroC/OS-II Implementation Single-ThreadedHAL Implementa‐tionALT_FLAG_POST(group,flags, opt)os/alt_flag.h Call OSFlagPost() wit

Seite 175

In addition, the MicroC/OS-II implementation provides appropriate task locking to ensure that heapaccesses (calls to malloc() and free()) are also thr

Seite 176

Date Version ChangesNovember 2009 9.1.0• Introduced the Nios II Software Build Tools for Eclipse.• Remove tables of Nios II IDE-specific setting names

Seite 177 - Accessing Hardware

Ethernet and the NicheStack TCP/IP Stack -Nios II Edition112015.05.14NII5V2SubscribeSend FeedbackThe NicheStack TCP/IP Stack - Nios II Edition is a sm

Seite 178

Related Information• Overview of Nios II Embedded DevelopmentFor more information about the Nios II Embedded Design Suite (EDS).• MicroC/OS-II Real-Ti

Seite 179 - Character-Mode Device Drivers

To debug a software project, right-click the application project name, point to Debug As, and click NiosII Hardware. This command carries out the foll

Seite 180 - Function Default Behavior

Related InformationNios II Processor Documentation PageFor more information about the reference manual for the NicheStack TCP/IP Stack page of the Alt

Seite 181 - File Subsystem Drivers

• The system hardware must include an Ethernet interface with interrupts enabled.• The BSP must be based on MicroC/OS-II.• The MicroC/OS-II RTOS must

Seite 182 - Timer Device Drivers

netmain()netmain() is responsible for initializing and launching the NicheStack tasks. The prototype fornetmain() is:void netmain(void)netmain() retur

Seite 183 - Flash Device Drivers

The prototype for get_mac_addr() is in the header file <iniche path><iniche path>/inc/alt_iniche_dev.h. TheNET structure is defined in the

Seite 184 - DMA Device Drivers

To assign a static IP address, include the lines:*use_dhcp = 0;The prototype for get_ip_addr() is in the header file <iniche path>/inc/alt_inich

Seite 185 - Ethernet Device Drivers

Note: There is no error checking in this example. In a real application, you might need to return -1 onerror.The prototype is defined in <iniche pa

Seite 186 - Software

Option DescriptionMAC interface If the IP stack has more than one network interface, thisparameter indicates which interface to use.Related Informatio

Seite 187

Related Information• Using the NicheStack TCP/IP Stack - Nios II Edition TutorialFor more information about the Altera NicheStack implementation• Lite

Seite 188

Read-Only Zip File System122015.05.14NII5V2SubscribeSend FeedbackAltera provides a read-only zip file system for use with the hardware abstraction lay

Seite 189 - Overview

Programming the Zip File to FlashFor your program to access files in the zip file subsystem, you must first program the zip data to flash. Aspart of t

Seite 190 - Assumptions and Requirements

Console ViewJust as when running a program, Eclipse displays program output in the Console view of Eclipse. TheConsole view maintains a terminal I/O c

Seite 191 - The Nios II BSP Generator

Publishing Component Information toEmbedded Software132015.05.14NII5V2SubscribeSend FeedbackThis document describes how to publish hardware component

Seite 192 - File Names and Locations

Tcl Assignment StatementsA component publishes information by including Tcl assignment statements in its component descriptionfile, <component_name

Seite 193

set_module_assignment embeddedsw.CMacro.BAUD_RATE \[get_parameter_value BAUD_RATE_PARAM]Generated Macro in system.hExample 13–3. Generated Macro in s

Seite 194

Configuration Data TypesTable 13-2: Configuration Data Types and Corresponding FormatConfiguration Data Type Formatboolean 1, 032-bit integer 123, -50

Seite 195

Memory-Mapped Slave InformationTable 13-4: Avalon Memory-Mapped Slave Information - Assign with set_interface_assignmentConfiguration Name Type Defaul

Seite 196

Configuration Name Type Default Meaning ExamplesisFlash boolean 0 The memorydevice is a flashmemory device.If isFlash istrue, you mustalso setisMemory

Seite 197

Configuration Name Type Default Meaning ExamplesaffectsTransaction-sOnMastersstring emptystringA list of masternames delimitedby spaces, forexample m1

Seite 198

Configuration Name Type Default Meaning ExamplestransportsInterrupts-FromReceivers (12)string emptystringA list of interrupt receiverinterface names d

Seite 199 - Data Type Setting Value Notes

Note: Quotation marks are not required.Table 13-8: Memory Initialization Information - Assign with set_module_assignment CommandMemory InitializationN

Seite 200

Date Version ChangesNovember 2009 9.1.0 Add the following Avalon-ST interface settings, to support externalinterrupt controllers:• embeddedsw.configur

Seite 201

1. Enable the Run Time Stack Checking in the BSP project from NIOS II SBT for Eclipce Nios II BSPEditor. From the BSP project, right-click and navigat

Seite 202

HAL API Reference142015.05.14NII5V2SubscribeSend FeedbackThis chapter provides an alphabetically ordered list of all the functions in the hardware abs

Seite 203 - Device Driver Source Code

Include<unistd.h>DescriptionThe newlib exit() function calls the _exit() function to terminate the current process. Typically,exit() calls this

Seite 204 - Using Macros

alt_dcache_flush()Prototypevoid alt_dcache_flush (void* start, alt_u32 len)Commonly Called ByC/C++ programsDevice driversThread-safeYes.Available from

Seite 205 - HAL Namespace Allocation

Device driversThread-safeYes.Available from ISRYes.Include<sys/alt_cache.h>DescriptionThe alt_dcache_flush_all() function flushes, that is, writ

Seite 206

Include<sys/alt_cache.h>DescriptionThe alt_dcache_flush_no_writeback() is called to flush the data cache for a memory region of length "len

Seite 207

• alt_remap_cached() on page 14-7• alt_remap_uncached() on page 14-7• alt_uncached_free() on page 14-6alt_uncached_free()Prototypevoid alt_uncached_fr

Seite 208 - Exception Handling

alt_remap_uncached()Prototypevolatile void* alt_remap_uncached (void* ptr, alt_u32 len);Commonly Called ByC/C++ programsDevice driversThread-safeYes.A

Seite 209

Commonly Called ByC/C++ programsDevice driversThread-safeYes.Available from ISRNo.Include<sys/alt_cache.h>DescriptionThe alt_remap_cached() func

Seite 210 - Interrupt Controllers

Available from ISRYes.Include<sys/alt_cache.h>DescriptionThe alt_icache_flush_all() function invalidates the entire contents of the instruction

Seite 211

In processors without instruction caches, it has no effect.Return--Related Information• alt_dcache_flush() on page 14-3• alt_dcache_flush_all() on pag

Seite 212 - Latency and Response Time

The bgeu and break 3 lines are what is added for the stack overflow checking. If the stack pointerhas grown beyond its limits the break is called.Rela

Seite 213

The HAL waits nticks system clock ticks before calling the callback() function. When the HAL callscallback(), it passes it the input argument context.

Seite 214 - Selecting an Interrupt API

DescriptionYou can call the alt_alarm_stop() function to cancel an alarm previously registered by a call toalt_alarm_start(). The input argument is a

Seite 215 - Function Name Implemented By

ReturnReturns the maximum number of receive requests that can be posted.Related Information• alt_dma_rxchan_close() on page 14-13• alt_dma_rxchan_open

Seite 216 - The Legacy HAL Interrupt API

• alt_dma_rxchan_prepare() on page 14-16• alt_dma_rxchan_reg() on page 14-17• alt_dma_txchan_close() on page 14-18• alt_dma_txchan_ioctl() on page 14-

Seite 217

• alt_fs_reg() on page 14-29alt_dma_rxchan_open()Prototypealt_dma_rxchan alt_dma_rxchan_open (const char* name)Commonly Called ByC/C++ programsDevice

Seite 218 - Writing an ISR

alt_dma_rxchan_prepare()Prototypeint alt_dma_rxchan_prepare (alt_dma_rxchan dma, void* data, alt_u32 length, alt_rxchan_done* done, void* handle)Commo

Seite 219 - Managing Pre-Emption

alt_dma_rxchan_reg()Prototypeint alt_dma_rxchan_reg (alt_dma_rxchan_dev* dev)Commonly Called ByC/C++ programsDevice driversThread-safeNo.Available fro

Seite 220

• alt_dma_txchan_reg() on page 14-21• alt_dma_txchan_send() on page 14-27• alt_dma_txchan_space() on page 14-26alt_dma_txchan_close()Prototypeint alt_

Seite 221

alt_dma_txchan_ioctl()Prototypeint alt_dma_txchan_ioctl (alt_dma_txchan dma, int req, void* arg)Commonly Called ByC/C++ programsDevice driversThread-s

Seite 222 - C Example

• alt_dma_txchan_reg() on page 14-21• alt_dma_txchan_send() on page 14-27• alt_dma_txchan_space() on page 14-26alt_dma_txchan_open()Prototypealt_dma_t

Seite 223

The Project Tab...2-21The T

Seite 224

Figure 2-1: Nios II Debug windowCustom Instruction-Related Exception HandlerFor use outside the debugger, you can register your own instruction-relate

Seite 225 - Use Fast Memory

alt_dma_txchan_reg()Prototypeint alt_dma_txchan_reg (alt_dma_txchan_dev* dev)Commonly Called ByC/C++ programsDevice driversThread-safeNo.Available fro

Seite 226

• alt_dma_txchan_open() on page 14-20• alt_dma_txchan_send() on page 14-27• alt_dma_txchan_space() on page 14-26alt_flash_close_dev()Prototypevoid alt

Seite 227

alt_exception_cause_generated_bad_addr()Prototypeint alt_exception_cause_generated_bad_addr ( alt_exception_cause cause)Commonly Called ByC/C++ progra

Seite 228

Device driversThread-safeNo.Available from ISRNo.Include<sys/alt_flash.h>DescriptionThe alt_erase_flash_block() function erases an individual fl

Seite 229 - Use Compiler Optimization

Available from ISRSee description.Include<sys/alt_dma.h>DescriptionThe alt_dma_rxchan_ioctl() function performs DMA I/O operations on the DMA re

Seite 230 - Add Fast Memory

Request MeaningALT_DMA_RX_ONLY_OFF Return to the default mode, in which both the receive and transmitsides of the DMA can be under software control.Re

Seite 231 - Debugging Nios II ISRs

• alt_dma_txchan_ioctl() on page 14-19• alt_dma_txchan_open() on page 14-20• alt_dma_txchan_reg() on page 14-21• alt_dma_txchan_send() on page 14-27al

Seite 232

• alt_dma_rxchan_reg() on page 14-17• alt_dma_txchan_close() on page 14-18• alt_dma_txchan_ioctl() on page 14-19• alt_dma_txchan_open() on page 14-20•

Seite 233 - Hardware Interrupt Funnel

alt_fs_reg()Prototypeint alt_fs_reg (alt_dev* dev)Commonly Called ByDevice driversThread-safeNo.Available from ISRNo.Include<sys/alt_dev.h>Descr

Seite 234

Commonly Called ByC/C++ programsDevice driversThread-safeNo.Available from ISRNo.Include<sys/alt_flash.h>DescriptionThe alt_get_flash_info() fun

Seite 235 - Software Exception Funnel

• Determining the Cause of Interrupt and Instruction-Related ExceptionsFor more information, refer to the "Determining the Cause of Interrupt and

Seite 236 - Unimplemented Instructions

Available from ISRNo.Include<sys/alt_irq.h>DescriptionThe alt_ic_irq_disable() function disables a single interrupt.The function arguments are a

Seite 237

Thread-safeYes.Available from ISRYes.Include<sys/alt_irq.h>DescriptionThis function determines whether a specified interrupt is enabled.The func

Seite 238 - Miscellaneous Exceptions

void* flags)Commonly Called ByC/C++ programsDevice driversThread-safeYes.Available from ISRNo.Include<sys/alt_irq.h>DescriptionThe alt_ic_isr_re

Seite 239 - Invalid Instructions

• alt_irq_disable() on page 14-36• alt_irq_disable_all() on page 14-38• alt_irq_enable() on page 14-39• alt_irq_enable_all() on page 14-39• alt_irq_en

Seite 240 - Exception Cause Codes

• alt_irq_cpu_enable_interrupts () on page 14-37• alt_irq_disable() on page 14-36• alt_irq_disable_all() on page 14-38• alt_irq_enable() on page 14-39

Seite 241 - Cause Symbol

A call to alt_instruction_exception_register() replaces the previously registered exception handler,if any. If handler is set to null, the instruction

Seite 242

• alt_ic_isr_register() on page 14-32• alt_irq_cpu_enable_interrupts () on page 14-37• alt_irq_disable_all() on page 14-38• alt_irq_enable() on page 1

Seite 243

• alt_irq_init() on page 14-41• alt_irq_pending () on page 14-42• alt_irq_register() on page 14-43alt_irq_disable_all()Prototypealt_irq_context alt_ir

Seite 244 - Nios II Cache Implementation

alt_irq_enable()Prototypeint alt_irq_enable (alt_u32 id)Commonly Called ByC/C++ programsDevice driversThread-safeYes.Available from ISRNo.Include<p

Seite 245 - Defining Cache Properties

Commonly Called ByC/C++ programsDevice driversThread-safeYes.Available from ISRYes.Include<sys/alt_irq.h>DescriptionThe alt_irq_enable_all() fun

Seite 246 - For HAL Users

Details of how each makefile is created and maintained vary depending on the project type, and on projectoptions that you control. The authoritative s

Seite 247

Thread-safeYes.Available from ISRYes.Include<sys/alt_irq.h>DescriptionDetermines whether maskable exceptions (status.PIE) are enabled.For more i

Seite 248 - Bit-31 Cache Bypass

Available from ISRYes.Include<sys/alt_irq.h>DescriptionThe alt_irq_init () function calls the initilization macros for all interrupt controllers

Seite 249

Include<sys/alt_irq.h>DescriptionThe alt_irq_pending () function returns a bit list of the current pending interrupts. This is used byalt_irq_ha

Seite 250

DescriptionThe alt_irq_register() function registers an ISR. If the function is successful, the requested interruptis enabled on return.The input argu

Seite 251 - Further Information

Available from ISRYes.Include<sys/alt_llist.h>DescriptionThe alt_llist_insert() function inserts the doubly linked list entry entry in the list

Seite 252 - Other RTOS Providers

Related Informationalt_llist_insert() on page 14-44alt_load_section()Prototypevoid alt_load_section(alt_u32* from,alt_u32* to,alt_u32* end)Commonly Ca

Seite 253 - MicroC/OS-II Device Drivers

Commonly Called ByC/C++ programsDevice driversThread-safeYes.Available from ISRYes.Include<sys/alt_alarm.h>DescriptionThe alt_nticks() function.

Seite 254 - Thread-Safe HAL Drivers

Thread-safeNo.Available from ISRNo.Include<sys/alt_flash.h>DescriptionThe alt_read_flash() function reads data from flash. length bytes are read

Seite 255 - HAL Implementa‐

DescriptionOnly the system clock driver may call the alt_tick() function. The driver is responsible for makingperiodic calls to this function at the r

Seite 256

Related Information• alt_alarm_start() on page 14-10• alt_alarm_stop() on page 14-11• alt_nticks() on page 14-46• alt_sysclk_init() on page 14-65• alt

Seite 257

modified icon. To add the resource back into the build, right-click the resource and click Add to Nios IIBuild.Note: Do not use the Eclipse Exclude fr

Seite 258 - Nios II Edition

alt_timestamp_freq()Prototypealt_u32 alt_timestamp_freq (void)Commonly Called ByC/C++ programsThread-safeSee description.Available from ISRSee descrip

Seite 259

Available from ISRSee description.Include<sys/alt_timestamp.h>DescriptionThe alt_timestamp_start() function starts the system timestamp counter.

Seite 260 - Nios II System Requirements

DescriptionThe alt_write_flash() function writes data to flash. The data to be written is at address src_addr.length bytes are written to the flash fd

Seite 261 - Initializing the Stack

Include<sys/alt_flash.h>DescriptionThe alt_write_flash_block() function writes one block of data of flash. The data to be written is ataddress d

Seite 262

DescriptionThe close() function is the standard UNIX-style close() function, which closes the file descriptor fd.Calls to close() are thread-safe only

Seite 263

ReturnThe return value is zero on success, or –1 otherwise. If the call fails, errno is set to indicate the cause ofthe error.Related Information• fcn

Seite 264 - Calling the Sockets Interface

fcntl()Prototypeint fcntl(int fd, int cmd)Commonly Called ByC/C++ programsThread-safeNo.Available from ISRNo.Include<unistd.h><fcntl.h>Des

Seite 265 - Option Description

execve()Prototypeint execve(const char *path,char *const argv[],char *const envp[])Commonly Called ByC/C++ programsThread-safeYes.Available from ISRYe

Seite 266

Include<unistd.h>DescriptionThe getpid() function is provided for newlib compatibility and obtains the current process ID.ReturnBecause HAL syst

Seite 267 - - Nios II Edition

Related Informationnewlib Library Documentationstat()Prototypeint stat(const char *file_name,struct stat *buf);Commonly Called ByC/C++ programsDevice

Seite 268 - Read-Only Zip File System

Table 2-2: GUI Actions that Modify an Application or a Makefile with User Source ManagementModification Where ModifiedSpecifying the application or us

Seite 269

settimeofday()Prototypeint settimeofday (const struct timeval *t, const struct timezone *tz)Commonly Called ByC/C++ programsThread-safeNo.Available fr

Seite 270 - Embedded Software

Commonly Called Bynewlib C libraryThread-safeYes.Available from ISRYes.Include<sys/wait.h>Descriptionnewlib uses the wait() function to wait for

Seite 271 - Embedded Software Assignments

ReturnCalls to unlink() always fails with the return code –1 and errno set to ENOSYS.Related Informationnewlib Library Documentationsbrk()Prototypecad

Seite 272 - Configuration Namespace

Available from ISRYes.Include<unistd.h>DescriptionThe link() function is only provided for compatibility with newlib.ReturnCalls to link() alway

Seite 273 - Configuration Data Types

You can use the following values for the input parameter, whence:• SEEK_SET—The offset is set to ptr bytes.• SEEK_CUR—The offset is incremented by ptr

Seite 274

The expectation is that this function is only called from within alt_sys_init(), that is, while the systemis running in single-threaded mode. Concurre

Seite 275

Not all file systems/devices recognize this option.mode specifies the permissions to use, if a new file is created. It is unused by current file syste

Seite 276 - Streaming Source Information

typedef struct {clock_t tms_utime;clock_t tms_stime;clock_t tms_cutime;clock_t tms_cstime;};The structure has the following elements:• tms_utime: the

Seite 277 - Streaming Sink Information

Include<unistd.h>DescriptionThe read() function reads a block of data from a file or device. read() is wrapper function that passescontrol direc

Seite 278

Include<unistd.h>DescriptionThe write() function writes a block of data to a file or device. write() is wrapper function that passescontrol dire

Seite 279

The Nios II BSP Editor Screen LayoutThe Nios II BSP Editor screen is divided into two areas. The top area is the command area, and thebottom is the co

Seite 280 - HAL API Reference

Include<unistd.h>DescriptionThe usleep() function blocks until at least us microseconds have elapsed.ReturnThe usleep() function returns zero on

Seite 281 - _rename()

flash device being used,and this argument value can be found in the flash device datasheet. The flashdevices can be supported are shown as below:EPCQ1

Seite 282

ReturnThe return value is zero on success. If no system clock is available, the return value is -ENOTSUP.Related Information• alt_alarm_start() on pag

Seite 283

Calls to ioctl() are thread-safe only if the implementation of ioctl() provided by the driver that ismanipulated is thread-safe.Valid values for the f

Seite 284

ReturnThe return value is 1 if the device is a character device, and zero otherwise. If an error occurs, errno is setto indicate the cause.Related Inf

Seite 285

Thread-safeSee description.Available from ISRNo.Include<sys/alt_driver.h><sys/alt_stdio.h><priv/alt_file.h><unistd.h>Descripti

Seite 286

DescriptionThe alt_putstr() function ses the ALT_DRIVER_WRITE() macro to call directly to the driver, if available;otherwise, it uses the newlib provi

Seite 287

• newlib Library Documentationalt_printf()Prototypealt_printf(const char* fmt, ... )Commonly Called ByC/C++ programsDevice driversThread-safeNo.Availa

Seite 288

Date Version ChangesJuly 2010 10.0.0• Clarify purpose of listed C header file for functions.• Correction: alt_irq_enabled() is not a legacy function.N

Seite 289

Nios II Software Build Tools Reference152015.05.14NII5V2SubscribeSend FeedbackThis chapter provides a complete reference of all available commands, op

Seite 290

The Software Packages TabThe Software Packages tab allows you to insert and remove software packages in your BSP, and controlsoftware package settings

Seite 291

Table 15-1: Nios II SBT Logging LevelsLogging Level Descriptionsilent(lowest)No information is provided except for errors and warnings (sentto stderr)

Seite 292

• nios2-lib-generate-makefile on page 15-9• nios2-bsp-editor on page 15-10• nios2-app-update-makefile on page 15-10• nios2-lib-update-makefile on page

Seite 293

• --use-lib-dir <directory>: Specifies the path to a dependent user library directory. The user librarydirectory must contain a makefile fragmen

Seite 294

• --help: Displays basic information about this command and its options.• --jdi <filename>: The location of the JTAG Debugging Information File

Seite 295

nios2-bsp-generate-filesUsagenios2-bsp-generate-files --bsp-dir <directory> [--debug] [--extended-help] [--help] [--librarian-factory-path <

Seite 296

[--script <filename>] --settings <filename> [--show-descriptions] [--show-names] [--silent] [--verbose] [--version]Options• --cmd <t

Seite 297

--settings <filename> [--silent] [--sopc <filename>] [--verbose] [--version]Options• --bsp-dir <directory>: Path to the directory

Seite 298

nios2-lib-generate-makefileUsagenios2-lib-generate-makefile [--bsp-dir <directory>] [--debug] [--extended-help] [--help] [--lib-dir <direct

Seite 299

DescriptionThe nios2-lib-generate-makefile command generates a user library makefile (called Makefile). The pathto a BSP created by nios2-bsp-generate

Seite 300

[--remove-src-dir <directory>] [--remove-src-files <filenames>] [--remove-src-rdir <directory>] [--set <name>] [--set-asfla

Seite 301

• The Main Tab on page 2-15• Embedded Peripherals IP User GuideFor more information about Altera components.The Linker Script TabThe Linker Script tab

Seite 302

• --remove-src-rdir <directory>: Same as --remove-src-dir option but recursively search forsource files in or under <directory>. Multiple

Seite 303

[--remove-lib-dir <directory>] [--remove-public-inc-dir <directory>] [--remove-src-dir <directory>] [--remove-src-files <filena

Seite 304 - Request Meaning

• --remove-lib-dir <directory>: Remove a path to dependent user library directory• --remove-public-inc-dir <directory>: Remove a include d

Seite 305

• --name: Specify the name of the software project to create.• --sopc-dir: Specify the hardware design directory. Required.• --type: Specify the softw

Seite 306

• --sopcinfo <sopcinfoFile>• --jar <jarFile>• --jdi <jdiFile>• --quartus_project_dir <quartusProjectDir>• --sopc_system_name &

Seite 307

• --sopc_system_name• --profiling_enabled• --simulation_enabledDescriptionExtracts metadata from a .elf file intended for the Nios II soft-core proces

Seite 308

Options• --accept-bad-sysid: Continue even if the system identifier (ID) comparison fails.• --add-bin <fname> <flash-slave-desc> <offse

Seite 309

• --program-flash: Providing this flag causes calls to nios2-flash-programmer to be generated andexecuted. This results in flash targets being program

Seite 310

DescriptionThe nios2-bsp script calls nios2-bsp-create-settings or nios2-bsp-update-settings to create or update aBSP settings file, and the nios2-bsp

Seite 311

Optional arguments:• <sopc>: The path name of the .sopcinfo file. Alternatively, specify a directory containing a .sopcinfo file.In the latter c

Seite 312

• Restore Defaults—restores the memory regions to the default configuration set up at the time of BSPcreation.• Memory Usage—Opens the Memory Device U

Seite 313

DescriptionWhen invoked with no arguments, nios2-bsp-console starts an interactive command-line Tcl interpreterfor creating, editing, and generating A

Seite 314

Nios II Design Example ScriptsThe Nios II SBT includes scripts that allow you to create sample BSPs and applications. This sectiondescribes each scrip

Seite 315

Application Name SummaryZip File System Reads from a file system in flash memoryNote: Some application examples might not be available on some hardwar

Seite 316

Figure 15-1: Software Design Example Directory StructureQuartus II files (e.g. standard.qpf)Hardware system files (e.g. standard.sopcinfo)BSP examples

Seite 317

• Nios II Software Build Tools on page 4-1For more information, refer to the examples about specifying or manipulating settings.Overview of BSP Settin

Seite 318

Setting Context DescriptionAltera BSP Linker Script Generator Settings available if using the Altera BSP linkerscript generator (generates the linker.

Seite 319

Altera Avalon-MM UART Driver SettingsThe Altera Avalon-MM UART driver settings are available if the altera_avalon_uart driver is present.By default, t

Seite 320

hal.enable_small_stack• Identifier: none• Type:Boolean assignment• Default Value: 0• Destination File: public.mk• Description: lwhal.enable_small_stac

Seite 321

ucosii.os_lowest_prio• Identifier: OS_LOWEST_PRIO• Type: Decimal number• Default Value: 20• Destination File: system.h• Description: Lowest assignable

Seite 322

ucosii.miscellaneous.os_sched_lock_en• Identifier: OS_SCHED_LOCK_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Descripti

Seite 323

• The Information tab• The Problems tab• The Processing tabThe Information TabThe Information tab shows a running list of high-level changes you make

Seite 324

ucosii.miscellaneous.os_max_events• Identifier: OS_MAX_EVENTS• Type: Decimal number• Default Value: 60• Destination File: system.h• Description: Maxim

Seite 325

ucosii.task.os_task_create_ext_en• Identifier: OS_TASK_CREATE_EXT_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Descript

Seite 326

ucosii.task.os_task_suspend_en• Identifier: OS_TASK_SUSPEND_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description: I

Seite 327

ucosii.time.os_time_get_set_en• Identifier: OS_TIME_GET_SET_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description: I

Seite 328

ucosii.event_flag.os_flag_query_en• Identifier: OS_FLAG_QUERY_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description:

Seite 329

ucosii.mutex.os_mutex_accept_en• Identifier: OS_MUTEX_ACCEPT_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description:

Seite 330

ucosii.semaphore.os_sem_set_en• Identifier: OS_SEM_SET_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description: Includ

Seite 331

ucosii.mailbox.os_mbox_del_en• Identifier: OS_MBOX_DEL_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description: Includ

Seite 332

ucosii.queue.os_q_accept_en• Identifier: OS_Q_ACCEPT_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description: Include

Seite 333

ucosii.queue.os_q_post_opt_en• Identifier: OS_Q_POST_OPT_EN• Type: Boolean assignment• Default Value: 1• Destination File: system.h• Description: Incl

Seite 334

Advantages of Command-Line Software Development...3-1Outline of the Nios II SBT

Seite 335

Note: You can select the operating system only at the time you create the BSP. To change operatingsystems, you must create a new BSP.• The operating s

Seite 336

ucosii.memory.os_mem_name_size• Identifier: OS_MEM_NAME_SIZE• Type: Decimal number• Default Value: 32• Destination File: system.h• Description: Size o

Seite 337

ucosii.timer.os_tmr_cfg_max• Identifier: OS_TMR_CFG_MAX• Type: Decimal number• Default Value: 16• Destination File: system.h• Description: Maximum num

Seite 338

altera_avalon_uart_driver.enable_ioctl• Identifier: ALTERA_AVALON_UART_USE_IOCTL• Type: Boolean definition• Default Value: false• Destination File: pu

Seite 339

altera_iniche.enable_ip_fragments• Identifier: IP_FRAGMENTS• Type: Boolean definition• Default Value: true• Destination File: system.h• Description: R

Seite 340

altera_ro_zipfs.ro_zipfs_offset• Identifier: ALTERA_RO_ZIPFS_OFFSET• Type: Hexadecimal number• Default Value: 0x100000• Destination File: system.h• De

Seite 341

hal.linker.enable_alt_load_copy_rodata• Identifier: none• Type: Boolean assignment• Default Value: 0• Destination File: none• Description: Causes the

Seite 342

hal.linker.exception_stack_size• Identifier: none• Type: Decimal number• Default Value: 1024• Destination File: none• Description: Size of the excepti

Seite 343

hal.make.ar_post_process• Identifier: AR_POST_PROCESS• Type: Unquoted string• Default Value: none• Destination File: BSP makefile• Description: Comman

Seite 344

hal.make.bsp_arflags• Identifier: BSP_ARFLAGS• Type: Unquoted string• Default Value: -src• Destination File: BSP makefile• Description: Custom flags o

Seite 345

hal.make.bsp_cflags_optimization• Identifier: BSP_CFLAGS_OPTIMIZATION• Type: Unquoted string• Default Value: -O0• Destination File: BSP makefile• Desc

Seite 346

Run Configurations in the SBT for EclipseEclipse uses run configurations to control how it runs and debugs programs. Run configurations in theNios II

Seite 347

hal.make.bsp_cxx_flags• Identifier: BSP_CXXFLAGS• Type: Unquoted string• Default Value: none• Destination File: BSP makefile• Description: Custom flag

Seite 348

hal.make.cc_post_process• Identifier: CC_POST_PROCESS• Type: Unquoted string• Default Value: none• Destination File: BSP makefile• Description: Comman

Seite 349

hal.make.ignore_system_derived.big_endian• Identifier: none• Type: Boolean assignment• Default Value: 0• Destination File: public.mk• Description: Ena

Seite 350

hal.make.ignore_system_derived.hardware_fp_cust_inst_no_divider_present• Identifier: none• Type: Boolean assignment• Default Value: 0• Destination Fil

Seite 351

hal.make.ignore_system_derived.hardware_mulx_present• Identifier: none• Type: Boolean assignment• Default Value: 0• Destination File: public.mk• Descr

Seite 352

hal.custom_newlib_flags• Identifier: CUSTOM_NEWLIB_FLAGS• Type: Unquoted string• Default Value: none• Destination File: public.mk• Description: Build

Seite 353

hal.enable_gprof• Identifier: ALT_PROVIDE_GMON• Type: Boolean assignment• Default Value: 0• Destination File: public.mk• Description: Causes code to b

Seite 354 - HAL Standard Types

hal.enable_reduced_device_drivers• Identifier: ALT_USE_SMALL_DRIVERS• Type: Boolean assignment• Default Value: 0• Destination File: public.mk• Descrip

Seite 355

hal.enable_sopc_sysid_check• Identifier: none• Type: Boolean assignment• Default Value: 1• Destination File: public.mk• Description: Enables system ID

Seite 356

hal.stdin• Identifier: STDIN• Type: Unquoted string• Default Value: none• Destination File: system.h• Description: Slave descriptor of STDIN character

Seite 357

Nios II Hardware v2 (beta)Run configurations and debug configurations have a launch type called Nios II Hardware v2 (beta). Tocreate this launch type,

Seite 358

• CREATE_OBJDUMP—Assign 1 to this variable to enable creation of an object dump file (.objdump) afterlinking the application. The nios2-elf-objdump ut

Seite 359

You can add multiple directories by enclosing them in double quotes, for example --setAPP_LIBRARY_DIRS "../my_libs ../../other_libs".• APP_L

Seite 360 - Utility and Script Summary

Software Build Tools Tcl CommandsTcl commands are a crucial component of the Nios II SBT. Tcl commands allow you to exercise detailedcontrol over BSP

Seite 361

DescriptionThis command is provided to define a user-defined external memory device, outside the hardware system.Such a device would typically be mapp

Seite 362

are_same_resourceUsageare_same_resource <slave_desc1> <slave_desc2>Options• <slave_desc1>: String with the first slave descriptor to

Seite 363

disable_sw_packageUsagedisable_sw_package <software_package_name>Options• <software_package_name>: String with the name of the software pa

Seite 364

get_assignmentUsageget_assignment <module_name> <assignment_name>Options• <module_name>: Module instance name to query for assignmen

Seite 365

Exampleputs [get_available_sw_packages] Returns: altera_hostfs:7.2 altera_ro_zipfs:7.2get_base_addrUsageget_base_addr <slave_desc>Options• <s

Seite 366

Exampleputs [get_break_slave_desc] Returns: onchip_ram_64_kbytesget_cpu_nameUsageget_cpu_nameOptionsNoneDescriptionReturns the name of the BSP specifi

Seite 367

DescriptionReturns a list of lists for all the current section mappings. Each list represents a section mapping with theformat {section_name memory_re

Seite 368

Your command-line C/C++ application, and its associated BSP, is created on the command line. AnyNios II SBT command-line project is ready to import in

Seite 369

Examples• Example 1:puts [get_driver jtag_uart]Returns:altera_avalon_jtag_uart_driver:7.2• Example 2:puts [get_driver onchip_ram_64_kbytes]Returns:non

Seite 370

get_exception_slave_descUsageget_exception_slave_descOptionsNoneDescriptionReturns the slave descriptor associated with the processor exception addres

Seite 371

DescriptionReturns the slave descriptor associated with the processor fast TLB miss exception address. Only aprocessor with an MMU has such an excepti

Seite 372

get_memory_regionUsageget_memory_region <name>Options• <name>: String with the name of the memory region.DescriptionReturns the linker scr

Seite 373

DescriptionReturns the name of the module instance associated with the slave descriptor. If a module with one slave,or if it has multiple slaves conne

Seite 374

get_section_mappingUsageget_section_mapping <section_name>Options• <section_name>: String with the section name to query.DescriptionReturn

Seite 375

DescriptionReturns a string describing the BSP setting.Exampleputs [get_setting_desc hal.enable_gprof]Returns:"This example compiles the code wit

Seite 376

Examples• Example 1:puts [is_char_device jtag_uart]Returns:1• Example 2:puts [is_char_device onchip_ram_64_kbytes]Returns:0is_connected_interrupt_cont

Seite 377

is_ethernet_mac_deviceUsageis_ethernet_mac_device <slave_desc>Options• <slave_desc>: String with the slave descriptor to query.Description

Seite 378

is_non_volatile_storageUsageis_non_volatile_storage <slave_desc>Options• <slave_desc>: String with the slave descriptor to query.Descripti

Seite 379

1. Start the Nios II SBT for Eclipse.2. On the File menu, click Import. The Import dialog box appears.3. Expand the Nios II Software Build Tools Proje

Seite 380

Examplelog_default "This is a default message."Displays:INFO: Tcl message: "This is a default message."log_errorUsagelog_error <

Seite 381 - Application Name Summary

Examples• Example 1:set_driver altera_avalon_jtag_uart_driver:7.2 jtag_uart• Example 2:set_driver none jtag_uartset_ignore_fileUsageset_ignore_file &l

Seite 382

DescriptionSets the value for the specified BSP setting. Legal values for boolean settings are true, false, 1, and 0. Usethe keyword none instead of a

Seite 383

add_default_memory_regionsUsageadd_default_memory_regionsDescriptionDefaults the BSP to use default linker script memory regions. The default linker s

Seite 384 - Overview of BSP Settings

Options• <bsp_type>: BSP type identifier (e.g. hal, ucosii).• <sopcinfo_path>: SOPC Information File path. Its parent folder might include

Seite 385 - Setting Context Description

Options• <bsp_type>: BSP type identifier (e.g. hal, ucosii).• <sopcinfo_path>: SOPC Information File path. Its parent folder might include

Seite 386 - Settings Reference

get_bsp_versionUsageget_bsp_versionDescriptionGets the version of the BSP operating system software element.get_cpu_architectureUsageget_cpu_architect

Seite 387

Options• <processor_name>: processor instance name• <sopcinfo_path>: SOPC Information File path. Its parent folder can include custom BSP

Seite 388

DescriptionSaves a new BSP.set_bsp_versionUsageset_bsp_version <version>Options• <version>: Version of BSP type software element to use.De

Seite 389

• BSP initialization• BSP generation• BSP validationNote: Although you can specify a new setting’s value when you create the setting at BSP initializa

Seite 390

User-Managed Source FilesWhen you import a Nios II application or user library project, the Nios II SBT for Eclipse offers theoption of user source ma

Seite 391

add_class_sw_settingUsageadd_class_sw_setting <setting-name> <setting-type>Options• <setting-name>: Name of the setting to persist i

Seite 392

Options• <property-name>: Name of the property to add to the BSP for a module instance• <property-value>: Value of the property to add to

Seite 393

callback script is set in the driver's *_sw.tcl file, using the command set_sw_propertycallback_source_file <filename>.Exampleadd_module_sy

Seite 394

Options• <assignment-name>: Name of the module assignment to retrieve the value for, as defined for themodule instance in the .sopcinfo fileDesc

Seite 395

DescriptionThis command is used on an EIC instance callback to obtain a peripheral slave descriptor connected to aspecific IRQ port number. This comma

Seite 396

Exampleget_peripheral_property jtag_uart supports_preemption;remove_class_systemh_lineUsageremove_class_systemh_line <macro-name>Options• <ma

Seite 397

Options• <setting-name>: Name of the setting to persist in the BSP settings file associated with the driver classof this callback script• <pr

Seite 398

• description• restrictions• groupExampleset_module_sw_setting_property MY_FAVORITE_SETTING default-value '42'Tcl Commands for Drivers and P

Seite 399

add_sw_propertyUsageadd_sw_property <property> <value>Options• <property>: Name of property.• <value>: Value assigned, or appe

Seite 400

• supported_bsp_type—Adds a specific BSP type (operating system) to the list of supported operatingsystems that the driver or software package support

Seite 401

5. Next to Library name, click Add and type the library project name you selected when you createdyour user library.6. Click OK.7. Build your applicat

Seite 402

commands set_setting and get_setting to set or get the setting. The value of the setting persists in theBSP settings file.To create a setting, you mus

Seite 403

type, integer numbers with or without a 0x prefix for the hex_number type, numbers with decimals forfloat_number and double_number types, or an arbitr

Seite 404

This command is required, unless you use the create_driver or create_sw_package commands, asappropriate.create_sw_packageUsagecreate_sw_package <na

Seite 405

This command supports the following properties:• hw_class_name—The name of the hardware class which your device driver supports. The hardwareclass nam

Seite 406

• initialization_callback—This property specifies the name of a Tcl callback function which isintended to run in the following environment:• Run time:

Seite 407

Related InformationNios II Software Build Tools on page 4-1For more information about the legacy and enhanced APIs, refer to "Exception Handling&

Seite 408

Table 15-6: Path Name Format Support for Nios II SBT utilities and makefilesContext Formats supported on Linux (16)Formats supported on Windowswith Cy

Seite 409

Document Revision History for Nios II Software Build Tools ReferenceDate Version ChangesMay 2015 2015.05.14• Maintenance release.• Renamed to Nios II

Seite 410

Date Version ChangesNovember 2009 9.1.0• Support for external interrupt controller.• Add documentation for the following utilities:nios2-lib-update-ma

Seite 411

## example_sw_package_sw.tcl## Create a software package known as "example_sw_package"create_sw_package example_sw_package# The version of t

Seite 412

* This example prints 'Hello from Nios II' to the STDOUT stream. It also * tests inclusion of a user software package. */#include <stdi

Seite 413

When you first open the flash programmer, no controls are available until you open or create a FlashProgrammer Settings File (.flash-settings).Creatin

Seite 414

Specifying the Default stdio Device...4-36Specifying the Def

Seite 415

The Properties button opens the Properties dialog box, which allows you to view and modify informa‐tion about an individual file. In the case of a .el

Seite 416

Program FilesIf you disable this option, the flash programmer generates the programming files and the script, but doesnot program flash. You can use t

Seite 417

1. Right-click the application project.2. Point to Make targets and click Build to open the Make Targets dialog box.3. Select mem_init_install.4. Clic

Seite 418

On the Advanced tab, you can control the following memory characteristics:• The physical memory width.• The device's name in the hardware system.

Seite 419

Related InformationCreating a System with QsysFor more information, refer to the "Qsys Design Flow".Preparing your Software for ModelSimCrea

Seite 420

Related Information• Porting to GCC 4.7For more information about how GNU also provides a porting guide to GCC4.7 to documentcommon issues.• GCC Relea

Seite 421 - Standard Build Flag Variables

Eclipse Usage NotesThe behavior of certain Eclipse and CDT features is modified by the Nios II SBT for Eclipse. If youattempt to use these features th

Seite 422 - Tcl Commands for BSP Settings

Selecting the Correct Launch Configuration TypeIf you try to debug a Nios II software project as a CDT Local C/C++ Application launch configurationtyp

Seite 423

Table 2-3: Location and Argument to Run Shell Script from EclipsePlatform Location ArgumentWindows ${env_var:QUARTUS_ROOTDIR}\bin\cygwin\bin\sh.exe-c

Seite 424

Table 2-6: Build configurationsUnsupported CDT Feature Alternative Nios II Feature• Right-click project and point to Build Configu‐rations• Debugger t

Seite 425

Altera Logging Functions...6-7Using File

Seite 426

Table 2-9: Window PreferencesUnsupported CDT Feature Alternative Nios II FeatureC/C++• Build scope• Build project configurations• Build Variables• Env

Seite 427

Option Description--list-build-config <config>Returns name of all build configurations.Returns empty string if only one build configura‐tion is

Seite 428

The following shows how the application properties page looks with the new build configuration optionshighlighted in red:Figure 2-2: Nios II Applicati

Seite 429

Note: The BSP project does not support multiple build configurations.Document Revision History for Getting Started with the Graphical UserInterfaceDat

Seite 430

Getting Started from the Command Line32015.05.14NII5V2SubscribeSend FeedbackThe Nios II Software Build Tools (SBT) allows you to construct a wide vari

Seite 431

For more information about the command-line utilities provided by the Nios II SBT, refer to “Altera-Provided Development Tools” in the Nios II Softwar

Seite 432

The default Tcl script is used to set the following system-dependent settings:• stdio character device• System timer device• Default linker memory• Bo

Seite 433

If no command-line arguments are specified, this command returns an exit value of 1 and sends a helpmessage to stderr.create-this-appEach application

Seite 434

• In the Windows operating system, on the Start menu, point to Programs > Altera > Nios II EDS<version>,and click Nios II <version>

Seite 435

Creating Hello_World for an Altera Development BoardIn this section you create a simple “Hello World” project. To create and build the hello_world exa

Seite 436

The Relationship Between the .sopcinfo File and system.h... 7-3Using the System Generation Tool to

Seite 437

The .sof file resides in <projects>, along with your Quartus II Project File (.qpf). You download it bytyping the following commands:cd <proj

Seite 438

Note: If you want to view the BSP source files while debugging, you also need to import the BSPproject into the Nios II SBT for Eclipse.Related Inform

Seite 439

Figure 3-1: Simple Software Project Directory StructureQuartus II files (e.g. standard.qpf)Hardware system files (e.g. standard.sopcinfo)BSP examples

Seite 440

Argument Purpose Further Information--cmd enable_sw_packagealtera_inicheAdds the NicheStack TCP/IP stacksoftware package to the BSPFor more informatio

Seite 441

nios2-bspBSP filesmakeBSP library file (.a) SOPC Builder system file (.sopcinfo)Tcl scriptsCommandline argumentsRelated Information• Nios II Software

Seite 442

Related Information• Nios II Software Build Tools on page 4-1For more information about the software example scripts, refer to “Nios II Design Example

Seite 443

Date Version ChangesMay 2011 11.0.0• Can auto-execute a Command in the Nios II Command Shell• The GCC 3 toolchain is an optional featureFebruary 2011

Seite 444

Nios II Software Build Tools42015.05.14NII5V2SubscribeSend FeedbackThis chapter describes the Nios II Software Build Tools (SBT), a set of utilities a

Seite 445

Road Map for the SBTBefore you start using the Nios II SBT, it is important to understand its scope. This section helps youunderstand their purpose, w

Seite 446

The Nios II SBT creates two kinds of makefiles:• Application or user library makefile—A simple makefile that builds the application or user library wi

Seite 447

General Exception Funnel...8-26Hardware Inter

Seite 448

Table 4-3: Application Makefile TargetsTarget Operationhelp Displays all available application makefile targets.all (default) Builds the associated BS

Seite 449

For a user library, the SBT also generates a public makefile, called public.mk. The public makefile isincluded in the private makefile for any applica

Seite 450

directly, abstracting hardware details from the software application. This abstraction minimizes oreliminates the need to access hardware registers di

Seite 451

Software Build ProcessTo create a software project with the Nios II SBT, you perform several high-level steps:1. Obtain the hardware design on which t

Seite 452

Although this section describes tasks in terms of the SBT command line flow, you can also carry out mostof these tasks with the Nios II SBT for Eclips

Seite 453

Creating BSP by Manually Running nios2-bspIf you create a BSP by running nios2-bsp manually on the command line or by running your own scriptthat call

Seite 454

Related Information• GNU WebsiteFor more information about .d files.• Nios II Embedded Design Suite SupportHanding Off a BSPIn some engineering organi

Seite 455

Table 4-5: mem_init.mk TargetsTarget Operationmem_init_install Generates memory initialization files in the application mem_initdirectory. If the QUAR

Seite 456

add_memory_region onchip_ram $slave_desc $offset $new_span add_memory_region onchip_special $slave_desc $split_offset $split_span If you pass this Tcl

Seite 457

by the order in which the add_section_mapping command creates the sections. If you use nios2-bsp, thedefault Tcl script runs before the --cmd option t

Seite 458

The NicheStack TCP/IP Stack Files and Directories... 11-2Licensing...

Seite 459

Sections:Idx Name Size VMA LMA File off Algn...6 .isrs 000000c0 04000c00 04000c00 000000b4 2**2CONTENTS, ALLOC, LOAD, READONLY, CODE...9 .tightly_coup

Seite 460

If you run nios2-bsp again to update your BSP, the default Tcl script overrides your default sectionsmapping. To prevent your default sections mapping

Seite 461

chmod -R +w .rThe <projects> directory contains a subdirectory named software_examples/bsp. The bsp directorycontains several BSP example direct

Seite 462

If you are using nios2-bsp, you disable the driver for the uart0 device as follows:nios2-bsp hal my_bsp --cmd set_driver none uart0rUse the --cmd opti

Seite 463

You can control the optimization and debug level through the project makefile, which determines thecompiler options.Example 4–5. Default Application

Seite 464

Details of BSP CreationBSP creation is the same in the Nios II SBT for Eclipse as at the command line. The nios2-bsp-create-settings utility creates a

Seite 465 - Command Arguments

Figure 4-1: Default Tcl Script and nios2-bsp-generate-files Both Using the .sopcinfo filenios2-bsp-generate-filesBSP filesmakeBSP library file(.a)Hard

Seite 466 - Object File Directory Tree

BSP Settings File CreationEach BSP has an associated settings file that saves the values of all BSP settings. The BSP settings file is inextensible ma

Seite 467

Figure 4-3: HAL BSP After Generating Filesmy_hal_bspsettings.bsppublic.mklinker.xmemory.gdbmem.init.mksystem.halt_sys_init.clinker.hMakefileHALsrc (*.

Seite 468

File Name Functionsummary.html Provides summary documentation of the BSP. You can view summary.htmlwith a hypertext viewer or browser, such as Interne

Kommentare zu diesen Handbüchern

Keine Kommentare