Altera Nios II Especificaciones

Busca en linea o descarga Especificaciones para Procesadores Altera Nios II. Altera Nios II Specifications [en] Manual de usuario

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 468
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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
Vista de pagina 0
1 2 3 4 5 6 ... 467 468

Indice de contenidos

Pagina 1 - Handbook

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

Pagina 2 - Contents

alt_alarm_start()... 14-10alt_a

Pagina 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

Pagina 4

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

Pagina 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

Pagina 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

Pagina 7

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

Pagina 8

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

Pagina 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

Pagina 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

Pagina 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

Pagina 12

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

Pagina 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

Pagina 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

Pagina 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)•

Pagina 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

Pagina 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

Pagina 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

Pagina 20

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

Pagina 21 - Interface

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

Pagina 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-

Pagina 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

Pagina 24 - Configuring the FPGA

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

Pagina 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

Pagina 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

Pagina 27

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

Pagina 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

Pagina 29

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

Pagina 30

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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•

Pagina 35 - The Command Area

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

Pagina 36 - The Drivers Tab

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

Pagina 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

Pagina 38 - The Console Area

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

Pagina 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

Pagina 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

Pagina 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

Pagina 42 - Optimizing Project Build Time

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 47

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

Pagina 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

Pagina 49

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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_

Pagina 55

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 62

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

Pagina 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

Pagina 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,

Pagina 65 - Command Summary

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

Pagina 66

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

Pagina 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

Pagina 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

Pagina 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

Pagina 70 - Debugging hello_world

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

Pagina 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,

Pagina 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

Pagina 73

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

Pagina 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

Pagina 75 - Running make

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

Pagina 76

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

Pagina 77

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

Pagina 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

Pagina 79 - Makefile Targets

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

Pagina 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

Pagina 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,

Pagina 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

Pagina 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

Pagina 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

Pagina 85

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

Pagina 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

Pagina 87 - Target Operation

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

Pagina 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

Pagina 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

Pagina 90

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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.

Pagina 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

Pagina 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

Pagina 97 - HAL BSP Files and Folders

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 106 - Regenerating Your BSP

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

Pagina 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

Pagina 108 - Updating Your BSP

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

Pagina 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

Pagina 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

Pagina 111 - Related Information

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

Pagina 112 - Argument Name Argument Value

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

Pagina 113

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

Pagina 114

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 123 - Restrictions

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

Pagina 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

Pagina 125 - Send Feedback

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

Pagina 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

Pagina 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

Pagina 128 - Supported Peripherals

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

Pagina 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

Pagina 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

Pagina 131

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

Pagina 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

Pagina 133

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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_

Pagina 141 - Name Description

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

Pagina 142 - Logging Levels

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

Pagina 143 - Altera Logging Files

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

Pagina 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,

Pagina 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

Pagina 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

Pagina 147 - Timestamp Driver

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

Pagina 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

Pagina 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

Pagina 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

Pagina 151

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

Pagina 152

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

Pagina 153

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

Pagina 154 - Using DMA Devices

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

Pagina 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

Pagina 156

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

Pagina 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

Pagina 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

Pagina 159 - Use /dev/null

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

Pagina 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

Pagina 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

Pagina 162 - Emulate ANSI C Functions

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

Pagina 163

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 171

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

Pagina 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

Pagina 173 - Hardware Abstraction Layer

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

Pagina 174

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

Pagina 175

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

Pagina 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

Pagina 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

Pagina 178

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

Pagina 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

Pagina 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

Pagina 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

Pagina 182 - Timer Device Drivers

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

Pagina 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

Pagina 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

Pagina 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

Pagina 186 - Software

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

Pagina 187

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

Pagina 188

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

Pagina 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

Pagina 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

Pagina 191 - The Nios II BSP Generator

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

Pagina 192 - File Names and Locations

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

Pagina 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

Pagina 194

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

Pagina 195

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

Pagina 196

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

Pagina 197

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

Pagina 198

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

Pagina 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

Pagina 200

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

Pagina 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

Pagina 202

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

Pagina 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

Pagina 204 - Using Macros

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

Pagina 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

Pagina 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

Pagina 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

Pagina 208 - Exception Handling

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

Pagina 209

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

Pagina 210 - Interrupt Controllers

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

Pagina 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

Pagina 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

Pagina 213

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

Pagina 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

Pagina 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

Pagina 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-

Pagina 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

Pagina 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

Pagina 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

Pagina 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_

Pagina 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

Pagina 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

Pagina 223

The Project Tab...2-21The T

Pagina 224

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

Pagina 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

Pagina 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

Pagina 227

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

Pagina 228

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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•

Pagina 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

Pagina 234

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

Pagina 235 - Software Exception Funnel

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

Pagina 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

Pagina 237

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 247

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

Pagina 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

Pagina 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

Pagina 250

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

Pagina 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

Pagina 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

Pagina 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.

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 258 - Nios II Edition

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

Pagina 259

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

Pagina 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

Pagina 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

Pagina 262

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

Pagina 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

Pagina 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

Pagina 265 - Option Description

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

Pagina 266

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

Pagina 267 - - Nios II Edition

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

Pagina 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

Pagina 269

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

Pagina 270 - Embedded Software

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

Pagina 271 - Embedded Software Assignments

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

Pagina 272 - Configuration Namespace

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 278

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

Pagina 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

Pagina 280 - HAL API Reference

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 285

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

Pagina 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

Pagina 287

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

Pagina 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

Pagina 289

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

Pagina 290

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

Pagina 291

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

Pagina 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

Pagina 293

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

Pagina 294

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

Pagina 295

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

Pagina 296

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

Pagina 297

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

Pagina 298

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

Pagina 299

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

Pagina 300

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

Pagina 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

Pagina 302

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

Pagina 303

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

Pagina 304 - Request Meaning

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

Pagina 305

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

Pagina 306

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

Pagina 307

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

Pagina 308

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

Pagina 309

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

Pagina 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

Pagina 311

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

Pagina 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

Pagina 313

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

Pagina 314

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

Pagina 315

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

Pagina 316

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

Pagina 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

Pagina 318

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

Pagina 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

Pagina 320

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

Pagina 321

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

Pagina 322

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

Pagina 323

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

Pagina 324

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

Pagina 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

Pagina 326

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

Pagina 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

Pagina 328

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

Pagina 329

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

Pagina 330

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

Pagina 331

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

Pagina 332

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

Pagina 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

Pagina 334

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

Pagina 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

Pagina 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

Pagina 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

Pagina 338

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

Pagina 339

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

Pagina 340

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

Pagina 341

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

Pagina 342

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

Pagina 343

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

Pagina 344

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

Pagina 345

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

Pagina 346

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

Pagina 347

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

Pagina 348

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

Pagina 349

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

Pagina 350

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

Pagina 351

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

Pagina 352

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

Pagina 353

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

Pagina 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

Pagina 355

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

Pagina 356

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

Pagina 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,

Pagina 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

Pagina 359

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

Pagina 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

Pagina 361

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

Pagina 362

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

Pagina 363

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

Pagina 364

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

Pagina 365

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

Pagina 366

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

Pagina 367

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

Pagina 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

Pagina 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

Pagina 370

get_exception_slave_descUsageget_exception_slave_descOptionsNoneDescriptionReturns the slave descriptor associated with the processor exception addres

Pagina 371

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

Pagina 372

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

Pagina 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

Pagina 374

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

Pagina 375

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

Pagina 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

Pagina 377

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

Pagina 378

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

Pagina 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

Pagina 380

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

Pagina 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

Pagina 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

Pagina 383

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

Pagina 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

Pagina 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

Pagina 386 - Settings Reference

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

Pagina 387

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

Pagina 388

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

Pagina 389

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

Pagina 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

Pagina 391

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

Pagina 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

Pagina 393

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

Pagina 394

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

Pagina 395

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

Pagina 396

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

Pagina 397

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

Pagina 398

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

Pagina 399

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

Pagina 400

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

Pagina 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

Pagina 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

Pagina 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

Pagina 404

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

Pagina 405

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

Pagina 406

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

Pagina 407

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

Pagina 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

Pagina 409

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

Pagina 410

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

Pagina 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

Pagina 412

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

Pagina 413

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

Pagina 414

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

Pagina 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

Pagina 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

Pagina 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

Pagina 418

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

Pagina 419

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

Pagina 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

Pagina 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

Pagina 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

Pagina 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

Pagina 424

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

Pagina 425

Altera Logging Functions...6-7Using File

Pagina 426

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

Pagina 427

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

Pagina 428

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

Pagina 429

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

Pagina 430

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

Pagina 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

Pagina 432

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

Pagina 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

Pagina 434

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

Pagina 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

Pagina 436

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

Pagina 437

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

Pagina 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

Pagina 439

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

Pagina 440

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

Pagina 441

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

Pagina 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

Pagina 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

Pagina 444

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

Pagina 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

Pagina 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

Pagina 447

General Exception Funnel...8-26Hardware Inter

Pagina 448

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

Pagina 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

Pagina 450

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

Pagina 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

Pagina 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

Pagina 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

Pagina 454

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

Pagina 455

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

Pagina 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

Pagina 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

Pagina 458

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

Pagina 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

Pagina 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

Pagina 461

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

Pagina 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

Pagina 463

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

Pagina 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

Pagina 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

Pagina 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

Pagina 467

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

Pagina 468

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

Comentarios a estos manuales

Sin comentarios