Altera Nios II Specifications

Browse online or download Specifications for Processors Altera Nios II. Altera Nios II Specifications [en] User Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 468
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 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
Page view 0
1 2 3 4 5 6 ... 467 468

Summary of Contents

Page 1 - Handbook

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

Page 2 - Contents

alt_alarm_start()... 14-10alt_a

Page 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

Page 4

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

Page 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

Page 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

Page 7

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

Page 8

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

Page 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

Page 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

Page 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

Page 12

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

Page 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

Page 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

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

Page 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

Page 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

Page 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

Page 20

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

Page 21 - Interface

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

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

Page 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

Page 24 - Configuring the FPGA

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

Page 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

Page 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

Page 27

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

Page 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

Page 29

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

Page 30

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

Page 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

Page 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

Page 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

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

Page 35 - The Command Area

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

Page 36 - The Drivers Tab

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

Page 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

Page 38 - The Console Area

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

Page 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

Page 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

Page 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

Page 42 - Optimizing Project Build Time

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

Page 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

Page 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

Page 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

Page 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

Page 47

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

Page 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

Page 49

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

Page 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

Page 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

Page 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

Page 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

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

Page 55

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 62

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

Page 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

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

Page 65 - Command Summary

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

Page 66

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

Page 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

Page 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

Page 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

Page 70 - Debugging hello_world

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

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

Page 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

Page 73

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

Page 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

Page 75 - Running make

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

Page 76

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

Page 77

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

Page 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

Page 79 - Makefile Targets

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

Page 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

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

Page 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

Page 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

Page 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

Page 85

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

Page 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

Page 87 - Target Operation

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

Page 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

Page 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

Page 90

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

Page 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

Page 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

Page 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

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

Page 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

Page 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

Page 97 - HAL BSP Files and Folders

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 106 - Regenerating Your BSP

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

Page 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

Page 108 - Updating Your BSP

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

Page 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

Page 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

Page 111 - Related Information

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

Page 112 - Argument Name Argument Value

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

Page 113

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

Page 114

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 123 - Restrictions

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

Page 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

Page 125 - Send Feedback

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

Page 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

Page 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

Page 128 - Supported Peripherals

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

Page 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

Page 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

Page 131

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

Page 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

Page 133

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

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

Page 141 - Name Description

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

Page 142 - Logging Levels

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

Page 143 - Altera Logging Files

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

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

Page 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

Page 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

Page 147 - Timestamp Driver

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

Page 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

Page 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

Page 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

Page 151

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

Page 152

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

Page 153

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

Page 154 - Using DMA Devices

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

Page 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

Page 156

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

Page 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

Page 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

Page 159 - Use /dev/null

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

Page 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

Page 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

Page 162 - Emulate ANSI C Functions

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

Page 163

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 171

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

Page 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

Page 173 - Hardware Abstraction Layer

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

Page 174

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

Page 175

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

Page 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

Page 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

Page 178

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

Page 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

Page 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

Page 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

Page 182 - Timer Device Drivers

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

Page 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

Page 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

Page 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

Page 186 - Software

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

Page 187

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

Page 188

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

Page 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

Page 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

Page 191 - The Nios II BSP Generator

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

Page 192 - File Names and Locations

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

Page 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

Page 194

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

Page 195

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

Page 196

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

Page 197

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

Page 198

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

Page 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

Page 200

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

Page 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

Page 202

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

Page 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

Page 204 - Using Macros

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

Page 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

Page 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

Page 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

Page 208 - Exception Handling

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

Page 209

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

Page 210 - Interrupt Controllers

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

Page 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

Page 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

Page 213

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

Page 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

Page 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

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

Page 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

Page 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

Page 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

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

Page 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

Page 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

Page 223

The Project Tab...2-21The T

Page 224

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

Page 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

Page 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

Page 227

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

Page 228

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

Page 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

Page 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

Page 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

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

Page 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

Page 234

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

Page 235 - Software Exception Funnel

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

Page 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

Page 237

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 247

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

Page 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

Page 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

Page 250

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

Page 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

Page 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

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

Page 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

Page 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

Page 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

Page 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

Page 258 - Nios II Edition

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

Page 259

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

Page 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

Page 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

Page 262

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

Page 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

Page 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

Page 265 - Option Description

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

Page 266

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

Page 267 - - Nios II Edition

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

Page 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

Page 269

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

Page 270 - Embedded Software

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

Page 271 - Embedded Software Assignments

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

Page 272 - Configuration Namespace

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

Page 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

Page 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

Page 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

Page 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

Page 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

Page 278

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

Page 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

Page 280 - HAL API Reference

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

Page 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

Page 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

Page 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

Page 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

Page 285

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

Page 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

Page 287

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

Page 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

Page 289

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

Page 290

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

Page 291

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

Page 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

Page 293

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

Page 294

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

Page 295

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

Page 296

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

Page 297

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

Page 298

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

Page 299

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

Page 300

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

Page 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

Page 302

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

Page 303

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

Page 304 - Request Meaning

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

Page 305

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

Page 306

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

Page 307

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

Page 308

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

Page 309

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

Page 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

Page 311

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

Page 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

Page 313

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

Page 314

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

Page 315

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

Page 316

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

Page 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

Page 318

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

Page 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

Page 320

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

Page 321

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

Page 322

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

Page 323

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

Page 324

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

Page 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

Page 326

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

Page 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

Page 328

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

Page 329

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

Page 330

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

Page 331

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

Page 332

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

Page 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

Page 334

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

Page 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

Page 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

Page 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

Page 338

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

Page 339

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

Page 340

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

Page 341

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

Page 342

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

Page 343

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

Page 344

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

Page 345

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

Page 346

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

Page 347

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

Page 348

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

Page 349

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

Page 350

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

Page 351

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

Page 352

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

Page 353

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

Page 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

Page 355

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

Page 356

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

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

Page 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

Page 359

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

Page 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

Page 361

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

Page 362

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

Page 363

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

Page 364

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

Page 365

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

Page 366

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

Page 367

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

Page 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

Page 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

Page 370

get_exception_slave_descUsageget_exception_slave_descOptionsNoneDescriptionReturns the slave descriptor associated with the processor exception addres

Page 371

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

Page 372

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

Page 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

Page 374

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

Page 375

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

Page 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

Page 377

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

Page 378

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

Page 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

Page 380

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

Page 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

Page 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

Page 383

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

Page 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

Page 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

Page 386 - Settings Reference

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

Page 387

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

Page 388

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

Page 389

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

Page 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

Page 391

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

Page 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

Page 393

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

Page 394

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

Page 395

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

Page 396

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

Page 397

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

Page 398

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

Page 399

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

Page 400

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

Page 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

Page 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

Page 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

Page 404

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

Page 405

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

Page 406

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

Page 407

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

Page 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

Page 409

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

Page 410

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

Page 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

Page 412

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

Page 413

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

Page 414

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

Page 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

Page 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

Page 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

Page 418

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

Page 419

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

Page 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

Page 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

Page 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

Page 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

Page 424

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

Page 425

Altera Logging Functions...6-7Using File

Page 426

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

Page 427

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

Page 428

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

Page 429

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

Page 430

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

Page 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

Page 432

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

Page 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

Page 434

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

Page 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

Page 436

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

Page 437

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

Page 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

Page 439

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

Page 440

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

Page 441

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

Page 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

Page 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

Page 444

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

Page 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

Page 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

Page 447

General Exception Funnel...8-26Hardware Inter

Page 448

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

Page 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

Page 450

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

Page 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

Page 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

Page 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

Page 454

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

Page 455

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

Page 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

Page 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

Page 458

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

Page 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

Page 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

Page 461

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

Page 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

Page 463

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

Page 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

Page 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

Page 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

Page 467

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

Page 468

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

Comments to this Manuals

No comments