Xilinx Esd Book
Xilinx Esd Book
Tools Reference
Manual
EDK 12.1
Revision History
The following table shows the revision history for this document.
Embedded System Tools Reference Manual www.xilinx.com UG111 April 19, 2010
Preface
Guide Contents
This guide contains the following chapters:
Chapter 1, Embedded System and Tools Architecture Overview
Chapter 2, Platform Specification Utility (PsfUtility)
Chapter 4, Platform Generator (Platgen)
Chapter 5, Command Line (no window) Mode
Chapter 6, Bus Functional Model Simulation
Chapter 7, Simulation Model Generator (Simgen)
Chapter 8, Library Generator (Libgen)
Chapter 9, GNU Compiler Tools
Chapter 10, Xilinx Microprocessor Debugger (XMD)
Chapter 11, GNU Debugger
Chapter 12, Bitstream Initializer (BitInit)
Chapter 13, System ACE File Generator (GenACE)
Chapter 14, Flash Memory Programming
Chapter 15, Version Management Tools (revup)
Chapter 16, Xilinx Bash Shell
Appendix A, GNU Utilities
Appendix B, Interrupt Management
Appendix C, EDK Tcl Interface
Appendix D, Glossary
Additional Resources
Xilinx website: http://www.xilinx.com
Xilinx Answer Browser and technical support WebCase website:
http://www.xilinx.com/support
Xilinx Platform Studio and EDK website:
http://www.xilinx.com/ise/embedded_design_prod/platform_studio.htm
Xilinx Platform Studio and EDK Document website:
http://www.xilinx.com/ise/embedded/edk_docs.htm
Xilinx XPS/EDK Supported IP website:
http://www.xilinx.com/ise/embedded/edk_ip.htm
Xilinx EDK Example website:
http://www.xilinx.com/ise/embedded/edk_examples.htm
Xilinx Tutorial website:
http://www.xilinx.com/support/techsup/tutorials/index.htm
Xilinx Data Sheets:
http://www.xilinx.com/support/documentation/data_sheets.htm
Xilinx Problem Solvers:
http://www.xilinx.com/support/troubleshoot/psolvers.htm
Xilinx ISE Manuals:
http://www.xilinx.com/support/software_manuals.htm
Additional Xilinx Documentation:
http://www.xilinx.com/support/library.htm
GNU Manuals:
http://www.gnu.org/manual
Conventions
This document uses the following conventions. An example illustrates each convention.
Typographical Conventions
The following typographical conventions are used in this document:
Online Document
The following conventions are used in this document:
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Load Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Output Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
HDL Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Implementation Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Synthesis Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
BMM Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Synthesis Netlist Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Drivers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
OS Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Appendix D: Glossary
Terms Used in EDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
About EDK
The Xilinx Embedded Development Kit (EDK) system tools enable you to design a
complete embedded processor system for implementation in a Xilinx FPGA device.
EDK is a component of the Integrated Software Environment (ISE) Design Suite
Embedded and System Editions. ISE is a Xilinx development system product that is
required to implement designs into Xilinx programmable logic devices. EDK includes:
The Xilinx Platform Studio (XPS) system tools suite with which you can develop your
embedded processor hardware.
The Software Development Kit (SDK), based on the Eclipse open-source framework,
which you can use to develop your embedded software application. SDK is also
available as a standalone program.
Embedded processing Intellectual Property (IP) cores including processors and
peripherals.
While the EDK environment supports creating and implementing designs, the
recommended flow is to begin with an ISE project, then add an embedded processor
source to the ISE project. EDK depends on ISE components to start synthesize the
microprocessor hardware design, to map that design to an FPGA target, and to generate
and download the bitstream.
For information about ISE, refer to the ISE software documentation. For links to ISE
documentation and other useful information see Additional Resources, page 4.
Additional Resources
The following documents are available in your EDK install directory, in
<install_directory>\doc\usenglish. You can also access them online using the
links below.
Platform Specification Format Reference Manual
OS and Libraries Document Collection
EDK Concepts, Tools, and Techniques Guide
EDK Profiling User Guide
http://www.xilinx.com/ise/embedded/edk_docs.htm
PowerPC 405 Processor Block Reference Guide
http://www.xilinx.com/support/documentation/user_guides/ug018.pdf
PowerPC 405 Processor Reference Guide
http://www.xilinx.com/support/documentation/user_guides/ug011.pdf
PowerPC 440 Embedded Processor Block in Virtex-5 FPGAs
http://www.xilinx.com/support/documentation/user_guides/ug200.pdf
MicroBlaze Processor User Guide
http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/mb_ref_guide.pdf
Verification File
Generation Software Debug
Device Configuration
Device Configuration
X11124
Hardware Development
Xilinx FPGA technology allows you to customize the hardware logic in your processor
subsystem. Such customization is not possible using standard off-the-shelf microprocessor
or controller chips.
The term Hardware platform describes the flexible, embedded processing subsystem
you are creating with Xilinx technology for your application needs.
The hardware platform consists of one or more processors and peripherals connected to
the processor buses. XPS captures the hardware platform description in the
Microprocessor Hardware Specification (MHS) file.
The MHS file is the principal source file that maintains the hardware platform description
and represents in ASCII text the hardware components of your embedded system.
When the hardware platform description is complete, the hardware platform can be
exported for use by SDK.
Software Development
A board support package (BSP) is a collection of software drivers and, optionally, the
operating system on which to build your application. The created software image contains
only the portions of the Xilinx library you use in your embedded design. You can create
multiple applications to run on the BSP.
The hardware platform must be imported into SDK prior to creation of software applications
and BSP.
Verification
EDK provides both hardware and software verification tools. The following subsections
describe the verification tools available for hardware and software.
Device Configuration
When your hardware and software platforms are complete, you then create a
configuration bitstream for the target FPGA device.
For prototyping, download the bitstream along with any software you require to run
on your embedded platform while connected to your host computer.
For production, store your configuration bitstream and software in a non-volatile
memory connected to the FPGA.
EDK Overview
An embedded hardware platform typically consists of one or more processors, peripherals
and memory blocks, interconnected via processor buses. It also has port connections to the
outside world. Each of the processor cores (also referred to as pcores or processor IPs) has a
number of parameters that you can adjust to customize its behavior. These parameters also
define the address map of your peripherals and memories. XPS lets you select from
various optional features; consequently, the FPGA needs only implement the subset of
functionality required by your application.
The following figure provides an overview of the EDK architecture structure of how the
tools operate together to create an embedded system.
CompXLib
Libraries, PCore
.a OS, MLD HDL Behavioral
System and HDL Model
system.BMM
Wrapper HDL
ISE Tools
Synthesis (XST)
NGC
Application Source
.c, .h, .s NGCBuild
Implementation Simulation
Compiler (GCC) Constraint File NGDBuild
Generator
(UCF)
.o, .a NGD
Structural
HDL Model
MAP, PAR
NCD
Linker
Linker Script Simulation
(GCC) system_BD.BMM Bitstream Generator
Generator
download.BIT
Simulation
Debugger
(XMD, GDB) download.CMD iMPACT
JTAG Cable
FPGA
Device
X10310
Coprocessor Wizard
The Configure Coprocessor wizard helps add and connect a coprocessor to a CPU. A
coprocessor is a hardware module that implements a user-defined function and connects
to the processor through an auxiliary bus. The coprocessor has a Fast Simplex Link (FSL)
interface. For MicroBlaze systems, the coprocessor connects to MicroBlaze's FSL interface.
For PowerPC systems, the coprocessor connects to the Auxiliary Processor Unit (APU)
interface of the PowerPC processor by means of the fcb2fsl bridge.
For details on the Fast Simplex Link, refer to its data sheet and the MicroBlaze Processor
Reference Guide. For information about the APU bus, refer to the PowerPC reference
guides. For information on the fcb2fsl bridge, refer to its data sheet. Links to document
locations are available in the Additional Resources, page 18.
For instructions on using the Coprocessor wizard, refer to the Xilinx Platform Studio Help.
GNU Debugger
The GNU Debugger (GDB) is a powerful yet flexible tool that provides a unified interface
for debugging and verifying MicroBlaze and PowerPC processor systems during various
development phases.
GDB uses Xilinx Microprocessor Debugger (XMD) as the underlying engine to
communicate to processor targets.
Refer to Chapter 11, GNU Debugger, for more information.
Chapter 2
Tool Options
Tool Options
Table 2-1: PsfUtility Syntax Options
Option Command Description
Single IP MHS -deploy_core Generate MHS Template that instantiates a single peripheral.
template <corename> Suboptions are:
<coreversion> -lp <Library_Path> Add one or more additional IP library
search paths
-o <outfile> Specify output filename; default is stdout
Help -h, -help Displays the usage menu then exits.
HDL file to MPD -hdl2mpd <hdlfile> Generate MPD from the VHDL/Ver/src/prj file.
Suboptions are:
-lang {ver|vhdl} Specify language
-top <design> Specify top-level entity or module name
-bus {opb(2)|plb(2)|plbv46|dcr|lmb|fsl m|s|ms|mb(1)
[<busif_name>]} Specify one or more bus interfaces for the
peripheral
-p2pbus <busif_name> <bus_std>
{target|initiator} Specify one or more point-to-point
connections for the peripheral
-o <outfile> Specify output filename; default is stdout
PAO file to MPD -pao2mpd <paofile> Generate MPD from Peripheral Analyze Order (PAO) file.
Suboptions are:
-lang {ver|vhdl} Specify language
-top <design> Specify top-level entity or module name
-bus {opb(2)|plb(2)|plbv46|dcr|lmb|fsl m|s|ms|mb(1)
[<busif_name>]} Specify one or more peripherals and
optional interface name(s)
-p2pbus <busif_name> <bus_std>
{target|initiator} Specify one or more point-to-point
connections of the peripheral
-o <outfile> Specify output filename; default is stdout
Display version -v Displays the version number
information
Note:
1. Bus type mb (master that generates burst transactions) is valid for bus standard PLBv46 only.
2. Deprecated in this release.
For components that have more than one bus interface of the same type, naming
conventions must be followed so the automation tools can group the bus interfaces.
Reserved Parameters
The following table lists the parameters that Platgen populates automatically.
Global Ports
The names for the global ports of a peripheral, such as clock and reset signals, are
standardized. You can use any name for other global ports, such as the interrupt signal.
For interconnection to the OPB, masters and slaves must provide the following inputs:
<BI><nOPB>_ABus : in std_logic_vector(0 to C_<BI>OPB_AWIDTH-1);
<BI><nOPB>_BE : in std_logic_vector(0 to C_<BI>OPB_DWIDTH/8-1);
<BI><nOPB>_Clk : in std_logic;
<BI><nOPB>_DBus : in std_logic_vector(0 to C_<BI>OPB_DWIDTH-1);
<BI><nOPB>_errAck : in std_logic;
<BI><nOPB>_MGrant : in std_logic;
<BI><nOPB>_retry : in std_logic;
<BI><nOPB>_RNW : in std_logic;
<BI><nOPB>_Rst : in std_logic;
<BI><nOPB>_select : in std_logic;
<BI><nOPB>_seqAddr : in std_logic;
<BI><nOPB>_timeout : in std_logic;
<BI><nOPB>_xferAck : in std_logic;
Examples:
IOPB_DBus : in std_logic_vector(0 to C_IOPB_DWIDTH-1);
OPB_DBus : in std_logic_vector(0 to C_OPB_DWIDTH-1);
Bus1_OPB_DBus : in std_logic_vector(0 to C_Bus1_OPB_DWIDTH-1);
Examples:
IPLB0_PLB_MBusy : in std_logic;
Bus1_PLB_MBusy : in std_logic;
Chapter 3
Psf2Edward Program
The program psf2Edward is a command line program that converts a Xilinx Embedded
Development Kit (EDK) project into Edward, an internal XML format, for use in external
programs such as the Software Development Kit (SDK).
The DTD for the Edward Format can be found in
<EDK installation directory>/data/xml/DTD/Xilinx/Edward.
Program Usage
You can use Psf2Edward to do the following:
Convert PSF project to XML format. To do this, use the following command:
psf2Edward -inp <psf input source> -xml <xml output file>
<options>
Synchronize an existing XML file with a PSF project.
psf2Edward -inp <psf input source> -sync < XML file to sync>
<options>
Program Options
Psf2Edward has the following options:
Option Description
inp Input PSF source. This can be either a Microprocessor
Hardware Specification (MHS) file or a Xilinx
Microprocessor Project (XMP) file.
xml Output XML file.
sync Input sync XML file. This outputs to the same file.
p Part Name. This must be used if the PSF source is an
MHS file.
edwver Set schema version of Edward to write. For example, 1.1
and 1.2.
dont_run_checkhwsys Do not run full set of system drc checks.
exit_on_error Exit on first drc error. By default, non-fatal errors are
ignored.
Program Options
Features
The features of Platgen includes the creation of:
The programmable system on a chip in the form of hardware netlists (HDL and
implementation netlist files.)
A hardware platform using the Microprocessor Hardware Specification (MHS) file as
input.
Netlist files in various formats such as NGC and EDIF.
Support files for downstream tools and top-level HDL wrappers to allow you to add
other components to the automatically generated hardware platform.
After running Platgen, XPS spawns the Project Navigator interface for the FPGA
implementation tools to complete the hardware implementation, allowing you full control
over the implementation. At the end of the ISE flow, a bitstream is generated to configure
the FPGA. This bitstream includes initialization information for block RAM memories on
the FPGA chip. If your code or data must be placed on these memories at startup, the
Data2MEM tool in the ISE tool set updates the bitstream with code and data information
obtained from your executable files, which are generated at the end of the software
application creation and verification flow.
Additional Resources
The Platform Specification Format Reference Manual:
http://www.xilinx.com/ise/embedded/edk_docs.htm
Tool Requirements
Set up your system to use the Xilinx Integrated Development System. Verify that your
system is properly configured. Consult the release notes and installation notes for more
information.
Tool Usage
Run Platgen as follows:
platgen -p <partname> system.mhs
where:
platgen is the executable name.
Tool Options
The following table lists the supported Platgen syntax options.
Table 4-1: Platgen Syntax Options
Option Command Description
Help -h, -help Displays the usage menu and then exits
without running the Platgen flow.
Version -v Displays the version number of Platgen
and then exits without running the
Platgen flow.
Filename -f <filename> Reads command line arguments and
options from file.
Integration -intstyle Indicates contextual information when
Style {ise|default} invoking Xilinx applications within a flow
or project environment.
Language -lang {verilog|vhdl} Specifies the HDL language output.
Default: vhdl
Log output -log <logfile[.log]> Specifies the log file.
Default: platgen.log
Library path for -lp <Library_Path> Adds <Library_Path> to the list of IP
user peripherals search directories. A library is a collection
and driver of repository areas.
repositories
Load Path
Refer to the following figure for a depiction of the peripheral directory structure.
To specify additional directories, use one of the following options:
Use the current directory (from which Platgen was launched.)
Set the EDK tool -lp option.
Platgen uses a search priority mechanism to locate peripherals in the following order:
1. The pcores directory in the project directory.
2. The <Library_Path>/<Library_Name>/pcores as specified by the -lp option.
3. The $XILINX_EDK/hw/<Library_Name>/pcores.
Note: Directory path names are case-sensitive in Linux. Ensure that you are using pcore and not
Pcore.
-lp <library_path>
<Library Name>
Output Files
Platgen produces directories and files from the project directory in the following
underlying directory structure:
/hdl
/implementation
/synthesis
HDL Directory
The /hdl directory contains the following files:
system.{vhd|v} is the HDL file of the embedded processor system as defined in the
MHS, and the toplevel file for your project.
system_stub.{vhd|v} is the toplevel template HDL file of the instantiation of the
system. Use this file as a starting point for your own toplevel HDL file.
<inst>_wrapper.{vhd|v} is the HDL wrapper file for the of individual IP
components defined in the MHS.
Implementation Directory
The implementation directory contains implementation netlist files with the naming
convention <instance_name>_wrapper.ngc. It also contains the
<instance_name>_wrapper.ncf file for IP components for which constraints are
generated.
Synthesis Directory
The synthesis directory contains the following synthesis project file:
system.[prj|scr]
BMM Flow
Platgen generates the <system>.bmm and the <system>_stub.bmm in the
<Project_Name>/implementation directory.
The <system>.bmm is used by the implementation tools when EDK is the top-level
system.
The <system>_stub is used by the implementation when EDK is a sub-module of the
top-level system.
The EDK tools implementation tools flow using Data2MEM is as follows:
ngdbuild -bm <system>.bmm <system>.ngc
map
par
bitgen -bd <system>.elf
Bitgen outputs <system>_bd.bmm, which contains the physical location of block RAMs.
A block RAM Memory Map (BMM) file contains a syntactic description of how individual
block RAMs constitute a contiguous logical data space.
Chapter 5
simulator [mti|ncsim|isim|none] Set the simulator for which you want simulation scripts generated
sim_x_lib Set the simulation library. For details, refer to Chapter 7, Simulation
Model Generator (Simgen).
swapps Get a list of software applications. This option can not be used with
xset command.
ucf_file Specify a path to the User Constraints File (UCF) to be used for
implementation tools.
usercmd1 Set the user command 1.
usercmd2 Set the user command 2.
user_make_file <directory path> Specify a path to the make file. This file should not be same as the
make file generated by XPS.
Restrictions
MSS Changes
XPS-batch supports limited MSS editing. If you want to make any changes in the MSS file,
you must hand edit the file, make the changes, and then run the xload mss command to
load the changes into XPS. You do not have to close the project. You can save the MSS file,
edit it, and then re-load it into the project with the xload mss command.
XMP Changes
Xilinx recommends that you do not edit the XMP file manually. The XPS -batch mode
supports changing project options through commands. It also supports adding source and
header files to a processor and setting any compiler options. Any other changes must be
done from XPS.
Chapter 6
Introduction
Bus Functional Simulation provides the ability to generate bus stimulus and thereby
simplifies the verification of hardware components that attach to a bus. Bus Functional
Simulation circumvents the drawbacks to the two typical validation methods, which are:
Creating a test bench: This is time-consuming because it involves describing the
connections and test vectors for all combinations of bus transactions.
Creating a larger system with other known-good components that create or respond
to bus transactions: This is time-consuming because it requires that you describe the
established connections to the device under test, program the added components to
generate the bus transactions to which the device will respond, and potentially
respond to bus transactions that the device is generating. Such a system usually
involves creating and compiling code, storing that code in memory for the
components to read, and generating the correct bus transactions.
IP Verification
When verifying a single piece of IP that includes a bus interface you concern yourself with
the internal details of the IP design and the bus interactions. It is inefficient to attach the IP
to a large system only to verify that it is functioning properly.
The following figure shows an example in which a master BFM generates bus transactions
to which the device under test responds. The monitor BFM reports any errors regarding
the bus compliance of the device under test.
Monitor
BFM
Bus
Master Slave Device
BFM Under Test
Arbiter
X10847
The following figure shows an example in which a slave BFM responds to bus transactions
that the device under test generates. The monitor BFM reports any errors regarding the bus
compliance of the device under test.
X-Ref Target - Figure 6-2
Monitor
BFM
Bus
Master Device
Slave BFM
Under Test
Arbiter
X10848
Speed-Up Simulation
When verifying a large system design, it can be time consuming to simulate the internal
details of each IP component that attaches to a bus. There are certain complex pieces of IP
that take a long time to simulate and could be replaced by a Bus Functional Model,
especially when the internal details of the IP are not of interest. Additionally, some IP
components are not easy to program to generate the desired bus transactions.
The following figure shows how two different IP components that are bus masters have
been replaced by BFM master modules. These modules are simple to program and can
provide a shorter simulation time because no internal details are modeled.
X-Ref Target - Figure 6-3
Monitor
BFM
Master
Component 1
BFM
Bus
Master
Component 2
BFM
Arbiter
X10849
# Parameters
PARAMETER VERSION = 2.1.0
# Ports
PORT sys_clk = sys_clk, DIR = I, SIGIS = CLK
PORT sys_reset = sys_reset, DIR = IN
# Components
BEGIN plb_v46
PARAMETER INSTANCE = myplb
PARAMETER HW_VER = 1.01.a
PARAMETER C_DCR_INTFCE = 0
PORT PLB_Clk = sys_clk
PORT SYS_Rst = sys_reset
END
BEGIN plb_bram_if_cntlr
PARAMETER INSTANCE = myplbbram_cntlr
BEGIN bram_block
PARAMETER INSTANCE = bram1
PARAMETER HW_VER = 1.00.a
BUS_INTERFACE PORTA = porta
END
BEGIN plbv46_master_bfm
PARAMETER INSTANCE = my_master
PARAMETER HW_VER = 1.00.a
PARAMETER PLB_MASTER_ADDR_LO_0 = 0xFFFF0000
PARAMETER PLB_MASTER_ADDR_HI_0 = 0xFFFFFFFF
BUS_INTERFACE MPLB = myplb
PORT SYNCH_OUT = synch0
PORT SYNCH_IN = synch
END
BEGIN plbv46_slave_bfm
PARAMETER INSTANCE = my_slave
PARAMETER HW_VER = 1.00.a
PARAMETER PLB_SLAVE_ADDR_LO_0 = 0xFFFF0000
PARAMETER PLB_SLAVE_ADDR_HI_0 = 0xFFFF7FFF
BUS_INTERFACE SPLB = myplb
PORT SYNCH_OUT = synch1
PORT SYNCH_IN = synch
END
BEGIN plbv46_monitor_bfm
PARAMETER INSTANCE = my_monitor
PARAMETER HW_VER = 1.00.a
BUS_INTERFACE MON_PLB = myplb
PORT SYNCH_OUT = synch2
PORT SYNCH_IN = synch
END
BEGIN bfm_synch
PARAMETER INSTANCE = my_synch
PARAMETER HW_VER = 1.00.a
PARAMETER C_NUM_SYNCH = 3
PORT FROM_SYNCH_OUT = synch0 & synch1 & synch2
PORT TO_SYNCH_IN = synch
END
FROM_SYNCH_OUT
C_NUM_SYNCH = 3 BFM Synch
TO_SYNCH_IN
X10850
-- Initialize my_master
-- Note: The instance name for plb_master is duplicated in the
-- path due to the wrapper level inserted by the tools
set_device(path=/system/my_master/my_master/master,device_type=plb_mas
ter)
mem_update(addr=ffff8020,data=33334444_55556666)
write (addr=ffff8020,be=1100_0000)
write (addr=ffff8022,be=0011_0000)
write (addr=ffff8024,be=0000_1100)
write (addr=ffff8026,be=0000_0011)
read (addr=ffff8020,be=1100_0000)
read (addr=ffff8022,be=0011_0000)
read (addr=ffff8024,be=0000_1100)
read (addr=ffff8026,be=0000_0011)
More information about the PLB Bus Functional Language may be found in the
PlbToolkit.pdf document in the $XILINX_EDK/third_party/doc directory.
Chapter 7
Simgen Overview
Simgen creates and configures various VHDL and Verilog simulation models for a
specified hardware. Simgen takes, as the input file, the Microprocessor Hardware
Specification (MHS) file, which describes the instantiations and connections of hardware
components.
Simgen is also capable of creating scripts for a specified vendor simulation tool. The scripts
compile the generated simulation models.
The hardware component is defined by the MHS file. Refer to the Microprocessor
Hardware Specification (MHS) chapter in the Platform Specification Format Reference
Manual for more information. The Additional Resources, page 81 section contains a link
to the document web site. For more information about simulation basics and for
discussions of behavioral, structural, and timing simulation methods, refer to the Platform
Studio Online Help.
Additional Resources
Platform Specification Format Reference Manual
http://www.xilinx.com/ise/embedded/edk_docs.htm
Command Line Tools User Guide and ISE Synthesis and Simulation Design User Guide
http://www.xilinx.com/support/software_manuals.htm
Simulation Libraries
Simulation Libraries
EDK simulation netlists use low-level hardware primitives available in Xilinx FPGAs.
Xilinx provides simulation models for these primitives in the libraries listed in this section.
The libraries described in the following sections are available for the Xilinx simulation
flow. The HDL code must refer to the appropriate compiled library. The HDL simulator
must map the logical library to the physical location of the compiled library.
UNISIM Library
The UNISIM Library is a library of functional models used for behavioral and structural
simulation. It includes all of the Xilinx Unified Library components that are inferred by
most popular synthesis tools. The UNISIM library also includes components that are
commonly instantiated, such as I/Os and memory cells.
You can instantiate the UNISIM library components in your design (VHDL or Verilog) and
simulate them during behavioral simulation. Structural simulation models generated by
Simgen instantiate UNISIM library components.
Asynchronous components in the UNISIM library have zero delay. Synchronous
components have a unit delay to avoid race conditions. The clock-to-out delay for these
synchronous components is 100 ps.
SIMPRIM Library
The SIMPRIM Library is used for timing simulation. It includes all the Xilinx primitives
library components used by Xilinx implementation tools. Timing simulation models
generated by Simgen instantiate SIMPRIM library components.
XilinxCoreLib Library
The Xilinx CORE Generator software is a graphical Intellectual Property (IP) design tool
for creating high-level modules like FIR Filters, FIFOs, CAMs, and other advanced IP.
You can customize and pre-optimize modules to take advantage of the inherent
architectural features of Xilinx FPGA devices, such as block multipliers, SRLs, fast carry
logic and on-chip, single- or dual-port RAM.
The CORE Generator software HDL library models are used for behavioral simulation.
You can select the appropriate HDL model to integrate into your HDL design. The models
do not use library components for global signals.
Compxlib Utility
Xilinx provides the Compxlib utility to compile the HDL libraries for Xilinx-supported
simulators. Compxlib compiles the UNISIM, SIMPRIM, and XilinxCoreLib libraries for
supported device architectures using the tools provided by the simulator vendor. You
must have an installation of the Xilinx implementation tools to compile your HDL libraries
using Compxlib.
Run Compxlib with the -help option if you need to display a brief description for the
available options:
compxlib -help
Each simulator uses certain environment variables that you must set before invoking
Compxlib. Consult your simulator documentation to ensure that the environment is
properly set up to run your simulator.
Note: Make sure you use the -p <simulator_path> option to point to the directory where the
ModelSim executable is, if it is not in your path.
Simulation Models
The following is an example of a command for compiling Xilinx libraries for MTI_SE:
Compxlib -s mti_se -arch all -l vhdl -w -dir .
This command compiles the necessary Xilinx libraries into the current working directory.
Refer to the Command Line Tools User Guide for information Compxlib. Refer to the
Simulating Your Design chapter of the Synthesis and Simulation Design Guide to learn
more about compiling and using Xilinx ISE simulation libraries. A link to the
documentation website is provided in Additional Resources, page 81.
Simulation Models
This section describes how and when each of three FPGA simulation models are
implemented, and provides instructions for creating simulation models using XPS batch
mode. At specific points in the design process, Simgen creates an appropriate simulation
model, as shown in the following figure.
The following figure illustrates the FPGA design simulation stages:
Functional Simulation
UG111_01_111903
Behavioral Models
To create a behavioral simulation model as displayed in the following figure, Simgen
requires an MHS file as input. Simgen creates a set of HDL files that model the
functionality of the design. Optionally, Simgen can generate a compile script for a specified
vendor simulator.
If specified, Simgen can generate HDL files with data to initialize block RAMs associated
with any processor that exists in the design. This data is obtained from an existing
Executable Linked Format (ELF) file.
X-Ref Target - Figure 7-2
HDL
MHS Simgen
ELF
Script
UG111_02_101705
Structural Models
To create a structural simulation model as shown in the following figure, Simgen requires
an MHS file as input and associated synthesized netlist files. From these netlist files,
Simgen creates a set of HDL files that structurally model the functionality of the design.
Optionally, Simgen can generate a compile script for a specified vendor simulator.
If specified, Simgen can generate HDL files with data to initialize block RAMs associated
with any processor that exists in the design. This data is obtained from an existing ELF file.
The following figure illustrates the structural simulation model simulation generation.
X-Ref Target - Figure 7-3
NGC
HDL
MHS Simgen
ELF
Script
UG111_03_101705
Timing Models
To create a timing simulation model as displayed in Figure 7-4, page 86, Simgen requires
an MHS file as input and an associated implemented netlist file. From this netlist file,
Simgen creates an HDL file that models the design and a Standard Data Format (SDF) file
with the appropriate timing information. Optionally, Simgen can generate a compile script
for a specified vendor simulator. If specified, Simgen can generate HDL files with data to
initialize block RAMs associated with any processor that exists in the design. This data is
obtained from an existing ELF file.
X-Ref Target - Figure 7-4
Simulation Models
NCD
HDL
MHS Simgen
ELF
Script
UG111_04_101705
Simgen Syntax
At the prompt, run Simgen with the MHS file and appropriate options as inputs.
For example, simgen <system_name>.mhs [options]
Requirements
Verify that your system is properly configured to run the Xilinx ISE tools. Consult the
release notes and installation notes that came with your software package for more
information.
Options
The following Simgen options are supported:
Simgen Syntax
ncs = NCSim
isim = ISE Simulator
Source Directory -sd <source_dir> Specifies the source directory to search for netlist
files.
Testbench Template -tb Creates a testbench template file.
Use -ti and -tm to define the design under test
name and the testbench name, respectively.
Top-Level Instance -ti <top_instance> When a testbench template is requested, use
<top_instance> to define the instance name of
the design under test.
When design represents a sub-module, use
<top_instance> for the top-level instance name.
Top-Level Module -tm <top_module> When a testbench template is requested, use
top_module to define the name of the testbench.
When the design represents a sub-module, use
<top_module> for the top-level entity/module
name.
Top-Level -toplevel [yes|no] yes - Design represents a whole design.
no - Design represents a level of hierarchy (sub-
module).
Default: yes
Version -v Displays the version and then quits.
Xilinx Library Directory -X <xlib_directory> Path to the Xilinx simulation libraries (unisim,
simprim, XilinCoreLib) directory. This is the
output directory of the Compxlib tool.
Output Files
Simgen produces all simulation files in the /simulation directory, which is located inside
the /output_directory. In the /simulation directory, there is a subdirectory for each
simulation model such as:
output_directory/simulation/<sim_model>
Where <sim_model> is one of: behavioral, structural, or timing
After a successful Simgen execution, the simulation directory contains the following files:
Memory Initialization
Memory Initialization
If a design contains banks of memory for a system, the corresponding memory simulation
models can be initialized with data. You can specify a list of ELF files to associate to a given
processor instance using the -pe switch.
The compiled executable files are generated with the appropriate GNU Compiler
Collection (GCC) compiler or assembler, from corresponding C or assembly source code.
Note: Memory initialization of structural simulation models is only supported when the netlist file
has hierarchy preserved.
For VHDL/Verilog simulation models, run Simgen with the -pe option to generate .mem
files. These .mem files contain a configuration for the system with all initialization values.
For example:
simgen system.mhs -pe mblaze executable.elf -l vhdl ...
simgen system.mhs -pe mblaze executable.elf -l verilog ...
These .mem files are used along with your system to initialize memory. The BRAM blocks
connected to the mblaze processor contain the data in executable.elf.
Test Benches
Simgen is capable of creating test bench templates. If you use the -tb switch, simgen will
create a test bench which will instantiate the top-level design and will create default
stimulus for clock and reset signals.
Clock stimulus is inferred from any global port which is tagged SIGIS = CLK in the MHS
file. The frequency of the clock is given by the CLK_FREQ tag. The phase of the clock is given
by the CLK_PHASE tag, which takes values from 0 to 360.
Reset stimulus is inferred for all global ports tagged SIGIS = RST in the MHS file. The
polarity of the reset signal is given by the RST_POLARITY tag. The length of the reset is
given by the RST_LENGTH tag.
For more information about the clock and reset tags, refer to the Platform Studio Online
Help.
library UNISIM;
use UNISIM.VCOMPONENTS.ALL;
entity system_tb is
end system_tb;
component system is
port (
sys_clk : in std_logic;
sys_reset : in std_logic;
rx : in std_logic;
tx : out std_logic;
leds : inout std_logic_vector(0 to 3)
);
end component;
-- Internal signals
begin
dut : system
port map (
sys_clk => sys_clk,
sys_reset => sys_reset,
rx => rx,
tx => tx,
leds => leds
);
process
begin
sys_clk <= '0';
wait for (sys_clk_PHASE);
loop
wait for (sys_clk_PERIOD/2);
sys_clk <= not sys_clk;
end loop;
end process;
process
begin
sys_reset <= '0';
wait for (sys_reset_LENGTH);
sys_reset <= not sys_reset;
wait;
end process;
Memory Initialization
`uselib lib=unisims_ver
module system_tb
(
);
// Internal signals
system
dut (
.sys_clk ( sys_clk ),
.sys_reset ( sys_reset ),
.rx ( rx ),
.tx ( tx ),
.leds ( leds )
);
initial
begin
sys_clk = 1'b0;
#(sys_clk_PHASE);forever
#(sys_clk_PERIOD/2)
sys_clk = ~sys_clk;
end
initial
begin
sys_reset = 1'b0;
#sys_clk_LENGTH sys_reset = ~sys_reset;
end
endmodule
You can add your own Verilog code between the lines tagged BEGIN USER CODE and END
USER CODE. The code between these lines is maintained if simulation files are created
again. Any code outside these lines will be lost if a new test bench is created.
Restrictions
Simgen does not provide simulation models for external memories and does not have
automated support for simulation models. External memory models must be instantiated
and connected in the simulation testbench and initialized according to the model
specifications.
Restrictions
Chapter 8
Overview
Libgen is the first Embedded Design Kit (EDK) tool that you run to configure libraries and
device drivers. Libgen takes an XML hardware specification file and a Microprocessor
Software Specification (MSS) file that you create. The hardware specification file defines
the hardware system to Libgen and the MSS file describes the content and configuration of
the software platform for a particular processor. Components are instantiated as blocks in
the MSS file, and configuration is specified using parameters. Libgen reads the MSS file
and generates the software components, configuring them as specified in the MSS.
For further description on generating the XML hardware specification file refer to the
Software Development Kit (SDK) documentation in the SDK Online Help. For further
description of the MSS file format, refer to the Microprocessor Software Specification
(MSS) chapter in the Platform Specification Format Reference Manual. A link to the document
is supplied in Additional Resources, page 96.
Note: EDK includes a Format Revision tool to convert older MSS file formats to a new MSS format.
Refer to Chapter 15, Version Management Tools (revup), for more information.
Additional Resources
Additional Resources
Platform Specification Format Reference Manual
http://www.xilinx.com/ise/embedded/edk_docs.htm
OS and Libraries Document Collection
http://www.xilinx.com/ise/embedded/edk_docs.htm
Device Driver Programmer Guide is located in the /doc/usenglish folder of your EDK
installation, file name: xilinx_drivers_guide.pdf.
Tool Usage
To run Libgen, type the following:
libgen [options] <filename>.mss
Tool Options
The following options are supported in this version.
Load Paths
The following figure and Figure 8-2 on page 98 are diagrams of the directory structure for
drivers, libraries, and Operating Systems (OSs).
-lp<library_path>
<Library Name>
Output Files
Default Repositories
By default, Libgen scans the following repositories for software components:
$XILINX_EDK/sw/lib/XilinxProcessorIPLib
$XILINX_EDK/sw/lib
$XILINX_EDK/sw/ThirdParty
It also treats the directory from which Libgen is invoked as a repository and therefore scans
for cores under sub-directories with standard directory names, such as drivers, bsp, and
sw_services.
<Library Name>
.c files .h files MDD Tcl .c files .h files MLD Tcl .c files .h files MLD Tcl .c files .h files MDD Tcl
X10134
Output Files
Libgen generates directories and files in the YOUR_PROJECT directory. For every processor
instance in the MSS file, Libgen generates a directory with the name of the processor
instance. Within each processor instance directory, Libgen generates the following
directories and files, which are described in the following subsections:
The include Directory
lib Directory
libsrc Directory
code Directory
lib Directory
The lib directory contains libc.a, libm.a, and libxil.a libraries. The libxil library
contains driver functions that the particular processor can access. For more information
about the libraries, refer to the introductory section of the OS and Libraries Document
Collection. A link to the document is supplied in the Additional Resources, page 96.
libsrc Directory
The libsrc directory contains intermediate files and make files needed to compile the
OSs, libraries, and drivers. The directory contains peripheral-specific driver files, BSP files
for the OS, and library files that are copied from the EDK and your driver, OS, and library
directories. Refer to the Drivers, page 101, OS Block, page 102, and Libraries, page
102 sections of this chapter for more information.
code Directory
The code directory is a repository for EDK executables. Libgen creates an xmdstub.elf
file (for MicroBlaze on-board debug) in this directory.
Note: Libgen removes these directories every time you run the tool. You must put your sources,
executables, and any other files in an area that you create.
Overview
This section provides and overview of generating libraries and drivers.
The hardware specification file and the MSS files define a system. For each processor in the
system, Libgen finds the list of addressable peripherals. For each processor, a unique list of
drivers and libraries are built. Libgen does the following for each processor:
Builds the directory structure as defined in the Output Files, page 98.
Copies the necessary source files for the drivers, OSs, and libraries into the processor
instance specific area: OUTPUT_DIR/processor_instance_name/libsrc.
Calls the Design Rule Check (DRC) procedure, which is defined as an option in the
MDD or MLD file, for each of the drivers, OSs, and libraries visible to the processor.
Calls the generate Tcl procedure (if defined in the Tcl file associated with an MDD or
MLD file) for each of the drivers, OSs, and libraries visible to the processor. This
generates the necessary configuration files for each of the drivers, OSs, and libraries in
the include directory of the processor.
Calls the post_generate Tcl procedure (if defined in the Tcl file associated with an
MDD or MLD file) for each of the drivers, OSs, and libraries visible to the processor.
Runs make (with targets include and libs) for the OSs, drivers, and libraries specific
to the processor. On the Linux platform, the gmake utility is used, while on NT
platforms, make is used for compilation.
Calls the execs_generate Tcl procedure (if defined in the Tcl file associated with an
MDD or MLD file) for each of the drivers, OSs, and libraries visible to the processor.
For more information about the Tcl procedures and MDD/MLD related parameters, refer
to the Microprocessor Driver Definition (MDD) and Microprocessor Library Definition
(MLD) chapters in the Platform Specification Format Reference Manual. A link to the
document is supplied in the Additional Resources, page 96.
MSS Parameters
For a complete description of the MSS format and all the parameters that MSS supports,
refer to the Microprocessor Software Specification (MSS) chapter in the Platform
Specification Format Reference Manual. A link to the document is supplied in the Additional
Resources, page 96.
Drivers
Most peripherals require software drivers. The EDK peripherals are shipped with
associated drivers, libraries and BSPs. Refer to the Device Driver Programmer Guide for more
information on driver functions. A link to the guide is supplied in the Additional
Resources, page 96.
The MSS file includes a driver block for each peripheral instance. The block contains a
reference to the driver by name (DRIVER_NAME parameter) and the driver version
(DRIVER_VER). There is no default value for these parameters.
A driver has an associated MDD file and a Tcl file.
The driver MDD file is the data definition file and specifies all configurable
parameters for the drivers.
Each MDD file has a corresponding Tcl file which generates data that includes
generation of header files, generation of C files, running DRCs for the driver, and
generating executables.
You can write your own drivers. These drivers must be in a specific directory under
<YOUR_PROJECT>/<driver_name> or <library_name>/drivers, as shown in
Figure 8-1 on page 97.
The DRIVER_NAME attribute allows you to specify any name for your drivers, which is
also the name of the driver directory.
The source files and make file for the driver must be in the /src subdirectory under
the /<driver_name> directory.
The make file must have the targets /include and /libs.
Each driver must also contain an MDD file and a Tcl file in the /data subdirectory.
Open the existing EDK driver files to get an understanding of the required structure.
Refer to the Microprocessor Driver Definition (MDD) chapter in the Platform Specification
Format Reference Manual for details on how to write an MDD and its corresponding Tcl file.
A link to the document is supplied in the Additional Resources, page 96.
Libraries
Libraries
The MSS file includes a library block for each library. The library block contains a reference
to the library name (LIBRARY_NAME parameter) and the library version (LIBRARY_VER).
There is no default value for these parameters. Each library is associated with a processor
instance specified using the PROCESSOR_INSTANCE parameter. The library directory
contains C source and header files and a make file for the library.
The MLD file for each library specifies all configurable options for the libraries and each
MLD file has a corresponding Tcl file.
You can write your own libraries. These libraries must be in a specific directory under
<YOUR_PROJECT>/sw_services or <library_name>/sw_services as shown in
Figure 8-1 on page 97.
The LIBRARY_NAME attribute allows you to specify any name for your libraries, which
is also the name of the library directory.
The source files and make file for the library must be in the /src subdirectory under
the /<library_name> directory.
The make file must have the targets /include and /libs.
Each library must also contain an MLD file and a Tcl file in the /data subdirectory.
Refer to the existing EDK libraries for more information about the structure of the libraries.
Refer to the Microprocessor Library Definition (MLD) chapter in the Platform
Specification Format Reference Manual for details on how to write an MLD and its
corresponding Tcl file. A link to the document is supplied in the Additional Resources,
page 96.
OS Block
The MSS file includes an OS block for each processor instance. The OS block contains a
reference to the OS name (OS_NAME parameter), and the OS version (OS_VER). There is no
default value for these parameters. The bsp directory contains C source and header files
and a make file for the OS.
The MLD file for each OS specifies all configurable options for the OS. Each MLD file has
a corresponding Tcl file associated with it. Refer to the Microprocessor Library Definition
(MLD) and Microprocessor Software Specification (MSS) chapters in the Platform
Specification Format Reference Manual. A link to the document is supplied in the Additional
Resources, page 96.
You can write your own OSs. These OSs must be in a specific directory under
<YOUR_PROJECT>/bsp or <library_name>/bsp as shown in Figure 8-1 on page 97.
The OS_NAME attribute allows you to specify any name for your OS, which is also the
name of the OS directory.
The source files and make file for the OS must be in the src subdirectory under the
/<os_name> directory.
The make file should have the targets /include and /libs.
Each OS must contain an MLD file and a Tcl file in the /data subdirectory.
Look at the existing EDK OSs to understand the structures. Refer to the Microprocessor
Library Definition (MLD) chapter in the Platform Specification Format Reference Manual for
details on how to write an MLD and its corresponding Tcl file. A link to the document is
supplied in the Additional Resources, page 96.
Chapter 9
Overview
EDK includes the GNU compiler collection (GCC) for both the PowerPC (405 and 440)
processors and the MicroBlaze processor.
The EDK GNU tools support both the C and C++ languages.
The MicroBlaze GNU tools include mb-gcc and mb-g++ compilers, mb-as assembler
and mb-ld linker.
The PowerPC processor tools include powerpc-eabi-gcc and powerpc-eabi-g++
compilers, powerpc-eabi-as assembler and the powerpc-eabi-ld linker.
The toolchains also include the C, Math, GCC, and C++ standard libraries.
The compiler also uses the common binary utilities (referred to as binutils), such as an
assembler, a linker, and object dump. The PowerPC and MicroBlaze compiler tools use the
GNU binutils based on GNU version 2.16 of the sources. The concepts, options, usage, and
exceptions to language and library support are described Appendix A, GNU Utilities.
Additional Resources
GNU Information
GCC Feature Reference:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc
Invoking the compiler for different languages:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Invoking-G_002b_002b.html#Invoking-
G_002b_002b
GCC online manual: http://www.gnu.org/manual/manual.html
Compiler Framework
PowerPC Information
IBM Book-E:
http://www.ibm.com
IBM PowerPC performance library: http://sourceforge.net/projects/ppcperflib
APU FPU documentation: http://www.xilinx.com/ise/embedded/edk_ip.htm
MicroBlaze Information
The MicroBlaze Processor Reference Guide:
http://www.xilinx.com/ise/embedded/edk_docs.htm
Compiler Framework
This section discusses the common features of both the MicroBlaze and PowerPC
processor compilers. The following figure displays the GNU tool flow.
cpp0
cc1 cc1plus
as
(mb-as or powerpc-eabi-as)
ld
Libraries
(mb-ld or powerpc-eabi-ld)
The GNU compiler is named mb-gcc for MicroBlaze and powerpc-eabi-gcc for
PowerPC. The GNU compiler is a wrapper that calls the following executables:
Pre-processor (cpp0)
This is the first pass invoked by the compiler. The pre-processor replaces all macros
with definitions as defined in the source and header files.
Machine and language specific compiler
This compiler works on the pre-processed code, which is the output of the first stage.
The language-specific compiler is one of the following:
- C Compiler (cc1)
The compiler responsible for most of the optimizations done on the input C code
and for generating assembly code.
- C++ Compiler (cc1plus)
The compiler responsible for most of the optimizations done on the input C++
code and for generating assembly code.
Assembler (mb-as for MicroBlaze and powerpc-eabi-as for PowerPC processors)
The assembly code has mnemonics in assembly language. The assembler converts
these to machine language. The assembler also resolves some of the labels generated
by the compiler. It creates an object file, which is passed on to the linker.
Linker (mb-ld for MicroBlaze and powerpc-eabi-ld for PowerPC processors)
Links all the object files generated by the assembler. If libraries are provided on the
command line, the linker resolves some of the undefined references in the code by
linking in some of the functions from the assembler.
Executable options are described in:
Commonly Used Compiler Options: Quick Reference, page 109
Linker Options, page 113
MicroBlaze Compiler Options: Quick Reference, page 119
MicroBlaze Linker Options, page 125
PowerPC Compiler Options: Quick Reference, page 134.
Note: From this point forward the references to GCC in this chapter refer to both the MicroBlaze
compiler, mb-gcc, and the PowerPC processor compiler, powerpc-eabi-gcc, and references to
G++ refer to both the MicroBlaze C++ compiler, mb-g++, and the PowerPC processor C++ compiler,
powerpc-eabi-g++.
Usage
To use the GNU compiler, type:
<Compiler_Name> options files...
where <Compiler_Name> is powerpc-eabi-gcc or mb-gcc. To compile C++ programs,
you can use either the powerpc-eabi-g++ or the mb-g++ command.
Input Files
The compilers take one or more of the following files as input:
C source files
C++ source files
Assembly files
Object files
Linker scripts
Note: These files are optional. If they are not specified, the default linker script embedded in the
linker (mb-ld or powerpc-eabi-ld) is used.
The default extensions for each of these types are listed in Table 9-1. In addition to the files
mentioned above, the compiler implicitly refers to the libraries files libc.a, libgcc.a,
libm.a, and libxil.a. The default location for these files is the EDK installation
directory. When using the G++ compiler, the libsupc++.a and libstdc++.a files are
also referenced. These are the C++ language support and C++ platform libraries,
respectively.
Output Files
The compiler generates the following files as output:
An ELF file. The default output file name is a.out on Solaris and a.exe on Windows.
Assembly file, if -save-temps or -S option is used.
Object file, if -save-temps or -c option is used.
Preprocessor output, .i or .ii file, if -save-temps option is used.
Libraries
Table 9-2 lists the libraries necessary for the powerpc_eabi_gcc and mb_gcc compilers, as
follows.
Libraries are linked in automatically by both compilers. If the standard libraries are
overridden, the search path for these libraries must be given to the compiler. The
libxil.a is modified by the Library Generator tool, Libgen, to add driver and library
routines.
Language Dialect
The GCC compiler recognizes both C and C++ dialects and generates code accordingly. By
GCC convention, it is possible to use either the GCC or the G++ compilers equivalently on
a source file. The compiler that you use and the extension of your source file determines
the dialect used on the input and output files.
When using the GCC compiler, the dialect of a program is always determined by the file
extension, as listed in Table 9-1, page 107. If a file extension shows that it is a C++ source
file, the language is set to C++. This means that if you have compile C code contained in a
CC file, even if you use the GCC compiler, it automatically mangles function names.
The primary difference between GCC and G++ is that G++ automatically sets the default
language dialect to C++ (irrespective of the file extension), and if linking, automatically
pulls in the C++ support libraries. This means that even if you compile C code in a .c file
with the G++ compiler, it will mangle names.
Name mangling is a concept unique to C++ and other languages that support overloading
of symbols. A function is said to be overloaded if the same function can perform different
actions based on the arguments passed in, and can return different return values. To
support this, C++ compilers encode the type of the function to be invoked in the function
name, avoiding multiple definitions of a function with the same name.
Be careful about name mangling if you decide to follow a mixed compilation mode, with
some source files containing C code and some others containing C++ code (or using GCC
for compiling certain files and G++ for compiling others). To prevent name mangling of a
C symbol, you can use the following construct in the symbol declaration.
#ifdef __cplusplus
extern C {
endif
int foo();
int morefoo();
#ifdef __cplusplus
}
endif
Make these declarations available in a header file and use them in all source files. This
causes the compiler to use the C dialect when compiling definitions or references to these
symbols.
Note: All the EDK drivers and libraries follow the conventions listed above in all the header files they
provide. You must include the necessary headers, as documented in each driver and library, when
you compile with G++. This ensures that the compiler recognizes library symbols as belonging to C
type.
When compiling with either variant of the compiler, to force a file to a particular dialect,
use the -x lang switch. Refer to the GCC manual on the GNU website for more
information on this switch. A link to the document is provided in the Additional
Resources on page 103.
When using the GCC compiler, libstdc++.a and libsupc++.a are not automatically
linked in. When compiling C++ programs, use the G++ variant of the compiler to make
sure all the required support libraries are linked in automatically. Adding -lstdc++ and
-lsupc++ to the GCC command are also possible options.
For more information about how to invoke the compiler for different languages, refer to
the GNU online documentation. A link to the documentation is provided in the
Additional Resources on page 103.
General Options
-E
Preprocess only; do not compile, assemble and link. The preprocessed output displays on
the standard out device.
-S
Compile only; do not assemble and link. Generates a .s file.
-c
Compile and Assemble only; do not link. Generates a .o file.
-g
This option adds DWARF2-based debugging information to the output file. The
debugging information is required by the GNU debugger, mb-gdb or powerpc-eabi-gdb.
The debugger provides debugging at the source and the assembly level. This option adds
debugging information only when the input is a C/C++ source file.
-gstabs
Use this option for adding STABS-based debugging information on assembly (.S) files and
assembly file symbols at the source level. This is an assembler option that is provided
directly to the GNU assembler, mb-as or powerpc-eabi-as. If an assembly file is
compiled using the compiler mb-gcc or powerpc-eabi-gcc, prefix the option with
-Wa,.
-On
The GNU compiler provides optimizations at different levels. The optimization levels in
the following table apply only to the C and C++ source files.
Note: Optimization levels 1 and above cause code re-arrangement. While debugging your code,
use of no optimization level is recommended. When an optimized program is debugged through gdb,
the displayed results might seem inconsistent.
-v
This option executes the compiler and all the tools underneath the compiler in verbose
mode. This option gives complete description of the options passed to all the tools. This
description is helpful in discovering the default options for each tool.
-save-temps
The GNU compiler provides a mechanism to save the intermediate files generated during
the compilation process. The compiler stores the following files:
- Preprocessor output input_file_name.i for C code and
input_file_name.ii for C++ code
- Compiler (cc1) output in assembly format input_file_name.s
- Assembler output in ELF format input_file_name.s
The compiler saves the default output of the entire compilation as a.out.
-o filename
The compiler stores the default output of the compilation process in an ELF file named
a.out. You can change the default name using -o output_file_name. The output file
is created in ELF format.
-Wp,option
-Wa,option
-Wl,option
The compiler, mb-gcc or powerpc-eabi-gcc, is a wrapper around other executables such as
the preprocessor, compiler (cc1), assembler, and the linker. You can run these components
of the compiler individually or through the top level compiler.
There are certain options that are required by tools, but might not be necessary for the top-
level compiler. To run these commands, use the options listed in the following table.
-help
Use this option with any GNU compiler to get more information about the available
options.
You can also consult the GCC manual. A link to the manual is supplied in the Additional
Resources on page 103.
-B directory
Add directory to the C run time library search paths.
-L directory
Add directory to library search path.
-I directory
Add directory to header search path.
-l library
Search library for undefined symbols.
Note: The compiler prefixes lib to the library name indicated in this command line switch.
-L Lib Directory
This option indicates the directories in which to search for the libraries. The compiler has a
default library search path, where it looks for the standard library. Using the -L option,
you can include some additional directories in the compiler search path.
Linker Options
Linker options are as follows:
-defsym _STACK_SIZE=value
The total memory allocated for the stack can be modified using this linker option. The
variable _STACK_SIZE is the total space allocated for the stack. The _STACK_SIZE variable
is given the default value of 100 words, or 400 bytes. If your program is expected to need
more than 400 bytes for stack and heap combined, it is recommended that you increase the
value of _STACK_SIZE using this option. The value is in bytes.
In certain cases, a program might need a bigger stack. If the stack size required by the
program is greater than the stack size available, the program tries to write in other,
incorrect, sections of the program, leading to incorrect execution of the code.
Note: A minimum stack size of 16 bytes (0x0010) is required for programs linked with the Xilinx-
provided C runtime (CRT) files.
-defsym _HEAP_SIZE=value
The total memory allocated for the heap can be controlled by the value given to the
variable _HEAP_SIZE. The default value of _HEAP_SIZE is zero.
Dynamic memory allocation routines use the heap. If your program uses the heap in this
fashion, then you must provide a reasonable value for _HEAP_SIZE.
For advanced users: you can generate linker scripts directly from XPS.
Memory Layout
The MicroBlaze and PowerPC processors use 32-bit logical addresses and can address any
memory in the system in the range 0x0 to 0xFFFFFFFF. This address range can be
categorized into reserved memory and I/O memory.
Reserved Memory
Reserved memory has been defined by the hardware and software programming
environment for privileged use. This is typically true for memory containing interrupt
vector locations and operating system level routines. Table 9-5 lists the reserved memory
locations for MicroBlaze and PowerPC processors as defined by the processor hardware.
For more information on these memory locations, refer to the corresponding processor
reference manuals.
Note: In addition to these memories that are reserved for hardware use, your software environment
can reserve other memories. Refer to the manual of the particular software platform that you are
using to find out if any memory locations are deemed reserved.
I/O Memory
I/O memory refers to addresses used by your program to communicate with memory-
mapped peripherals on the processor buses. These addresses are defined as a part of your
hardware platform specification.
No restrictions apply to how you can partition your executable. The partitioning can be
done at the output section level, or even at the individual function and data level. The
resulting ELF can be non-contiguous, that is, there can be holes in the memory map.
Ensure that you do not use documented reserved locations.
Alternatively, if you are an advanced user and want to modify the default binary data
provided by the tools for the reserved memory locations, you can do so. In this case, you
must replace the default startup files and the memory mappings provided by the linker.
Object-File Sections
An executable file is created by concatenating input sections from the object files (.o files)
being linked together. The compiler, by default, creates code across standard and well-
defined sections. Each section is named based on its associated meaning and purpose. The
various standard sections of the object file are displayed in the following figure.
In addition to these sections, you can also create your own custom sections and assign
them to memories of your choice.
X-Ref Target - Figure 9-2
X11005
The reserved sections that you would not typically modify include:.init, .fini, .ctors,
.dtors, .got,.got2, and .eh_frame.
.text
This section of the object file contains executable program instructions. This section has the
x (executable), r (read-only) and i (initialized) flags. This means that this section can be
assigned to an initialized read-only memory (ROM) that is addressable from the processor
instruction bus.
.rodata
This section contains read-only data. This section has the r (read-only) and the i
(initialized) flags. Like the .text section, this section can also be assigned to an initialized,
read-only memory that is addressable from the processor data bus.
.sdata2
This section is similar to the .rodata section. It contains small read-only data of size less
than 8 bytes. All data in this section is accessed with reference to the read-only small data
anchor. This ensures that all the contents of this section are accessed using a single
instruction. You can change the size of the data going into this section with the -G option
to the compiler. This section has the r (read-only) and the i (initialized) flags.
.data
This section contains read-write data and has the w (read-write) and the i (initialized)
flags. It must be mapped to initialized random access memory (RAM). It cannot be
mapped to a ROM.
.sdata
This section contains small read-write data of a size less than 8 bytes. You can change the
size of the data going into this section with the -G option. All data in this section is accessed
with reference to the read-write small data anchor. This ensures that all contents of the
section can be accessed using a single instruction. This section has the w (read-write) and
the i (initialized) flags and must be mapped to initialized RAM.
.sbss2
This section contains small, read-only un-initialized data of a size less than 8 bytes. You can
change the size of the data going into this section with the -G option. This section has the r
(read) flag and can be mapped to ROM.
.sbss
This section contains small un-initialized data of a size less than 8 bytes. You can change
the size of the data going into this section with the -G option. This section has the w (read-
write) flag and must be mapped to RAM.
.bss
This section contains un-initialized data. This section has the w (read-write) flag and must
be mapped to RAM.
.heap
This section contains uninitialized data that is used as the global program heap. Dynamic
memory allocation routines allocate memory from this section. This section must be
mapped to RAM.
.stack
This section contains uninitialized data that is used as the program stack. This section must
be mapped to RAM. This section is typically laid out right after the .heap section. In some
versions of the linker, the .stack and .heap sections might appear merged together into
a section named .bss_stack.
.init
This section contains language initialization code and has the same flags as .text. It must
be mapped to initialized ROM.
.fini
This section contains language cleanup code and has the same flags as .text. It must be
mapped to initialized ROM.
.ctors
This section contains a list of functions that must be invoked at program startup and the
same flags as .data and must be mapped to initialized RAM.
.dtors
This section contains a list of functions that must be invoked at program end, the same
flags as .data, and it must be mapped to initialized RAM.
.got2/.got
This section contains pointers to program data, the same flags as .data, and it must be
mapped to initialized RAM.
.eh_frame
This section contains frame unwind information for exception handling. It contains the
same flags as .rodata, and can be mapped to initialized ROM.
.tbss
This section holds uninitialized thread-local data that contribute to the program memory
image. This section has the same flags as .bss, and it must be mapped to RAM.
.tdata
This section holds initialized thread-local data that contribute to the program memory
image. This section must be mapped to initialized RAM.
.gcc_except_table
This section holds language specific data. This section must be mapped to initialized RAM.
.jcr
This section contains information necessary for registering compiled Java classes. The
contents are compiler-specific and used by compiler initialization functions. This section
must be mapped to initialized RAM.
.fixup
This section contains information necessary for doing fixup, such as the fixup page table,
and the fixup record table. This section must be mapped to initialized RAM.
Linker Scripts
The linker utility uses commands specified in linker scripts to divide your program on
different blocks of memories. It describes the mapping between all of the sections in all of
the input object files to output sections in the executable file. The output sections are
mapped to memories in the system. You do not need a linker script if you do not want to
change the default contiguous assignment of program contents to memory. There is a
default linker script provided with the linker that places section contents contiguously.
You can selectively modify only the starting address of your program by defining the
linker symbol _TEXT_START_ADDR on MicroBlaze processors, or _START_ADDR on
PowerPC processors, as displayed in this example:
mb-gcc <input files and flags> -Wl,-defsym -Wl,_TEXT_START_ADDR=0x100
MicroBlaze Compiler
The mb-gcc compiler for the Xilinx MicroBlaze soft processor introduces new options as
well as modifications to certain options supported by the GNU compiler tools. The new
and modified options are summarized in this chapter.
-mno-xl-soft-mul
This option permits use of hardware multiply instructions for 32-bit multiplications.
The MicroBlaze processor has an option to turn the use of hardware multiplier resources
on or off. This option should be used when the hardware multiplier option is enabled on
MicroBlaze. Using the hardware multiplier can improve the performance of your
application. The compiler automatically defines the C pre-processor definition
HAVE_HW_MUL when this switch is used. This allows you to write C or assembly code
tailored to the hardware, based on whether this feature is specified as available or not.
Refer to the MicroBlaze Processor Reference Guide for more details about the usage of the
multiplier option in MicroBlaze. A link to the document is provided in the Additional
Resources, page 103.
-mxl-multiply-high
MicroBlaze has an option to enable instructions that can compute the higher 32-bits of a
32x32-bit multiplication. This option tells the compiler to use these multiply high
instructions. The compiler automatically defines the C pre-processor definition
HAVE_HW_MUL_HIGH when this switch is used. This allows you to write C or assembly code
tailored to the hardware, based on whether this feature is available or not. Refer to the
MicroBlaze Processor Reference Guide for more details about the usage of the multiply high
instructions in MicroBlaze. A link to the document is provided in the Additional
Resources, page 103.
-mno-xl-multiply-high
Do not use multiply high instructions. This option is the default.
-mxl-soft-mul
This option tells the compiler that there is no hardware multiplier unit on MicroBlaze, so
every 32-bit multiply operation is replaced by a call to the software emulation
routine__mulsi3. This option is the default.
-mno-xl-soft-div
You can instantiate a hardware divide unit in MicroBlaze. When the divide unit is present,
this option tells the compiler that hardware divide instructions can be used in the program
being compiled.
This option can improve the performance of your program if it has a significant amount of
division operations. The compiler automatically defines the C pre-processor definition
HAVE_HW_DIV when this switch is used. This allows you to write C or assembly code
tailored to the hardware, based on whether this feature is specified as available or not.
Refer to the MicroBlaze Processor Reference Guide for more details about the usage of the
hardware divide option in MicroBlaze. A link to the document is provided in the
Additional Resources section of this chapter.
-mxl-soft-div
This option tells the compiler that there is no hardware divide unit on the target
MicroBlaze hardware.
This option is the default. The compiler replaces all 32-bit divisions with a call to the
corresponding software emulation routines (__divsi3, __udivsi3).
-mxl-barrel-shift
The MicroBlaze processor can be configured to be built with a barrel shifter. In order to use
the barrel shift feature of the processor, use the option -mxl-barrel-shift.
The default option assumes that no barrel shifter is present, and the compiler uses add and
multiply operations to shift the operands. Enabling barrel shifts can speed up your
application significantly, especially while using a floating point library. The compiler
automatically defines the C pre-processor definition HAVE_HW_BSHIFT when this switch is
used. This allows you to write C or assembly code tailored to the hardware, based on
whether or not this feature is specified as available. Refer to the MicroBlaze Processor
Reference Guide for more details about the use of the barrel shifter option in MicroBlaze. A
link to the document is provided in the Additional Resources, page 103.
-mno-xl-barrel-shift
This option tells the compiler not to use hardware barrel shift instructions. This option is
the default.
-mxl-pattern-compare
This option activates the use of pattern compare instructions in the compiler.
Using pattern compare instructions can speed up boolean operations in your program.
Pattern compare operations also permit operating on word-length data as opposed to byte-
length data on string manipulation routines such as strcpy, strlen, and strcmp. On a
program heavily dependent on string manipulation routines, the speed increase obtained
will be significant. The compiler automatically defines the C pre-processor definition
HAVE_HW_PCMP when this switch is used. This allows you to write C or assembly code
tailored to the hardware, based on whether this feature is specified as available or not.
Refer to the MicroBlaze Processor Reference Guide for more details about the use of the
pattern compare option in MicroBlaze. A link to the document is provided in the
Additional Resources, page 103.
-mno-xl-pattern-compare
This option tells the compiler not to use pattern compare instructions. This option is the
default.
-mhard-float
This option turns on the usage of single precision floating point instructions (fadd, frsub,
fmul, and fdiv) in the compiler.
It also uses fcmp.p instructions, where p is a predicate condition such as le, ge, lt, gt, eq,
ne. These instructions are natively decoded and executed by MicroBlaze, when the FPU is
enabled in hardware. The compiler automatically defines the C pre-processor definition
HAVE_HW_FPU when this switch is used. This allows you to write C or assembly code
tailored to the hardware, based on whether this feature is specified as available or not.
Refer to the MicroBlaze Processor Reference Guide for more details about the use of the
hardware floating point unit option in MicroBlaze. A link to the document is provided in
the Additional Resources, page 103.
-msoft-float
This option tells the compiler to use software emulation for floating point arithmetic. This
option is the default.
-mxl-float-convert
This option turns on the usage of single precision floating point conversion instructions
(fint and flt) in the compiler. These instructions are natively decoded and executed by
MicroBlaze, when the FPU is enabled in hardware and these optional instructions are
enabled.
Refer to the MicroBlaze Processor Reference Guide for more details about the use of the
hardware floating point unit option in MicroBlaze. A link to the document is provided in
the Additional Resources, page 103.
-mxl-float-sqrt
This option turns on the usage of single precision floating point square root instructions
(fsqrt) in the compiler. These instructions are natively decoded and executed by
MicroBlaze, when the FPU is enabled in hardware and these optional instructions are
enabled.
Refer to the MicroBlaze Processor Reference Guide for more details about the use of the
hardware floating point unit option in MicroBlaze. A link to the document is provided in
the Additional Resources, page 103.
-mno-clearbss
This option is useful for compiling programs used in simulation.
According to the C language standard, uninitialized global variables are allocated in the
.bss section and are guaranteed to have the value 0 when the program starts execution.
Typically, this is achieved by the C startup files running a loop to fill the .bss section with
zero when the program starts execution. Optimizing compilers also allocates global
variables that are assigned zero in C code to the .bss section.
In a simulation environment, the above two language features can be unwanted overhead.
Some simulators automatically zero the entire memory. Even in a normal environment,
you can write C code that does not rely on global variables being zero initially. This switch
is useful for these scenarios. It causes the C startup files to not initialize the .bss section
with zeroes. It also internally forces the compiler to not allocate zero-initialized global
variables in the .bss and instead move them to the .data section. This option might
improve startup times for your application. Use this option with care and ensure either
that you do not use code that relies on global variables being initialized to zero, or that
your simulation platform performs the zeroing of memory.
-mxl-stack-check
With this option, you can check whether the stack overflows when the program runs.
The compiler inserts code in the prologue of the every function, comparing the stack
pointer value with the available memory. If the stack pointer exceeds the available free
memory, the program jumps to a the subroutine _stack_overflow_exit. This
subroutine sets the value of the variable _stack_overflow_error to 1.
You can override the standard stack overflow handler by providing the function
_stack_overflow_exit in the source code, which acts as the stack overflow handler.
-xl-mode-bootstrap
This option is used for applications that are loaded using a bootloader. Typically, the bootloader
resides in non-volatile memory mapped to the processor reset vector. If a normal executable is
loaded by this bootloader, the application reset vector overwrites the reset vector of the
bootloader. In such a scenario, on a processor reset, the bootloader does not execute first (it is
typically required to do so) to reload this application and do other initialization as necessary.
To prevent this, you must compile the bootloaded application with this compiler flag. On a
processor reset, control then reaches the bootloader instead of the application.
Using this switch on an application that is deployed in a scenario different from the one
described above will not work. This mode uses crt2.o as a startup file.
-xl-mode-novectors
This option is used for applications that do not require any of the MicroBlaze vectors. This
is typically used in standalone applications that do not use any of the processors reset,
interrupt, or exception features. Using this switch leads to smaller code size due to the
elimination of the instructions for the vectors. This mode uses crt3.o as a startup file.
Caution! Do not use more than one mode of execution on the command line. You will receive
link errors due to multiple definition of symbols if you do so.
MicroBlaze Assembler
The mb-as assembler for the Xilinx MicroBlaze soft processor supports the same set of
options supported by the standard GNU compiler tools. It also supports the same set of
assembler directives supported by the standard GNU assembler.
The mb-as assembler supports all the opcodes in the MicroBlaze machine instruction set,
with the exception of the imm instruction. The mb-as assembler generates imm instructions
when large immediate values are used. The assembly language programmer is never
required to write code with imm instructions. For more information on the MicroBlaze
instruction set, refer to the MicroBlaze Processor Reference Guide. A link to the document is
provided in the Additional Resources on page 103.
The mb-as assembler requires all MicroBlaze instructions with an immediate operand to be
specified as a constant or a label. If the instruction requires a PC-relative operand, then the
mb-as assembler computes it and includes an imm instruction if necessary.
For example, the Branch Immediate if Equal (beqi) instruction requires a PC-relative
operand.
The assembly programmer should use this instruction as follows:
beqi r3, mytargetlabel
where mytargetlabel is the label of the target instruction. The mb-as assembler
computes the immediate value of the instruction as mytargetlabel - PC.
If this immediate value is greater than 16 bits, the mb-as assembler automatically inserts
an imm instruction. If the value of mytargetlabel is not known at the time of compilation,
the mb-as assembler always inserts an imm instruction. Use the relax option of the linker
remove any unnecessary imm instructions.
Similarly, if an instruction needs a large constant as an operand, the assembly language
programmer should use the operand as is, without using an imm instruction. For example,
the following code adds the constant 200,000 to the contents of register r3, and stores the
results in register r4:
addi r4, r3, 200000
The mb-as assembler recognizes that this operand needs an imm instruction, and inserts
one automatically.
In addition to the standard MicroBlaze instruction set, the mb-as assembler also supports
some pseudo-op codes to ease the task of assembly programming. The following table lists
the supported pseudo-opcodes.
-relax
This is a linker option that removes all unwanted imm instructions generated by the
assembler. The assembler generates an imm instruction for every instruction where the
value of the immediate cannot be calculated during the assembler phase.
Most of these instructions do not need an imm instruction. These are removed by the linker
when the -relax command line option is provided.
This option is required only when linker is invoked on its own. When linker is invoked
through the mb-gcc compiler, this option is automatically provided to the linker.
-N
This option sets the text and data section as readable and writable. It also does not page-
align the data segment. This option is required only for MicroBlaze programs. The top-
level GCC compiler automatically includes this option, while invoking the linker, but if
you intend to invoke the linker without using GCC, use this option.
For more details on this option, refer to the GNU manuals online. A link to the manuals is
provided in the Additional Resources, page 103.
The MicroBlaze linker uses linker scripts to assign sections to memory. These are listed in
the following section.
Startup Files
The compiler includes pre-compiled startup and end files in the final link command when
forming an executable. Startup files set up the language and the platform environment
before your application code executes. The following actions are typically performed by
startup files:
Set up any reset, interrupt, and exception vectors as required.
Set up stack pointer, small-data anchors, and other registers. Refer to Table 9-8,
page 128 for details.
Clear the BSS memory regions to zero.
Invoke language initialization functions, such as C++ constructors.
Initialize the hardware sub-system. For example, if the program is to be profiled,
initialize the profiling timers.
Set up arguments for the main procedure and invoke it.
Similarly, end files are used to include code that must execute after your program ends.
The following actions are typically performed by end files:
Invoke language cleanup functions, such as C++ destructors.
De-initialize the hardware sub-system. For example, if the program is being profiled,
clean up the profiling sub-system.
The following subsections describe the initialization files used for various application
modes. This information is for advanced users who want to change or understand the
startup code of their application. For MicroBlaze, there are two distinct stages of C runtime
initialization. The first stage is primarily responsible for setting up vectors, after which it
invokes the second stage initialization. It also provides exit stubs based on the different
application modes.
crt3.o
This initialization file is employed when the executable does not use any vectors and
wishes to reduce code size. It populates only the reset vector and transfers control to the
second stage _crtinit startup routine. On returning from _crtinit, it ends the program
by infinitely looping at the _exit label. Because the other vectors are not populated, the
GNU linking mechanism does not pull in any of the interrupt and exception handling
related routines, thus saving code space.
crtinit.o
This is the default second stage C startup file. This startup file performs the following
steps:
1. Clears the .bss section to zero.
2. Invokes _program_init.
3. Invokes constructor functions (_init).
4. Sets up the arguments for main and invokes main.
5. Invokes destructor functions (_fini).
6. Invokes _program_clean and returns.
pgcrtinit.o
This second stage startup file is used during profiling. This startup files performs the
following steps:
1. Clears the .bss section to zero.
2. Invokes _program_init.
3. Invokes _profile_init to initialize the profiling library.
4. Invokes constructor functions (_init).
5. Sets up the arguments for main and invokes main.
6. Invokes destructor functions (_fini).
7. Invokes _profile_clean to cleanup the profiling library.
8. Invokes _program_clean, and then returns.
sim-crtinit.o
This second-stage startup file is used when the -mno-clearbss switch is used in the
compiler. This startup file performs the following steps:
1. Invokes _program_init.
2. Invokes constructor functions (_init).
3. Sets up the arguments for main and invokes main.
4. Invokes destructor functions (_fini).
5. Invokes _program_clean, and then returns.
sim-pgcrtinit.o
This second stage startup file is used during profiling in conjunction with the -mno-clearbss
switch. This startup files performs the following steps in order:
1. Invokes _program_init.
2. Invokes _profile_init to initialize the profiling library.
3. Invokes constructor functions (_init).
4. Sets up the arguments for main and invokes main.
5. Invokes destructor functions (_fini).
6. Invokes _profile_clean to cleanup the profiling library.
7. Invokes _program_clean, and then returns.
Other files
The compiler also uses certain standard start and end files for C++ language support.
These are crti.o, crtbegin.o, crtend.o, and crtn.o. These files are standard compiler
files that provide the content for the .init, .fini, .ctors, and .dtors sections.
and
This avoids referencing the extra code usually pulled in for constructor and destructor
handling, reducing code size.
3. Compile these files into .o files and place them in a directory of your choice, or include
them as a part of your application sources.
4. Add the -nostartfiles switch to the compiler. Add the -B directory switch if
you have chosen to assemble the files in a particular folder.
5. Compile your application.
If your application is executing in a different mode, then you must pick the appropriate
CRT files based on the description in Startup Files, page 127.
Compiler Libraries
The mb-gcc compiler requires the GNU C standard library and the GNU math library.
Precompiled versions of these libraries are shipped with EDK. The CPU driver for
MicroBlaze copies over the correct version, based on the hardware configuration of
MicroBlaze, during the execution of Libgen. To manually select the library version that you
would like to use, look in the following folder:
$XILINX_EDK/gnu/microblaze/<platform>/microblaze-xilinx-elf/lib
The filenames are encoded based on the compiler flags and configurations used to compile
the library. For example, libc_m_bs.a is the C library compiled with hardware multiplier
and barrel shifter enabled in the compiler.
The following table shows the current encodings used and the configuration of the library
specified by the encodings.
Of special interest are the math library files (libm*.a). The C standard requires the
common math library functions (sin( )and cos( ), for example) to use double-precision
floating point arithmetic. However, double-precision floating point arithmetic may not be
able to make full use of the optional, single-precision floating point capabilities in available
for MicroBlaze.
The Newlib math libraries have alternate versions that implement these math functions
using single-precision arithmetic. These single-precision libraries might be able to make
direct use of the MicroBlaze hardware floating point unit and could therefore perform
better. If you are sure that your application does not require standard precision, and you
would like to implement enhanced performance, you can change the version of the linked-
in library manually. By default, the CPU driver copies the double-precision version
(libm_*_fpd.a) of the library into your XPS project. To get the single precision version,
you can create a custom CPU driver that copies the corresponding libm_*_fps.a library
instead. Simply copy the corresponding libm_*_fps.a file into your processor library
folder (such as microblaze_0/lib) as libm.a.
When you have copied the library that you want to use, rebuild your application software
project.
Thread Safety
The MicroBlaze C and math libraries distributed with EDK are not built to be used in a
multi-threaded environment. Common C library functions such as printf(), scanf(),
malloc(), and free() are not thread-safe and will cause unrecoverable errors in the
system at run-time. Use appropriate mutual exclusion mechanisms when using the EDK
libraries in a multi-threaded environment.
Interrupt Handlers
Interrupt handlers must be compiled in a different manner than normal sub-routine calls.
In addition to saving non-volatiles, interrupt handlers must save the volatile registers that
are being used. Interrupt handlers should also store the value of the machine status
register (RMSR) when an interrupt occurs.
interrupt_handler attribute
To distinguish an interrupt handler from a sub-routine, mb-gcc looks for an attribute
(interrupt_handler) in the declaration of the code. This attribute is defined as follows:
void function_name () __attribute__ ((interrupt_handler));
Note: The attribute for the interrupt handler is to be given only in the prototype and not in the
definition.
Interrupt handlers might also call other functions, which might use volatile registers. To
maintain the correct values in the volatile registers, the interrupt handler saves all the
volatiles, if the handler is a non-leaf function.
Note: Functions that have calls to other sub-routines are called non-leaf functions.
Interrupt handlers are defined in the MicroBlaze Hardware Specification (MHS) and the
MicroBlaze Software Specification (MSS) files. These definitions automatically add the
attributes to the interrupt handler functions. For more information, refer to Appendix B,
Interrupt Management.
The interrupt handler uses the instruction rtid for returning to the interrupted function.
save_volatiles attribute
The MicroBlaze compiler provides the attribute save_volatiles, which is similar to the
interrupt_handler attribute, but returns using rtsd instead of rtid.
This attribute saves all the volatiles for non-leaf functions and only the used volatiles in the
case of leaf functions.
void function_name () __attribute__((save_volatiles));
The following table lists the attributes with their functions.
-mcpu=440
Target code for the 440 processor. This includes instruction scheduling optimizations,
enable or disable instruction workarounds, and usage of libraries targeted for the 440
processor.
-mfpu={sp_lite, sp_full, dp_lite, dp_full, none}
Generate hardware floating point instructions to use with the Xilinx PowerPC processor
APU FPU coprocessor hardware. The instructions and code output follow the floating
point specification in the PowerPC Book-E, with some exceptions tailored to the APU FPU
hardware. Book-E is available from the IBM web page. Refer to the FPU hardware
documentation for more information on the architecture. Links to Book-E and to the FPU
documentation are available in the Additional Resources on page 103.
The option given to -mfpu= determines which variant of the FPU hardware to target. The
variants are as follows:
sp_lite
Produces code targeted to the Single precision Lite FPU coprocessor. This version
supports only single precision hardware floating point and does not use hardware
divide and square root instructions. The compiler automatically defines the C
preprocessor definition HAVE_XFPU_SP_LITE when this option is given.
sp_full
Produces code targeted to the Single precision Full FPU coprocessor. This version
supports only single precision hardware floating point and uses hardware divide and
square root instructions. The compiler automatically defines the C preprocessor
definition HAVE_XFPU_SP_FULL when this option is given.
dp_lite
Produces code targeted to the Double precision Lite FPU coprocessor. This version
supports both single and double precision hardware floating point and does not use
hardware divide and square root instructions. The compiler automatically defines the
C preprocessor definition, HAVE_XFPU_DP_LITE, when this option is given.
dp_full
Produces code targeted to the Double precision Full FPU coprocessor. This version
supports both single and double precision hardware floating point and uses hardware
divide and square root instructions. The compiler automatically defines the C
preprocessor definition, HAVE_XFPU_DP_FULL, when this option is given.
Caution! Do not link code compiled with one variant of the -mfpu switch with code compiled
with other variants (or without the -mfpu switch). You must use the switch even when you are
only linking object files together. This allows the compiler to use the correct set of libraries and
prevent incompatibilities.
none
This option tells the compiler to use software emulation for floating point arithmetic.
This option is the default.
Refer to the latest APU FPU user guide for detailed information on how to optimize
use of the hardware floating point co-processor. A link to the guide is provided in the
Additional Resources on page 103.
-mppcperflib
Use PowerPC processor performance libraries for low-level integer and floating
emulation, and some simple string routines. These libraries are used in the place of the
default emulation routines provided by GCC and simple string routines provided by
Newlib. The performance libraries show an average of three times increase in speed on
applications that heavily use these routines. The SourceForge project web page contains
more information and detailed documentation. A link to that page is provided in the
Additional Resources section of this chapter.
Caution! You cannot use the performance libraries in conjunction with the -mfpu switch. They
are incompatible.
-mno-clearbss
This option is useful for compiling programs used in simulation. According to the C
language standard, uninitialized global variables are allocated in the .bss section and are
guaranteed to have the value 0 when the program starts execution. Typically, this is
achieved by the C startup files running a loop to fill the .bss section with zero when the
program starts execution. Additionally optimizing compilers will also allocate global
variables that are assigned zero in C code to the .bss section.
In a simulation environment, the two language features above can be unwanted overhead.
Some simulators automatically zero the whole memory. Even in a normal environment,
you can write C code that does not rely on global variables being zero initially. This switch
is useful for these scenarios. It causes the C startup files to not initialize the .bss section
with zeroes. It also internally forces the compiler not to allocate zero-initialized global
variables in the .bss and instead move them to the .data section. This option may
improve startup times for your application. Use this option with care. Do not use code that
relies on global variables being initialized to zero, or ensure that your simulation platform
performs the zeroing of memory.
Startup Files
When the compiler forms an executable, it includes pre-compiled startup and end files in
the final link command. Startup files set up the language and the platform environment
before your application code can execute. The following actions are typically performed by
startup files:
Set up any reset, interrupt, and exception vectors as required.
Set up stack pointer, small-data anchors, and other registers as required.
Clear the BSS memory regions to zero.
Invoke language initialization functions such as C++ constructors.
Initialize the hardware sub-system. For example, if the program is to be profiled,
initialize the profiling timers.
Set up arguments for and invoke the main procedure.
End files are used to include code that must execute after your program is finished. The
following actions are typically performed by end files:
Invoke language cleanup functions, such as C++ destructors.
Clean up the hardware subsystem. For example, if the program is being profiled,
clean up the profiling subsystem.
The following subsection describes the initialization files. This information is for advanced
users who want to change or understand the startup code of their application.
xil-sim-crt0.o
This initialization file is used when the application is compiled with the -mno-clearbss
switch. It performs all the common CRT setup actions, except that it does not clear the
.bss section to zero.
xil-sim-pgcrt0.o
This initialization file is used when the application is compiled with the -mno-clearbss
switch. It performs all the common CRT setup actions, except that it does not clear the
.bss section to zero. It also invokes the _profile_init routine before invoking main.
This initializes the software profiling library before your code executes. Similarly, upon
exit from main, it invokes the _profile_clean routine, which cleans up the profiling
library.
Other files
The compiler also uses standard start and end files for C++ language support: ecrti.o,
crtbegin.o, crtend.o, and crtn.o. These files are standard compiler files that provide
the content for the .init, .fini, .ctors, and .dtors sections. The PowerPC default and
generated linker scripts also make boot.o a startup file. This file is present in the
standalone package for PowerPC (405 and 440) processors.
Compiler Libraries
The powerpc-eabi-gcc compiler requires the GNU C standard library and the GNU
math library.
Precompiled versions of these libraries are shipped with EDK. These libraries are located
in $XILINX_EDK/gnu/powerpc-eabi/platform/powerpc-eabi/lib.
Various subdirectories under this top level library directory contain customized versions
of the libraries for a particular configuration. For instance, the /double directory contains
the version of libraries for use with a double precision FPU, whereas the /440 subdirectory
contains the version of libraries suited for use with PowerPC 440 processor.
Thread Safety
The C and math libraries for the PowerPC processor distributed with EDK are not built to
be used in a multi-threaded environment. Common C library functions such as printf(),
scanf(), malloc(), and free() are not thread-safe and will cause unrecoverable errors
in the system at run-time. Use appropriate mutual exclusion mechanisms when using the
EDK libraries in a multi-threaded environment.
Other Notes
Other Notes
C++ Code Size
The GCC toolchain combined with the latest open source C++ standard library
(libstdc++-v3) might be found to generate large code and data fragments as compared
to an equivalent C program. A significant portion of this overhead comes from code and
data for exception handling and runtime type information. Some C++ applications do not
require these features.
To remove the overhead and optimize for size, use the -fno-exceptions and/or the
-fno-rtti switches. This is recommended only for advanced users who know the
requirements of their application and understand these language features. Refer to the
GCC manual for more specific information on available compiler options and their impact.
C++ programs might have more intensive dynamic memory requirements (stack and heap
size) due to more complex language features and library routines.
Many of the C++ library routines can request memory to be allocated from the heap.
Review your heap and stack size requirements for C++ programs to ensure that they are
satisfied.
Chapter 10
Additional Resources
GDB and Platform Studio SDK Manual debugger/TCL Scripts External debugger
GDB Remote Protocol Interface XMD Tcl Interface XMD Socket Interface
UG111_13_01_091905
Hardware on board
Additional Resources
You can find all of the EDK documentation in your EDK installation, in
<install_directory>\doc\usenglish. They are also available online at
http://www.xilinx.com/ise/embedded/edk_docs.htm
The following documents provide additional information to the content in this chapter:
PowerPC 405 Processor Reference Manual
PowerPC 440 Processor Reference Manual
MicroBlaze Processor Reference Guide
IBM PowerPC ISS Reference Guide:
XMD Usage
xmd [-h] [-help] [-hw <hardware_specification_file>] [-ipcport
<portnum>][-nx] [-opt <optfile>][-v] [-xmp <xmpfile>]
[-tcl <tcl_file_args>]
XMD Console
XMD Console
The XMD console is a standard Tcl console, where you can run any available Tcl
commands. Additionally, the XMD console provides command editing convenience, such
as file and command name auto-fill and command history.
The available Tcl commands on which you can use auto-fill are defined in the
<EDK_Install_Area>/data/xmd/cmdlist file. The command history is stored in
$HOME/.xmdcmdhistory. To use different files for available command names and
command history, you can use environment variables $XILINX_XMD_CMD_LIST and
$XILINX_XMD_CMD_HISTORY to overwrite the defaults.
bpl rst
bpr rwr
bps run
con safemode
connect state
cstp srrd
data_verify stackcheck
debugconfig state
dis stats
disconnect stop
dow stp
elf_verify targets
fpga -f terminal
<bitstream>
mrd tracestart
mwr tracestop
profile watch
read_uart verbose
rrd xload
debugconfig debugconfig - Configures the debug session for the target. For
debugconfig -step_mode step_mode additional information, refer to Configure
{disable_interrupt | enable_interrupt Debug Session on page 181.
enable_interrupt} debugconfig -
debugconfig - memory_datawidth_mat
memory_datawidth_matching ching enable
{disable | enable}
debugconfig -reset_on_run
<options>
dow -data <binary_filename> dow -data system.dat If an address is provided with the ELF file (on
<load_address> 0x400 MicroBlaze targets only), it is treated as Position
Independent Code (PIC code) and downloaded
at the specified address.
Also, the R20 Register is set to the start address
according to the PIC code semantics.
When an ELF file is downloaded, the command
does a reset, stops the processor at the reset
location by using breakpoints, and loads the ELF
program to the memory. The reset is done to
ensure the system is in a known good state.
The reset behavior can be configured using
debugconfig -reset_on_run
system enable | processor {enable |
disable}.
Refer to the Configure Debug Session on page
181
elf_verify elf_verify Verify if the executable.elf is downloaded
elf_verify [<filename.elf>] executable.elf correctly to the target. If ELF file is not specified,
it uses the most recent ELF file downloaded on
the target.
fpga -f <bitstream> fpga -f download.bit Loads the FPGA device bitstream. Optionally
[-cable <cable_options>]| fpga -f download.bit specify the cable, JTAG configuration, and
[-configdevice -cable type debug device options.
<configuration_options>] | xilinx_parallel For additional information, refer to Connect
[-debugdevice <device_name> ] Command Options on page 159.
state -system <system_id> state -system When a <target_id> is specified, state of that
<system_id> target is displayed.
When -system <system_id> is specified the
current state of all the targets in the system is
displayed.
stats stats trace.txt Displays execution statistics for the ISS target.
stats [<filename>] stats The <filename> is the trace output from trace
collection.
For additional information, descriptions, and usage of MicroBlaze special register names,
refer to the Special Purpose Registers section of the MicroBlaze Architecture chapter in
the MicroBlaze Processor Reference Guide. A link to the document is supplied in the
Additional Resources on page 144.
Note: When MicroBlaze is debugged in XMDSTUB mode, only PC and MSR registers are accessible.
Note: XMD always uses 64-bit notation to represent the Floating Point Registers (f0-f31). In the
case of a Single Precision floating point unit, the 32-bit Single Precision value is extended to a 64-bit
value.
For additional information about PowerPC 405 processor special register names, refer to
the PowerPC 405 Processor Block Reference Guide. A link to the document is supplied in the
Additional Resources section.
Note: XMD always uses 64-bit notation to represent the Floating Point Registers (f0-f31). In the
case of a Single Precision floating point unit, the 32-bit Single Precision value is extended to a 64-bit
value.
For additional information about PowerPC440 processor special register names, refer to
the Register Set Summary section of the PowerPC 440 Processor Block Reference Guide.
A link to the document is supplied in the Additional Resources, page 144.
MicroBlaze
1. Set a hardware breakpoint at reset location (0x0).
2. Issue reset signal (system reset or processor reset).
The processor starts running.
3. After processor is stopped at reset location, remove the breakpoint.
Debugging a Program
To debug a program:
1. Connect to the processor.
2. Download the ELF file.
3. Set the required breakpoints and watchpoints.
4. Start the processor execution using the con command or step through the program
using the stp command.
5. Use the state command to check the processor status.
6. Use stop command to stop the processor if needed.
7. When the processor is stopped, read and write registers and memory.
8. To re-run the program, use the run command.
Usage
connect {mb | ppc | mdm} <Connection_Type> [Options]
Usage
connect ppc hw [-cable <JTAG Cable options>] {[-configdevice <JTAG chain
options>]} [-debugdevice <PowerPC options>]
Debug connection using I/O pins connected to the JTAG port of the PowerPC
Processor
If the JTAG ports of the PowerPC processors are brought out of the FPGA using I/O pins,
then XMD can directly connect to the PowerPC processor for debugging. In this mode
XMD can only communicate with one PowerPC processor. If there are two PowerPC
processors in your system, you cannot chain them, and the JTAG ports to each processor
should be brought out to use FPGA I/O pins. Refer to the PowerPC 405 Processor Block
Reference Guide and the PowerPC 440 Processor Block Reference Guide for more information
about this debug setup. A link to the document is supplied in the Additional Resources
on page 144.
The following figure illustrates the PowerPC processor target.
X-Ref Target - Figure 10-2
XMD
JTAG
FPGA
JTAG PPC
PowerPC PowerPC
UG111_13_02_072407
XMD
TCP/IP Socket
Connection
PowerPC
Cycle_Accurate ISS405.icf
ISS
X10885
Usage:
connect ppc sim [-icf <Configuration File>] [-ipcport IP:<port>]
RUNNING>
TLB Access
Each TLB entry is represented by a 4-word entry. The following table shows the 4-word
entries available for PPC405 and PPC440.
The total 64 TLB entries can be read from (or written to) the 256 words starting from the
TLB starting address.
XMD
JTAG
Multiple MicroBlaze
UART MDM Processors
MicroBlaze MicroBlaze
X10843
When no option is specified to the connect mb mdm, XMD detects the JTAG cable
automatically and chains the FPGA device containing the MicroBlaze-MDM system.
If XMD is unable to detect the JTAG chain or the FPGA device automatically, you can
explicitly specify them using the following options:
Usage:
connect mb hw [-cable <JTAG Cable options>] {[-configdevice <JTAG
chain options>]} [-debugdevice <MicroBlaze options>]
MicroBlaze Options
The following table describes MicroBlaze options.
BREAKPOINT at
114: F1440003 sbi r10, r4, 3
XMD% dis 0x114 10
114: F1440003 sbi r10, r4, 3
118: E0E30004 lbui r7, r3, 4
11C: E1030005 lbui r8, r3, 5
120: F0E40004 sbi r7, r4, 4
124: F1040005 sbi r8, r4, 5
128: B800FFCC bri -52
12C: B6110000 rtsd r17, 0
130: 80000000 Or r0, r0, r0
134: B62E0000 rtid r14, 0
138: 80000000 Or r0, r0, r0
XMD% dow microblaze_0/code/executable.elf
XMD% con
Info:Processor started. Type stop to stop processor
RUNNING> stop
XMD% Info:User Interrupt, Processor Stopped at 0x0000010c
XMD% con
Info:Processor started. Type stop to stop processor
RUNNING> rrd pc
pc : 0x000000f4 <--- With the MDM, the current PC of MicroBlaze can be
read while the program is running
RUNNING> rrd pc
pc : 0x00000110 <--- Note: the PC is constantly changing, as the
program is running
RUNNING> stop
Info:Processor started. Type stop to stop processor
XMD% rrd
r0: 00000000 r8: 00000065 r16: 00000000 r24: 00000000
r1: 00000548 r9: 0000006c r17: 00000000 r25: 00000000
r2: 00000190 r10: 0000006c r18: 00000000 r26: 00000000
r3: 0000014c r11: 00000000 r19: 00000000 r27: 00000000
r4: 00000500 r12: 00000000 r20: 00000000 r28: 00000000
r5: 24242424 r13: 00000190 r21: 00000000 r29: 00000000
r6: 0000c204 r14: 00000000 r22: 00000000 r30: 00000000
r7: 00000068 r15: 0000005c r23: 00000000 r31: 00000000
pc: 0000010c msr: 00000000
XMD% bps 0x100
Setting breakpoint at 0x00000100
XMD% bps 0x11c hw
Setting breakpoint at 0x0000011c
XMD% bpl
SW BP: addr = 0x00000100, instr = 0xe1230002 <-- Software Breakpoint
HW BP: BP_ID 0 : addr = 0x0000011c <--- Hardware Breakpoint
XMD% con
Info:Processor started. Type stop to stop processor
RUNNING>
Processor stopped at PC: 0x00000100
Info:Processor stopped. Type start to start processor
XMD% con
Info:Processor started. Type stop to stop processor
RUNNING>
Info:Processor started. Type stop to stop processor
MicroBlaze Option
Note: If the program has any I/O functions such as print() or putnum() that write output onto
the UART or MDM UART, it is printed on the console or terminal in which XMD was started. Refer to
Chapter 8, Library Generator (Libgen), for more information about libraries and I/O functions.
XMD
Uartlite
OPB/PLBv46 Bus
Local Memory
MicroBlaze xmdstub
XMD
JTAG
UART MDM
OPB/PLBv46 Bus
Local Memory
MicroBlaze xmdstub
X10844
Figure 10-5: MicroBlaze Stub Target with MDM UART and UARTlite
Usage
connect mb sim [-memsize <size>]
Usage
connect mdm -uart
Usage
debugconfig [-step_mode {disable_interrupt | enable_interrupt}]
[-memory_datawidth_matching {disable | enable}][-reset_on_run {<system
enable> | <processor enable> | disable}
Register/Memory Options
xwmem <target id> <address> {<number of Writes <number of bytes> data value from the specified
bytes>|half|word} {b | h | w} <value memory address. Defaults to byte (b) write.
list>
xwmem <target id> -var <Global
Variable Name> <value list>
xrreg <target id> [reg] Reads all registers or only register number <reg>.
xwreg <target id> [reg] [value] Writes a 32-bit value into register number <reg>.
xstack_check <target id> Gives the stack usage information of the program running on the
current target. The most recent ELF file downloaded on the target
is taken into account for stack check.
xcontinue <target id> [<Execute Start Continues from current PC or optionally specified
Address>] [-block] <Execute Start Address>.
If -block option is specified, the command returns when
the Processor stops on breakpoint or watchpoint. The -
block option is useful in scripting.
xcycle_step <target id> [cycles] Cycle steps through one clock cycle of PowerPC processor
ISS. If cycles is specified, then step cycles number of
clock cycles.a
xlist <target id> Lists all of the breakpoint addresses.
xremove <target id> Removes one or more breakpoints or watchpoints.
{<addr> | <function name> | <bp id> | all}
xreset <target id> [reset type] Resets target. Optionally, provide target-specific reset
types such as the signals mentioned in Table 10-22 on
page 187.
xrun <target id> Runs program from the program start address.
xstate <target id> Returns the processor target state; running or stopped.
xstep <target id> Single steps one MicroBlaze instruction. If the PC is at an
IMM instruction, the next instruction also runs. During a
single step, interrupts are disabled by keeping the BIP flag
set. Use xcontinue with breakpoints to enable interrupts
while debugging.
xstop <target id> Stops the program execution.
xwatch <target id> {r | w} <address> [<data Sets read/write watchpoints at a given <address> and,
value>] optionally, check for <data value>. If <data value> is
not specified, watchpoints match any value. The address
and value can be specified in hex or binary format.
a.This command is for Simulator targets only.
Miscellaneous Commands
Table 10-24: Miscellaneous Commands
Command Description
xhelp Lists the XMD commands.
xverbose Toggles verbose mode on and off. Dumps debugging information
from XMD.
Chapter 11
GNU Debugger
This chapter describes the general usage of the Xilinx GNU debugger (GDB) for the
MicroBlaze processor and the PowerPC (405 and 440) processors. This chapter contains
the following sections:
Overview
Additional Resources
MicroBlaze GDB Targets
PowerPC 405 Targets
PowerPC 440 Targets
Console Mode
GDB Command Reference
Overview
GDB is a powerful and flexible tool that provides a unified interface for debugging and
verifying MicroBlaze and PowerPC (405 and 440) systems during various development
phases. It uses Xilinx Microprocessor Debugger (XMD) as the underlying engine to
communicate to processor targets.
Tool Usage
MicroBlaze GDB usage:
mb-gdb <options> executable-file
PowerPC GDB usage:
powerpc-eabi-gdb <options> executable-file
Additional Resources
Tool Options
The following options are the most common in the GNU debugger:
-command=FILE
Execute GDB commands from the specified file. Used for debugging in batch and
script mode.
-batch
Exit after processing options. Used for debugging in batch and script mode.
-nx
Do not read initialization file .gdbinit. If you have issues connecting to XMD (GDB
connects and disconnects from XMD target), launch GDB with this option or remove
the .gdbinit file.
-nw
Do not use a GUI interface.
-w
Use a GUI interface (Default).
Additional Resources
GNU website: http://www.gnu.org
Red Hat Insight webpage: http://sources.redhat.com/insight.
Simulator Target
The XMD simulator is a cycle-accurate ISS of the MicroBlaze system which presents the
simulated MicroBlaze system state to GDB.
Hardware Target
With the hardware target, XMD communicates with Microprocessor Debug Module (mdm)
debug core or an XMDSTUB program running on a hardware board through the serial cable or
JTAG cable, and presents the running MicroBlaze system state to GDB.
For more information about XMD, refer to Chapter 10, Xilinx Microprocessor Debugger
(XMD)
Console Mode
To start powerpc-eabi-gdb in the console mode, type the following:
xilinx > powerpc-eabi-gdb -nw executable.elf
In the console mode, type the following two commands to connect to the board through
XMD:
(gdb) target remote localhost:1234
(gdb) load
The following text displays:
Loading section .text, size 0xfcc lma 0xffff8000
Loading section .rodata, size 0x118 lma 0xffff8fd0
Loading section .data, size 0x2f8 lma 0xffff90e8
Loading section .fixup, size 0x14 lma 0xffff93e0
Loading section .got2, size 0x20 lma 0xffff93f4
Loading section .sdata, size 0xc lma 0xffff9414
Loading section .boot0, size 0x10 lma 0xffffa430
Loading section .boot, size 0x4 lma 0xfffffffc
Start address 0xfffffffc, load size 5168
Transfer rate: 41344 bits/sec, 323 bytes/write.
(gdb) c
Continuing
For the console mode, these two commands can also be placed in the GDB startup file
gdb.ini in the current working directory.
Chapter 12
Overview
BitInit initializes the instruction memory of processors on the FPGA, which is stored in
block RAMs in the FPGA. This utility reads an Microprocessor Hardware Specification
(MHS) file, and invokes the Data2MEM utility provided in Xilinx ISE to initialize the
FPGA block RAMs.
Tool Usage
To invoke the BitInit tool, type the following:
% bitinit <mhsfile> [options]
Note: You must specify <mhsfile> before specifying other tool options.
Tool Options
Tool Options
The following options are supported in the current version of BitInit.
Note: BitInit also produces a file named data2mem.dmr, which is the log file generated during
invocation of the Data2MEM utility.
Chapter 13
Assumptions
This chapter assumes that you:
Are familiar with debugging programs using XMD and with using XMD commands.
Are familiar with general hardware and software system models in EDK.
Have a basic understanding of Tcl scripts.
Tool Requirements
Generating an ACE file requires the following tools:
a genace.tcl file
XMD
iMPACT (from ISE)
GenACE Features
GenACE Features
GenACE:
Supports PowerPC (405 and 440) processor and the MicroBlaze processor with MDM
targets.
Generates ACE files from hardware (Bitstream) and software (ELF and data) files.
Initializes external memories on PowerPC (405 and 440) processors and MicroBlaze
systems.
Supports multi-processor systems.
Supports single and multiple FPGA device systems.
GenACE Model
System ACE CF is a two-chip solution that requires the System ACE CF controller, and
either a CompactFlash card or one-inch Microdrive disk drive technology as the storage
medium. System ACE CF configures devices using Boundary-Scan (JTAG) instructions
and a Boundary-Scan Chain. The generated System ACE files support the System ACE CF
family of configuration solutions. The System ACE file is generated from a Serial Vector
Format (SVF) file, which is a text file that contains both programming instructions and
configuration data to perform JTAG operations.
XMD and iMPACT generate SVF files for software and hardware system files respectively.
The set of JTAG instructions and data used to communicate with the JTAG chain on-board
is an SVF file. It includes the instructions and data to perform operations such as:
Configuring an FPGA using iMPACT
Connecting to the processor target
Downloading the program and running the program from XMD
These actions are captured in an SVF file format. The SVF file is then converted to an ACE
file and written to the storage medium. These operations are performed by the System
ACE controller to achieve the determined operation.
The following is the sequence of operations using iMPACT and XMD for a simple
hardware and software configuration that gets translated into an ACE file:
1. Download the bitstream using iMPACT. The bitstream, download.bit, contains
system configuration and bootloop code.
2. Bring the device out of reset, causing the Done pin to go high. This starts the processor
system.
3. Connect to the processor using XMD.
4. Download multiple data files to block RAM or external memory.
5. Download multiple executable files to block RAM or external memory. The PC points
to the start location of the last downloaded ELF file.
6. Continue execution from the PC instruction address.
The flow for generating System ACE files is BIT to SVF, ELF to SVF, binary data to SVF, SVF
to ACE file.
The following section describes the options available in the genace.tcl script.
Syntax
xmd -tcl genace.tcl [-ace <ACE_file>][-board <board_type>][-data
<data_files> <load_address>][-elf <elf_files>][-hw <bitstream_file>]
[-jprog {true|false}][-opt <genace_options_file>]|
[-target <target_type> {ppc_hw|mdm}]
The options can be specified in an options file and passed to the GenACE script. The
options syntax is described in the following table.
-data <data_file> <load_address> none List of data/binary file and its load address. The load
address can be in decimal or hex format (0x prefix
needed).
If an SVF file is specified, it is used.
Usage
xmd -tcl genace.tcl -jprog -target mdm -hw
<implementation/download.bit> -elf executable1.elf executable2.svf
-data image.bin 0xfe000000 -board ml507 -ace system.ace
Preferred genace.opt file:
-jprog
-hw implementation/download.bit
-ace system.ace
-board ml507
-target mdm
-elf executable1.elf executable2.svf
-data image.bin 0xfe000000
4. Generate an SVF file for the software on the third FPGA device. The options file
contains the following:
-jprog
-ace fpga3_sw.ace
-board user
-configdevice devicenr 1 idcode 0x22a96093 irlength 10
partname xc5vlx50t
-configdevice devicenr 2 idcode 0x22a96093 irlength 10
partname xc5vlx50t
-configdevice devicenr 3 idcode 0x22a96093 irlength 10
partname xc5vlx50t
-debugdevice devicenr 3 cpunr 1
-target mdm
-elf executable3.elf
This generates the SVF file, fpga3_sw.svf.
5. Concatenate the files in the following order: config0.svf, fpga1_sw.svf,
fpga2_sw.svf, and fpga3_sw.svf to final_system.svf.
6. Generate the ACE file by calling impact -batch svf2ace.scr. Use the following
SCR file:
svf2ace -wtck -d -i final_system.svf -o final_system.ace
quit
Related Information
CF Device Format
To have the System ACE controller read the CF device, do the following:
1. Format the CF device as FAT16.
2. Create a Xilinx.sys file in the /root directory. This file contains the directory
structure to use by the ACE controller.
3. Copy the generated ACE file to the appropriate directory. For more information refer
to the iMPACT section of the ISE Help.
Related Information
Chapter 14
Overview
You can program the following in flash:
Executable or bootable images of applications
Hardware bitstreams for your FPGA
File system images, data files such as sample data and algorithmic tables
The executable or bootable images of applications is the most common use case. When the
processor in your design comes out of reset, it starts executing code stored in block RAM at
the processor reset location. Typically, block RAM size is only a few kilobytes or so and is
too small to accommodate your entire software application image. You can store your
software application image (typically, a few megabytes-worth of data) in flash memory. A
small bootloader is then designed to fit in block RAM. The processor executes the
bootloader on reset, which then copies the software application image from flash into
external memory. The bootloader then transfers control to the software application to
continue execution.
The software application you build from your project is in Executable Linked Format
(ELF). When bootloading a software application from flash, ELF images should be
converted to one of the common bootloadable image formats, such as Motorola S-record
(SREC). This keeps the bootloader smaller and more simple. EDK provides interface and
command line options for creating bootloaders in SREC format. See the Xilinx Platform
Studio Help for instructions on creating a flash bootloader and on converting ELF images to
SREC.
The physical layout, geometry information, and other logical information, such as
command sets, are determined using the CFI. The flash programmer can be used on flash
devices that use the CFI-defined command sets only. The CFI-defined command sets are
listed in the following table.
By default, the flash programmer supports only flash devices which have a sector map that
matches what is stored in the CFI table. Some flash vendors have top-boot and bottom-
boot flash devices; the same common CFI table is used for both. The field that identifies the
boot topology of the current device is not part of the CFI standard. Consequently, the flash
programmer encounters issues with such flash devices.
Refer to Customizing Flash Programming on page 212 for more information about how
to work around the boot topology identification field.
The following assumptions and behaviors apply to programming flash hardware:
Flash hardware is assumed to be in a reset state when programming is attempted by
the flash programming stub.
Flash sectors are assumed to be in an unprotected state.
The flash programming stub will not attempt to unlock or initialize the flash, and will
report an error if the flash hardware is not in a ready and unlocked state.
Note: The flash programmer does not currently support dual-die flash devices which require every
flash command to be offset with a Device Base Address (DBA) value. Examples of such dual-die
devices are the 512 Mbit density devices in the Intel StrataFlash Embedded Memory (P30) family of
flash memory.
After you determine the flash device type, you must copy over the files to create a custom
programming flow.
If you have a bottom-boot flash, add the following line in your
/etc/flash_params.tcl file:
set FLASH_BOOT_CONFIG BOTTOM_BOOT_FLASH
If you have a top-boot flash, add the following line in your /etc/flash_params.tcl
file:
set FLASH_BOOT_CONFIG TOP_BOOT_FLASH
Next, run the flash programming from the command line with the following command:
xmd -tcl flashwriter.tcl
Internally, these variables cause the flash programmer to rearrange the sector map
according to the boot topology.
Chapter 15
Overview
When you open an older project with the current version of EDK, the Format Revision Tool
automatically performs format changes to an existing EDK project and makes that project
compatible with the current version.
Backups of existing files, such as Xilinx Microprocessor Project (XMP), Microprocessor
Hardware Specification (MHS), and Microprocessor Software Specification (MSS), are
performed before the format changes are applied. These backup files are stored in the
/revup folder in the project directory.
Updates to IP and drivers, if any, are handled by the Version Management wizard, which
launches after the format revision tool runs. The format revision tool does not modify the
IPs used in the MHS design; it only updates the syntax, so the project can be opened with
the new tools.
12.1 Changes
Tools are updated to reflect revision 12.1.
11.4 Changes
Tools are updated to reflect revision 11.4.
11.3 Changes
Tools are updated to reflect revision 11.3.
[Updates GenACE] A microblaze_v72 option was added to the - cpu_version
XMD debug device command in the Genace File Options in Table 13-2, page 200.
[Updates XMD]
An option to specify the fpga device was added to the Program Control Options in
Table 10-21, page 186.
A note was added to the dow command to clarify that only those segments of an ELF file
that are marked as LOAD are executed.
References to ppc440 mode for ISS were removed.
[Update BFM] The Bus Functional Model was added as a chapter of this document.
[Update Flash Programmer] A work-around was added to allow the user to change a
flash program from synchronous to asynchronous in the TCL file.
11.2 Changes
Tools are updated to reflect revision 11.2.
[Updates Flash Memory] The set/reset command documentation was updated to
include information regarding new flash devices that require that the cfi.c file be
modified.
[Updates -configdevice option] The -configdevice option documentation
changed to reflect that the option is available in the OPT file only; -configdevice is
not available as a command line option.
11.1 Changes
Tools are updated to reflect revision 11.1.
[Updates XMP] The following tags were removed from the XMP in 11.1:
- FpgaImpMode - Used to select between Xplorer and xflow flows. Beginning with
release 11.1, Xplorer is no longer supported in EDK. Instead, instantiate the
project in the ISE Project Navigator to use Xplorer flow.
- EnableResetOptimization - ISE tools no longer require this setting to improve
timing.
- InsertNoPads, TopInst, NPL File - These settings are removed from the XMP.
- LockAddr, ICacheAddr, DCacheAddr - These settings for Address Generator
in the GUI were removed.
- Simulator, MixLangSim - Simulator settings are now applied across all the
XPS projects. The simulator settings can be set using Edit > Preferences in the
XPS GUI.
[Updates Simgen]
- The CompEDKLib was removed and replaced by Compxlib.
- -E switch was deprecated.
10.1 Changes
Tools are updated to reflect revision 10.1. The following tags were removed from the XMP
file in 10.1: UseProjNav, PnImportBitFile, PnImportBmmFile.
9.2i Changes
[Updates XMP] The XMP tag, EnableResetOptimization, was added and its value
is set to 0 (false). If it is set to true, it will improve timing on the reset signal.
[Updates XMP] The XMP tag, EnableParTimingError, was added and its value is
set to 0 (false). If it set to 1(true), the tools will error out if timing conditions are not
met after Place and Route.
Changes in 9.1i
[Updates XMP] Simulation libraries path are removed from the project. Simulation
library paths are now applied across all the XPS projects for the machine.
[Updates XMP] Stack and Heap size for custom linker scripts can no longer be
provided in the compiler settings dialog. These have to be specified in the custom
linker script. Stack and Heap size can be provided through the compiler settings
dialog for default linker scripts.
Changes in 8.2i
[Updates MHS] For submodule designs, the Format Revision Tool expands any I/O
ports into individual _I, _O, and _T ports. This aligns with changes to Platgen; any
buffers in the generated stub HDL are not instantiated, and the interface of the
generated HDL stays the same as that in the MHS file.
[Updates MHS] The Format Revision Tool changes the value of SIGIS for top-level
ports from DCMCLK to CLK. The value DCMCLK has been deprecated.
The preprocessor, assembler, and linker specific options for a software application are
moved and included among the Advanced Compiler Options settings; individual
options have been eliminated.
[Updates XMP] The synthesis tool setting is removed.
Changes in 8.1i
[Update MSS] The PROCINST PARAMETER is added to LIBRARY blocks, which
ensures that a given library can be configured differently across different processor
instances in the system.
[Updates Linkerscript] MicroBlaze-based application linker script updates are
provided to allow the addition of new vector sections that support CRT changes.
[Updates Linkerscript] MicroBlaze-based application linker script updates are
provided to allow the addition of new sections that support C++.
[Updates Linkerscript] PowerPC processor based application linker script updates
are provided to allow the addition of new sections that support C++.
[No Project Updates] For MicroBlaze applications, the program start address is
changed from 0x0 to 0x50 to accommodate the change in size of xmdstub.elf.
[No Project Updates] For projects that use the Spartan-3 FPGA architecture, there is
a change to bitgen.ut.
Changes in 7.1i
[Updates Linkerscript] PowerPC processor based application linker script updates are
provided to allow for the addition of new sections that support GCC 3.4.1 changes.
Changes in 6.3i
[Updates MHS] The EDGE and LEVEL subproperties on top-level interrupt ports are
consolidated into the SENSITIVITY subproperty in the MHS file.
Changes in 6.2i
[No Project Updates] The mb-gcc compiler option related to the hard multiplier is
removed. This is based only on FPGA architecture.
[Updates MSS] In the MSS file, the PROCESSOR block is split into two blocks,
PROCESSOR and OS. In conjunction with this change:
- The Linux and VxWorks LIBRARY blocks are renamed to reflect their new status
as OS blocks.
- With the introduction of the OS block, all peripherals used with Linux and
VxWorks operating systems are specified using a CONNECTED_PERIPHS
parameter, which replaces the CONNECT_TO parameter used in earlier versions.
When the Format Revision Tool runs, it collects old CONNECT_TO driver parameter
peripherals and collates them in the CONNECTED_PERIPHS parameter of the OS
block.
- In the MSS file PROCESSOR block, the following parameters are removed: LEVEL,
EXECUTABLE, SHIFTER, and DEFAULT_INIT.
- In the PROCESSOR block, the DEBUG_PERIPHERAL is renamed
XMDSTUB_PERIPHERAL.
Chapter 16
Summary
The Xilinx Embedded Development Kit (EDK) includes some GNU-based tools such as
the compiler, the debugger, and the make utility. For the NT platform, these require a
LINUX emulation shell; the Red Hat Cygwin shell and utilities are provided as part of
the EDK installation.
Xilinx EDK installs a Cygwin environment under $XILINX_EDK\cygwin.
Using xbash
To find usage information about xbash, use the xbash -help command.
Usage:
xbash [-c <COMMAND>] [-override] [-undo]
Appendix A
GNU Utilities
This appendix describes the GNU utilities available for use with EDK. It contains the
following sections:
General Purpose Utility for MicroBlaze and PowerPC
Utilities Specific to MicroBlaze and PowerPC
Other Programs and Files
cpp
Pre-processor for C and C++ utilities. The preprocessor is invoked automatically by GNU
Compiler Collection (GCC) and implements directives such as file-include and define.
gcov
This is a program used in conjunction with GCC to profile and analyze test coverage of
programs. It can also be used with the gprof profiling program.
Note: The gcov utility is not supported by XPS or SDK, but is provided as is for use if you want to
roll your own coverage flows.
mb-addr2line
This program uses debugging information in the executable to translate a program address
into a corresponding line number and file name.
mb-ar
This program creates, modifies, and extracts files from archives. An archive is a file that
contains one or more other files, typically object files for libraries.
mb-as
This is the assembler program.
mb-c++
This is the same cross compiler as mb-gcc, invoked with the programming language set to
C++. This is the same as mb-g++.
mb-c++filt
This program performs name demangling for C++ and Java function names in assembly
listings.
mb-g++
This is the same cross compiler as mb-gcc, invoked with the programming language set to
C++. This is the same as mb-c++.
mb-gasp
This is the macro preprocessor for the assembler program.
mb-gcc
This is the cross compiler for C and C++ programs. It automatically identifies the
programming language used based on the file extension.
mb-gdb
This is the debugger for programs.
mb-gprof
This is a profiling program that allows you to analyze how much time is spent in each part
of your program. It is useful for optimizing run time.
mb-ld
This is the linker program. It combines library and object files, performing any relocation
necessary, and generates an executable file.
mb-nm
This program lists the symbols in an object file.
mb-objcopy
This program translates the contents of an object file from one format to another.
mb-objdump
This program displays information about an object file. This is very useful in debugging
programs, and is typically used to verify that the correct utilities and data are in the correct
memory location.
mb-ranlib
This program creates an index for an archive file, and adds this index to the archive file
itself. This allows the linker to speed up the process of linking to the library represented by
the archive.
mb-readelf
This program displays information about an Executable Linked Format (ELF) file.
mb-size
This program lists the size of each section in the object file. This is useful to determine the
static memory requirements for utilities and data.
mb-strings
This is a useful program for determining the contents of binary files. It lists the strings of
printable characters in an object file.
mb-strip
This program removes all symbols from object files. It can be used to reduce the size of the
file, and to prevent others from viewing the symbolic information in the file.
Appendix B
Interrupt Management
This appendix describes how to set up interrupts in a Xilinx embedded hardware system.
Also, this appendix describes the software flow of control during interrupts and the
software APIs for managing interrupts. To benefit from this description, you need to have
an understanding of hardware interrupts and their usefulness. The sections in this
document are:
Additional Resources
Hardware Setup
Software Setup and Interrupt Flow
Software APIs
Additional Resources
Platform Specification Format Reference Manual:
http://www.xilinx.com/ise/embedded/edk_docs.htm
PowerPC Processor Reference Guide:
http://www.xilinx.com/ise/embedded/edk_docs.htm
OS and Libraries Document Collection:
http://www.xilinx.com/ise/embedded/edk_docs.htm
Using and Creating Interrupt-Based Systems Application Note:
http://direct.xilinx.com/bvdocs/appnotes/xapp778.pdf
Xilinx device drivers document in the EDK installation:
/doc/usenglish/xilinx_drivers.htm
Hardware Setup
You must first wire the interrupts in your hardware so the processor receives interrupts.
The MicroBlaze processor has a single external interrupt port called Interrupt. The
PowerPC 405 processor and the PowerPC 440 processor each have two ports for
handling interrupts. One port generates a critical category external interrupt and the other
port generates a non-critical category external interrupt, the difference between the two
categories being the priority level over other competing interrupts and exceptions in the
system. The critical category has the highest priority.
On the PowerPC 405 processor the critical and non-critical interrupt ports are named
EICC405CRITINPUTIRQ and EICC405EXTINPUTIRQ respectively.
On the PowerPC 440 processor the critical and non-critical interrupt ports are named
EICC440CRITIRQ and EICC440EXTIRQ respectively.
There are two ways to wire interrupts to a processor:
The interrupt signal from the interrupting peripheral is directly connected to the
processor interrupt port. In this configuration, only one peripheral can interrupt the
processor.
The interrupt signal from the interrupting peripheral is connected to an interrupt
controller core which in turn generates an interrupt on a signal connected to the
interrupt port on the processor. This allows multiple peripherals to send interrupt
signals to a processor. This is the more common method as there are usually more
than one peripheral on embedded systems that require access to the interrupt
function.
The following figure illustrates the interrupt configurations.
UART
Processor Processor
X11017
Application Interrupt
Handler
Software Platform/OS
Level Interrupt Vector
7. The final interrupt handler for a particular interrupt typically queries the interrupting
peripheral and figures out the cause for the interrupt. It does a series of actions that are
appropriate for the given peripheral and the cause for the interrupt. The handler is also
responsible for acknowledging the interrupt at the interrupting peripheral. Once the
interrupt handler is done, it returns back and the interrupt stack gets unwound all the
way back to the software platform level interrupt handler.
8. The platform level interrupt handler restores the registers it saved on the stack and
returns control back to the Program Counter (PC) location where the interrupt
occurred. The return instruction also enables interrupts again on the MicroBlaze
processor. The application resumes normal execution at this point.
It is recommended that interrupt handlers be kept to a short duration and the bulk of
the work be left to the application to handle. This prevents long lockouts of other
(possibly higher priority) interrupts and is considered good system design.
The following figures illustrate the interrupt flow for MicroBlaze system without and with
an interrupt controller.
User Program
INTR
.. 0x000_0008 microblaze_interrupt_handler.c
.. __interrupt_handler()
user or peripheral
.. 0x000_00 10
Branch to OS
INTR handler Lookup the
interrupt handler
function
.. interrupt handler
0x000_00 18 registered with
the OS and jump
0x000_00 20
to it. ..
..
MB_InterruptVector
Table {
____________, User or peripheral
_____________ interrupt handler
}; registered directly with
the OS layer
X11019
User Program
INTR
.. 0x000_0008 microblaze_interrupt_handler.c
.. __interrupt_handler()
Branch to OS xintc.c
.. 0x000_00 10 INTR handler XIntc_DeviceInterruptHandler()
MB_InterruptVector
Table {
XIntc_DeviceInterruptHandler() ____________,
registered with the }; HandlerTable {
____________, User or peripheral
OS Layer
_____________ interrupt handlers
_____________ registered with the
_____________ interrupt
controller driver
};
X11020
5. On systems with an interrupt controller, the next level handler is the handler provided
by the interrupt controller driver. This handler queries the interrupt controller for all
active interrupts in the system. For each active interrupt, it consults its internal vector
table, which contains the user-registered handler for each interrupt line.
If no handler is registered, a default do-nothing handler is registered. The registered
handler for each interrupt gets invoked in turn (in interrupt priority order).
6. On systems without an interrupt controller, the next handler is the final interrupt
handler that is executed by the application.
7. The final interrupt handler for a particular interrupt typically queries the interrupting
peripheral and determines the cause for the interrupt. It usually does a series of actions
that are appropriate for the given peripheral and the cause for the interrupt. The
handler is also responsible for acknowledging the interrupt at the interrupting
peripheral. When the interrupt handler completes its activity, it returns back and the
interrupt stack gets unwound back to the software platform level interrupt handler.
The platform level interrupt handler restores the registers that it saved on the stack and
returns control back to the Program Counter (PC) location where the interrupt occurred.
The return instruction also enables interrupts again on the PowerPC processor. The
application resumes normal execution at this point.
It is recommended that interrupt handlers be of a short duration and that the bulk of the
interrupt work be done by application. This prevents long lockouts of other (possibly
higher priority) interrupts and is considered good system design.
The following figures illustrate the interrupt flow for a PowerPC processor system without
and with an interrupt controller.
Branch to
INTR
.. critical intr vectoring code
.. Interrupt Vectoring Code
..
others
Branch to user or peripheral
.. external intr vectoring code
Lookup the
interrupt handler
function
interrupt handler
others registered with
the OS for the
current interrupt ..
type and jump to it.
..
XExc_VectorTable {
User or peripheral
____________,
_____________ interrupt handlers
_____________ registered directly
_____________ with the OS layer
};
X11021
Software APIs
Branch to
..
INTR critical intr vectoring code
..
Interrupt Vectoring Code
others
.. xintc.c
Branch to
external intr vectoring code XIntc_DeviceInterruptHandler()
.. Lookup the
user or peripheral
interrupt handler
others interrupt handler
registered with function
the OS for the For each active
current interrupt interrupt, call
type and jump to it. the registered
interrupt ..
handler.
..
XExc_VectorTable {
____________,
XIntc_DeviceInterruptHandler() _____________ User or peripheral
_____________ HandlerTable {
registered with the ____________, interrupt handlers
___________ __
OS layer _____________ registered with the
}; _____________ interrupt
_____________ controller driver
};
X11022
Software APIs
This section provides an overview of the software APIs involved in handling and
managing interrupts, lists the available Software APIs by processor type, and provides
examples of interrupt management code.
Note: This chapter is not meant to cover the APIs comprehensively. Refer to the interrupt controller
device driver documentation as well as the Standalone platforms reference documentation to know
all the details of the APIs.
API Descriptions
Software APIs
Typedef
typedef void(* Xil_ExceptionHandler)(void *Data)
This typedef is the exception handler function pointer.
void Xil_ExceptionDisable()
Description Disable Exceptions. On PowerPC 405 and PowerPC 440 processors,
this function only disables non-critical exceptions.
void Xil_ExceptionEnable()
Description Enable Exceptions. On PowerPC 405 and PowerPC 440 processors,
this function only enables non-critical exceptions.
void Xil_ExceptionInit()
Description Initialize exception handling for the processor. The exception vector
table is set up with the stub handler for all exceptions.
Software APIs
#include "xparameters.h"
#include "xtmrctr.h"
#include "xintc.h"
#include "xil_exception.h"
/*
* The following constant determines which timer counter of the device
* that is used for this example, there are currently 2 timer counters
* in a device and this example uses the first one, 0, the timer numbers
* are 0 based
*/
#define TIMER_CNTR_0 0
/*
* The following constant is used to set the reset value of the timer
* counter, making this number larger reduces the amount of time this
* example consumes because it is the value the timer counter is loaded
* with when it is started
*/
#define RESET_VALUE 0xF0000000
/*
* The following variables are shared between non-interrupt processing
* and interrupt processing such that they must be global.
*/
volatile int TimerExpired;
/********************************************************************/
/**
* This function is the main function of the Tmrctr example using
* Interrupts.
*
* @paramNone.
*
* @returnXST_SUCCESS to indicate success, else XST_FAILURE to indicate
* a Failure.
*
* @noteNone.
*
*********************************************************************/
int main(void)
{
int Status;
/*
* Run the Timer Counter - Interrupt example.
*/
Status = TmrCtrIntrExample(&InterruptController,
&TimerCounterInst,
TMRCTR_DEVICE_ID,
TMRCTR_INTERRUPT_ID,
TIMER_CNTR_0);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
return XST_SUCCESS;
/********************************************************************/
/**
* This function does a minimal test on the timer counter device and
* driver as a design example. The purpose of this function is to
* illustrate how to use the XTmrCtr component. It initializes a timer
* counter and then sets it up in compare mode with auto reload such that
* a periodic interrupt is generated.
*
Software APIs
/*
* Initialize the timer counter so that it's ready to use,
* specify the device ID that is generated in xparameters.h
*/
Status = XTmrCtr_Initialize(TmrCtrInstancePtr, DeviceId);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
/*
* Initialize the interrupt controller driver so that
* it's ready to use, specify the device ID that is generated in
* xparameters.h
*/
Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
/*
* Connect a device driver handler that will be called when an
* interrupt for the device occurs, the device driver handler performs
* the specific interrupt processing for the device
*/
Status = XIntc_Connect(IntcInstancePtr, IntrId,
(XInterruptHandler)XTmrCtr_InterruptHandler,
(void *)TmrCtrInstancePtr);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
/*
* Start the interrupt controller such that interrupts are enabled for
* all devices that cause interrupts, specific real mode so that
* the timer counter can cause interrupts thru the interrupt
* controller.
*/
Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
/*
* Enable the interrupt for the timer counter
*/
XIntc_Enable(IntcInstancePtr, IntrId);
/*
* Initialize the exception table.
*/
Xil_ExceptionInit();
/*
* Register the interrupt controller handler with the exception table.
*/
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
(Xil_ExceptionHandler)
XIntc_InterruptHandler,
IntcInstancePtr);
/*
* Enable exceptions.
*/
Xil_ExceptionEnable();
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
/*
* Setup the handler for the timer counter that will be called from the
* interrupt context when the timer expires, specify a pointer to the
* timer counter driver instance as the callback reference so the
* handler is able to access the instance data
*/
XTmrCtr_SetHandler(TmrCtrInstancePtr,
TimerCounterHandler,
TmrCtrInstancePtr);
/*
* Enable the interrupt of the timer counter so interrupts will occur
* and use auto reload mode such that the timer counter will reload
* itself automatically and continue repeatedly, without this option
* it would expire once only
*/
XTmrCtr_SetOptions(TmrCtrInstancePtr, TmrCtrNumber,
XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION);
/*
* Set a reset value for the timer counter such that it will expire
Software APIs
* eariler than letting it roll over from 0, the reset value is loaded
* into the timer counter when it is started
*/
XTmrCtr_SetResetValue(TmrCtrInstancePtr, TmrCtrNumber, RESET_VALUE);
/*
* Start the timer counter such that it's incrementing by default,
* then wait for it to timeout a number of times
*/
XTmrCtr_Start(TmrCtrInstancePtr, TmrCtrNumber);
while (1) {
/*
* Wait for the first timer counter to expire as indicated by the
* shared variable which the handler will increment
*/
while (TimerExpired == LastTimerExpired) {
}
LastTimerExpired = TimerExpired;
/*
* If it has expired a number of times, then stop the timer counter
* and stop this example
*/
if (TimerExpired == 3) {
XTmrCtr_Stop(TmrCtrInstancePtr, TmrCtrNumber);
break;
}
}
/*
* Disable the interrupt for the timer counter
*/
XIntc_Disable(IntcInstancePtr, DeviceId);
return XST_SUCCESS;
}
/********************************************************************/
/**
* This function is the handler which performs processing for the timer
* counter. It is called from an interrupt context such that the amount
* of processing performed should be minimized. It is called when the
* timer counter expires if interrupts are enabled.
*
* This handler provides an example of how to handle timer counter
* interrupts but is application specific.
*
* @paramCallBackRef is a pointer to the callback function
* @paramTmrCtrNumber is the number of the timer to which this
* handler is associated with.
*
* @returnNone.
*
* @noteNone.
*
*********************************************************************/
/*
* Check if the timer counter has expired, checking is not necessary
* since that's the reason this function is executed, this just shows
* how the callback reference can be used as a pointer to the instance
* of the timer counter that expired, increment a shared variable so
* the main thread of execution can see the timer expired
*/
if (XTmrCtr_IsExpired(InstancePtr, TmrCtrNumber)) {
TimerExpired++;
if(TimerExpired == 3) {
XTmrCtr_SetOptions(InstancePtr, TmrCtrNumber, 0);
}
}
}
Appendix C
Introduction
Each time EDK tools run, they build a runtime data structure of your design. The data
structure contains information about user design files, such as Microprocessor Hardware
Specification (MHS) and Microprocessor Software Specification (MSS), or library data files,
such as Microprocessor Peripheral Definition (MPD), Microprocessor Driver Definition
(MDD), and Microprocessor library Definition (MLD). Access to the data structure is given
as Tcl APIs. Based on design requirements, IP, driver, library, and OS writers that provide
the corresponding data files can access the data structure information to add some extra
steps in the tools processing. EDK tools also use Tool Command Language (Tcl) to perform
various Design Rule Checks (DRCs), and to update the design data structure in a limited
manner.
Additional Resources
Platform Specification Format Reference Manual:
http://www.xilinx.com/ise/embedded/edk_docs.htm
Understanding Handles
The tools provide access points into the data structure through a set of API functions. Each
API function requires an argument in the form of system information, which is called a
handle.
For example, an IP defined in the Microprocessor Hardware Specification (MHS) file or a
driver defined in the Microprocessor Software Specification (MSS) file could serve as a
handle. Handles can be of various types, based on the kind of data to which they are
providing access. Data types include instance names, driver names, hardware parameters,
or hardware ports. From a given handle, you can get information associated with that
handle, or you can get other, associated handles.
MHS
MPD
Merged
DataStructure
X10582
Overview
This section provides a list of Tcl APIs available in the EDK hardware data structure. The
description of these commands uses certain terms, which are defined in the following
subsections.
API Summary
Table C-1: Hardware API Summary
xget_hw_busif_value <handle> <busif_name>
xget_hw_bus_slave_addrpairs <merged_bus_handle>
xget_hw_busif_handle <handle> <busif_name>
xget_hw_connected_busifs_handle <merged_mhs_handle> <businst_name> <busif_type>
xget_hw_connected_ports_handle <merged_mhs_handle> <connector_name> <port_type>
xget_hw_ioif_handle <handle> <ioif_name>
xget_hw_ioif_value <handle> <ioif_name>
xget_hw_ipinst_handle <mhs_handle> <ipinst_name>
xget_hw_mpd_handle <ipinst_handle>
xget_hw_name <handle>
xget_hw_option_handle <handle> <option_name>
xget_hw_option_value <handle> <option_name>
xget_hw_parameter_handle <handle> <parameter_name>
xget_hw_parameter_value <handle> <parameter_name>
xget_hw_pcore_dir_from_mpd <mpd_handle>
xget_hw_pcore_dir <ipinst_handle>
xget_hw_port_connectors_list <ipinst_handle> <portName>
xget_hw_parent_handle <handle>
xget_hw_port_connectors_list <ipinst_handle> <portName>
xget_hw_port_handle <handle> <port_name>
xget_hw_port_value <handle> <port_name>
xget_hw_proj_setting <prop_name>
xget_hw_proc_slave_periphs <merged_proc_handle>
xget_hw_subproperty_handle <property_handle> <subprop_name>
xget_hw_subproperty_value <property_handle> <subprop_name>
xget_hw_value <handle>
xget_hw_bus_slave_addrpairs <merged_bus_handle>
Description Returns a list of slave addresses associated with the specified bus handle.
The returned value is a list of integers where:
The first value is the base address of any connected peripherals.
The second value is the associated high address.
The following values are paired base and high addresses of other
peripherals.
Arguments <merged_bus_handle> is a handle to a merged IP instance pointing to a
bus instance.
xget_hw_connected_busifs_handle <merged_mhs_handle>
<businst_name> <busif_type>
Description Returns a list of handles to bus interfaces that are connected to a specified
bus.
Arguments <merged_mhs_handle> is a handle to the merged MHS.
<businst_name> is the name of the connected bus instance.
<busif_type> is one of the following: MASTER, SLAVE, TARGET,
INITIATOR, ALL.
xget_hw_connected_ports_handle <merged_mhs_handle>
<connector_name> <port_type>
Description Returns a list of handles to ports associated with a specified connector.
The valid handle type is the merged MHS.
Arguments <merged_mhs_handle> is the handle to the merged MHS.
<connector_name> is the name of the connector.
<port_type> is source, sink, or all.
This API returns a list of handles to ports based on the <port_type>,
where:
source is a list of ports that are driving the given signal.
sink is a list of ports that are being driven by the given signal.
all is a list of all ports connected to the given signal.
xget_hw_mpd_handle <ipinst_handle>
Description Returns a handle to the MPD object associated with the specified IP
instance.
Arguments <ipinst_handle> is a handle to the merged IP instance.
xget_hw_name <handle>
Description Returns the name of the specified handle.
Arguments <handle> is of specified type.
If <handle> is of type IP instance, its name is the instance name of that
IP. For example, if the handle refers to an instance of MicroBlaze called
mymb in the MHS file, the value the API returns is mymb. Similarly, to get
the name of a parameter from a parameter handle, you can use the same
command.
xget_hw_parent_handle <handle>
Description Returns the handle to the parent of the specified handle. The type of
parent handle is determined by the specified handle type. If the
specified handle is a merged handle, the parent obtained through this
API will also be a merged handle.
Arguments <handle> is one of the following:
PARAMETER, the parent is the MPD, IP instance, or the merged IP
instance object.
PORT, the parent is the MPD, IP instance, the merged IP instance,
or the MHS object.
BUS_INTERFACE, the parent is the MPD, IP instance, or the merged
IP instance object.
IO_INTERFACE, the parent is the MPD or the merged IP instance
object.
OPTION, the parent is the MPD or the merged IP instance object.
IPINST, the parent is the MHS or the merged MHS object.
For MHS or MPD, the parent is a NULL handle.
xget_hw_pcore_dir_from_mpd <mpd_handle>
Description Returns the pcore directory path for the MPD.
Arguments <mpd_handle> is the handle to the MPD.
xget_hw_pcore_dir <ipinst_handle>
Description Returns the pcore directory for the given IP instance.
Arguments <ipinst_handle> is the handle to the IP instance.
xget_hw_proj_setting <prop_name>
Description Returns the value of the property specified by prop_name.
Arguments <prop_name> is the name of the property whose value is needed.
Options are: fpga_family, fpga_subfamily, fpga_partname,
fpga_device, fpga_package, fpga_speedgrade
xget_hw_proc_slave_periphs <merged_proc_handle>
Description Returns a list of handles to slaves that can be addressed by the specified
processor
Arguments <merged_proc_handle> is a handle to the merged IP instance, pointing
to a processor instance. This returned list includes slaves that are not
directly connected to the processor, but are accessed across a bus-to-bus
bridge (for example, opb2plb_bridge).
The input handle must be an IP instance handle to a processor instance,
obtained from the merged MHS only (not from the original MHS).
xget_hw_value <handle>
Description Gets the value associated with the specified handle.
Arguments <handle> is of specified type.
If <handle> is of type IP instance, its value is the IP module name. For
example, if the handle refers to the MicroBlaze instance in the MHS file,
the value the API returns is the name of the IP, that is, microblaze.
Similarly, to get the value of a parameter from a parameter handle, you can
use the same command.
Example 1
This procedure explains how to get a list of IPs of a particular IPTYPE. Each IP provided in
the EDK repository has a corresponding IP type specified by the IPTYPE option, in the
MPD file. The merged_mhs_instance has the information from both the MHS file and the
MPD file. The process for getting a list of IPs of a particular IPTYPE is:
1. Using the merged_mhs_handle, get a list of all IPs.
2. Iterate over this list and for each IP, get the value of the OPTION IPTYPE and compare
it with the given IP type.
The following code snippet illustrates how to get the IPTYPE of specific IPs.
## Procedure to get a list of IPs of a particular IPTYPE
proc xget_ipinst_handle_list_for_iptype {merged_mhs_handle iptype}
{
##Get a list of all IPs
set ipinst_list [xget_hw_ipinst_handle $merged_mhs_handle *]
set ret_list
foreach ipinst $ipinst_list {
## Get the value of the IPTYPE Option.
set curiptype [xget_hw_option_value $ipinst IPTYPE]
##if curiptype matches the given iptype, then add it to ## the
list that this proc returns.
if {[string compare -nocase $curiptype $iptype] == 0}{
lappend ret_list $ipinst
}
}
return $ret_list
}
Example 2
The following procedure explains how to get the list of cores that are memory controllers in
a design. Memory controller cores have the tag, ADDR_TYPE = MEMORY, in their address
parameter.
## Procedure to get a list of memory controllers in a design.
proc xget_hw_memory_controller_handles { merged_mhs } {
set ret_list
return $ret_list
}
Delete Commands
Modify Commands
xget_libgen_proc_handle
Description Returns the handle to the merged processor for which Libgen is currently
being run. This API is available only when Libgen is run
Arguments none
Example In a driver Tcl file, get the merged processor instance for which the Libgen
algorithm is run:
set proc_handle [xget_libgen_proc_handle]
xget_sw_driver_handle_for_ipinst
<merged_processor_handle> <ipinst_name>
Description Returns a handle to the merged driver object assigned to the IP instance
specified by <ipinst_name>. A merged driver object is a driver that has an
associated list of peripherals and parameter values that use the merged
driver. The merged driver contains connectivity information that is
provided by the merged processor object.
Arguments <merged_processor_handle> is a merged processor object that is
available only when Libgen is run and is obtained by using the
xget_libgen_proc_handle API.
<ipinst_name> is the IP instance whose merged driver information is
required.
Example Obtain a driver for the IP of a particular IP source connected to the Interrupt
controller:
set sw_proc_handle [xget_libgen_proc_handle]
set ip_driver [xget_sw_driver_handle_for_ipinst
$sw_proc_handle $ip_name]
Note: This example is from the intc driver Tcl file
xget_sw_iplist_for_driver <merged_driver_handle>
Description Returns a list of handles to peripherals that are assigned to the driver
associated with the <merged_driver_handle>.
Arguments <merged_driver_handle> is available only when Libgen is run, and
obtained by using the xget_sw_driver_handle_for_ipinst API.
Example Get the list of all peripherals that use the driver uartlite using the
uart_driver_handle:
set periphs [xget_sw_iplist_for_driver
$uart_driver_handle]
xget_sw_ipinst_handle_from_processor <ipinst_name>
<merged_processor_handle>
Description Returns the handle to an IP instance associated with a merged processor
handle.
Arguments <ipinst_name> is the IP instance associated with the merged processor
handle.
<merged_processor_handle> is the name of the merged processor and
is obtained by the xget_libgen_proc_handle API.
Example Get the handle to an instance named my_plb_ethernet:
set sw_proc_handle [xget_libgen_proc_handle]
set inst_handle [xget_sw_ipinst_handle_from_processor
$sw_proc_handle my_plb_ethernet]
xget_sw_mdd_handle <handle>
Description Returns a handle to the MDD object associated with the given driver or
processor instance.
Arguments <handle> is of specified type. Types can be original driver instance,
original processor instance, merged driver, or merged processor.
Example set mdd_handle [xget_sw_mdd_handle $drv_handle]
xget_sw_mld_handle <handle>
Description Returns a handle to the MLD object associated with the given OS or
library instance
Arguments <handle> is of specified type. Valid types are original OS instance,
original library instance, merged OS, or merged library.
Example set mld_handle [xget_sw_mld_handle $os_handle]
xget_sw_name <handle>
Description Returns the name of the specified handle. For an OS instance named
standalone in the MSS file, the name returned by the API is
standalone. Similarly, to get the name of a parameter from a
parameter handle, you can use the same command.
Arguments <handle> is of specified type.
Example Get the OS instance and its name:
set os_name [xget_sw_name $os_handle]
xget_sw_parent_handle <handle>
Description Returns the handle for the parent of the specified handle.
Arguments <handle> is of specified type. The parent handle type depends on the type
of the handle specified. If the specified handle is a merged handle, the parent
obtained through this API will also be a merged handle. The option per
handle type are:
PARAMETER, the parent is one of the following: MDD, MLD, processor
instance, driver instance, OS instance, library instance or the merged
processor instance, merged driver instance, merged OS instance, or
merged library instance object.
ARRAY, the parent is one of the following: MDD, MLD, driver instance,
processor instance, OS instance, library instance or one of the merged
instances (processor instance, OS instance, library instance, driver
instance), or the MSS object.
ELEMENT, the parent is the array object.
INTERFACE, the parent could be the MDD, MLD, driver instance,
processor instance, OS instance, library instance or one of the merged
instances (processor instance, OS instance, library instance, driver
instance).
FUNCTION, the parent is the interface object.
OPTION, the parent could be one of the following: the MDD or MLD
driver instance, the processor instance, the OS instance, the library
instance; or one of the merged instances (processor instance, OS instance,
library instance, driver instance).
DRVINST, the parent is either the MSS or the merged MSS object.
PROCINST, the parent is either the MSS or the merged MSS object.
OSINST, the parent is either the MSS or the merged MSS object.
LIBINST, the parent is either the MSS or the merged MSS object.
MSS, MDD, or MLD, the parent is a NULL handle.
Example To get the parent of a parameter:
set parent_handle [xget_sw_parent_handle $param_handle]
xget_sw_value <handle>
Description Returns the value associated with the specified handle: a handle of type
PARAMETER, has a value of that parameter.
Input Files
Platgen, Simgen, Libgen and other tools that create the hardware platform work with the
MHS design file and the IP data files (MPD). Internally, the tools create the system view
based on these files. Each of the IP in the design has an MPD associated with it. Optionally,
it can have an associated Tcl file. Tcl files can contain DRC procedures, procedures to
automate calculation of parameters, or they can perform other tasks. The Tcl files that are
used during the hardware platform generation are present in the individual cores'
directory along with the MPD files. For Xilinx-supplied cores, the Tcl files are in the <EDK
install area>/hw/XilinxProcessorIPLib/pcores/<corename>/data/ directory.
- SYSLEVEL
These procedures are invoked later in processing, when the tool has performed
some system-level analysis of the design and has updated certain parameters. For
a list of such parameters, refer to the Reserved Parameters section of Chapter 2,
Platform Specification Utility (PsfUtility). Also note that some parameters may
be updated by Tcl procedures of IPs. Such parameters are governed solely by IP
Tcl and are therefore not listed in the MPD documentation.
Each Tcl procedure takes one argument. The argument is a handle of a certain type
in the data structure. The handle type depends on the object type with which the
Tcl procedure is associated. Tcl procedures associated with parameters are
provided with a handle to that parameter as an argument.
Tcl procedures associated with the IP itself are provided with a handle to a
particular instance of the IP used in the design as an argument. The following is a
list of the Tcl procedures that can be called for an IP instance.
Note: The MPD tag name that specifies the Tcl procedure name indicates the category to
which the Tcl procedure belongs.
Each of the following tags is a name-value pair in the MPD file, where the value
specifies the Tcl procedure associated with that tag. You must ensure that such a
Tcl procedure exists in the Tcl file for that IP.
Tool-specific Tcl calls
- You can specify calls specific to either Platgen or Simgen.
## Tcl snippet
## Argument param_handle points to C_PARAM1 since the Tcl is
## associated with C_PARAM1
proc drc_param1 {param_handle} {
set param1val [xget_hw_value $param_handle
if {$param1val >= 5} {
error C_PARAM1 value should be less 5
return 1;
} else {
return 0;
}
}
## Tcl snippet
proc iplevel_drc {ipinst_handle} {
set splb_handle [xget_hw_busif_handle $ipinst_handle SPLB]
set splb_conn [xget_hw_value $splb_handle]
set myport_handle [xget_hw_port_handle MYPORT]
set myport_conn [xget_hw_value $myport_handle]
if {$splb_conn == || $myport_conn == } {
error Either busif SPLB or port MYPORT must be connected in the
design
return 1;
}
else {
return 0;
}
}
## Tcl snippet
proc sysupdate_param1 {param_handle} {
set retval [somehow_compute_param1]
return $reetval;
}
Platgen-specific Call
The OPTION PLATGEN_SYSLEVEL_UPDATE_PROC is called after all the common Tcl
procedures have been invoked. If you want certain actions to occur only when Platgen
runs and not when other tools run, this procedure can be used.
## MPD Snippet
OPTION PLATGEN_SYSLEVEL_UPDATE_PROC = platgen_syslevel_update
Simgen-specific Call
The OPTION SIMGEN_SYSLEVEL_UPDATE_PROC is called after all the common Tcl procedures
have been invoked. If you want certain actions to occur when Simgen runs and not when
other tools run, this procedure can be used.
## MPD Snippet
OPTION SIMGEN_SYSLEVEL_UPDATE_PROC = simgen_syslevel_update
FORMAT_PROC
The FORMAT_PROC keyword defines the Tcl entry point that allows you to provide a
specialized formatting procedure to format the value of the parameter.
The EDK tools deliver output files of two HDL types: Verilog and VHDL. Each format
semantic requires that the parameter values be normalized to adhere to a stylized
representation suitable for processing. For example, Verilog is case-sensitive and does not
have string manipulation functions. When developing an IP, you can use this Tcl entry
point to specify procedures to format string values based on the HDL requirements. Refer
to the Platform Specification Format Reference Manual for further details, and examples.
Additional Resources, page 245 contains a link to the document.
Input Files
Libgen works with the input files (MSS or MHS) and the data files (MPD, MDD, MLD, or
Tcl) of IPs, drivers, OSs, processors, and libraries. It creates the system view based on these
files. Each of the drivers, OSs, processors, and libraries defined in the MSS file have an
MDD or MLD file and a Tcl file associated with them. The Tcl file contains procedures for
generating the right configuration of drivers and libraries based on input in the MSS file.
The Tcl files that are used during the software platform generation are present in the
individual drivers' directory along with the MDD files. For Xilinx-supplied cores, the files
are located in the
<EDK install area>/sw/XilinxProcessorIPLib/drivers/<driver_name>/data/
directory.
Appendix D
Glossary
Terms Used in EDK
B
BBD file
Black Box Definition file. The BBD file lists the netlist files used by a
peripheral.
BFL
Bus Functional Language.
BFM
Bus Functional Model.
BIT File
Xilinx Integrated Software Environment (ISE) Bitstream file.
BitInit
The Bitstream Initializer tool. It initializes the instruction memory of
processors on the FPGA and stores the instruction memory in
BlockRAMs in the FPGA.
block RAM
A block of random access memory built into a device, as distinguished
from distributed, LUT based random access memory.
BMM file
Block Memory Map file. A Block Memory Map file is a text file that has
syntactic descriptions of how individual Block RAMs constitute a
contiguous logical data space. Data2MEM uses BMM files to direct the
translation of data into the proper initialization form. Since a BMM file
is a text file, it is directly editable.
Appendix D: Glossary
BSB
Base System Builder. A wizard for creating a complete EDK design.
BSB is also the file type used in the BSB Wizard.
BSP
Board Support Package.
C
CFI
Common Flash Interface
D
DCM
Digital Clock Manager
DCR
Device Control Register.
DLMB
Data-side Local Memory Bus. See also: LMB
DMA
Direct Memory Access.
DOPB
Data-side On-chip Peripheral Bus. See also: OPB
DRC
Design Rule Check.
E
EDIF file
Electronic Data Interchange Format file. An industry standard file
format for specifying a design netlist.
EDK
Embedded Development Kit.
ELF file
Executable Linked Format file.
EMC
Enclosure Management Controller.
EST
Embedded System Tools.
F
FATfs (XilFATfs)
LibXil FATFile System. The XilFATfs file system access library
provides read/write access to files stored on a Xilinx SystemACE
CompactFlash or IBM microdrive device.
Flat View
Flat view provides information in the Name column of the IP Catalog
and System Assembly Panel as directly visible and not organized in
expandable lists.
FPGA
Field Programmable Gate Array.
FSL
MicroBlaze Fast Simplex Link. Unidirectional point-to-point data
streaming interfaces ideal for hardware acceleration. The MicroBlaze
processor has FSL interfaces directly to the processor.
G
GDB
GNU Debugger.
GPIO
General Purpose Input and Output. A 32-bit peripheral that attaches
to the on-chip peripheral bus.
H
Hardware Platform
Xilinx FPGA technology allows you to customize the hardware logic
in your processor subsystem. Such customization is not possible using
standard off-the-shelf microprocessor or controller chips. Hardware
platform is a term that describes the flexible, embedded processing
subsystem you are creating with Xilinx technology for your
application needs.
Appendix D: Glossary
HDL
Hardware Description Language.
Hierarchical View
This is the default view for both the IP Catalog and System Assembly
panel, grouped by IP instance. The IP instance ordering is based on
classification (from top to bottom: processor, bus, bus bridge,
peripheral, and general IP). IP instances of the same classification are
ordered alphabetically by instance name. When grouped by IP, it is
easier to identify all data relevant to an IP instance. This is especially
useful when you add IP instances to your hardware platform.
I
IBA
Integrated Bus Analyzer.
IDE
Integrated Design Environment.
ILA
Integrated Logic Analyzer.
ILMB
Instruction-side Local Memory Bus. See also: LMB
IOPB
Instruction-side On-chip Peripheral Bus. See also: OPB
IPIC
Intellectual Property Interconnect.
IPIF
Intellectual Property Interface.
ISA
Instruction Set Architecture. The ISA describes how aspects of the
processor (including the instruction set, registers, interrupts,
exceptions, and addresses) are visible to the programmer.
ISC
Interrupt Source Controller.
ISE File
Xilinx ISE Project Navigator project file.
ISOCM
Instruction-side On-Chip Memory.
ISS
Instruction Set Simulator.
J
JTAG
Joint Test Action Group.
L
Libgen
Library Generator sub-component of the Xilinx Platform Studio
technology.
LMB
Local Memory Bus. A low latency synchronous bus primarily used to
access on-chip block RAM. The MicroBlaze processor contains an
instruction LMB bus and a data LMB bus.
M
MDD file
Microprocessor Driver Description file.
MDM
Microprocessor Debug Module.
MFS file
LibXil Memory File System. The MFS provides user capability to
manage program memory in the form of file handles.
MHS file
Microprocessor Hardware Specification file. The MHS file defines the
configuration of the embedded processor system including
buses,peripherals, processors, connectivity, and address space.
MLD file
Microprocessor Library Definition file.
Appendix D: Glossary
MOST
Media Oriented Systems Transport. A developing standard in
automotive network devices.
MPD file
Microprocessor Peripheral Definition file. The MPD file contains all of
the available ports and hardware parameters for a peripheral.
MSS file
Microprocessor Software Specification file.
MVS file
Microprocessor Verification Specification file.
N
NGC file
The NGC file is a netlist file that contains both logical design data and
constraints. This file replaces both EDIF and NCF files.
NGD file
Native Generic Database file. The NGD file is a netlist file that
represents the entire design.
NCF file
Netlist Constraints file.
NGO File
A Xilinx-specific format binary file containing a logical description of
the design in terms of its original components and hierarchy.
NPI
Native Port Interface.
NPL File
Xilinx Integrated Software Environment (ISE) Project Navigator
project file.
O
OCM
On Chip Memory.
OPB
On-chip Peripheral Bus.
P
PACE
Pinout and Area Constraints Editor.
PAO file
Peripheral Analyze Order file. The PAO file defines the ordered list of
HDL files needed for synthesis and simulation.
PBD file
Processor Block Diagram file.
Platgen
Hardware Platform Generator sub-component of the Platform Studio
technology.
PLB
Processor Local Bus.
PROM
Programmable ROM.
PSF
Platform Specification Format. The specification for the set of data
files that drive the EDK tools.
S
SDF file
Standard Data Format file. A data format that uses fields of fixed
length to transfer data between multiple programs.
SDK
Software Development Kit.
Appendix D: Glossary
SDMA
Soft Direct Memory Access
Simgen
The Simulation Generator sub-component of the Platform Studio
technology.
Software Platform
A software platform is a collection of software drivers and, optionally,
the operating system on which to build your application. Because of
the fluid nature of the hardware platform and the rich Xilinx and
Xilinx third-party partner support, you may create several software
platforms for each of your hardware platforms.
SPI
Serial Peripheral Interface.
Standalone Library
Standalone library. A set of software modules that access processor-
specific functions.
SVF File
Serial Vector Format file.
U
UART
Universal Asynchronous Receiver-Transmitter.
UCF
User Constraints File.
V
VHDL
VHSIC Hardware Description Language.
X
XBD File
Xilinx Board Definition file.
XCL
Xilinx CacheLink. A high performance external memory cache
interface available on the MicroBlaze processor.
Xilkernel
The Xilinx Embedded Kernel, shipped with EDK. A small, extremely
modular and configurable RTOS for the Xilinx embedded software
platform.
XMD
Xilinx Microprocessor Debugger.
XMP File
Xilinx Microprocessor Project file. This is the top-level project file for
an EDK design.
XPS
Xilinx Platform Studio. The GUI environment in which you can
develop your embedded design.
XST
Xilinx Synthesis Technology.
Z
ZBT
Zero Bus Turnaround.
Appendix D: Glossary