CMSIS-Build  
Tools, software frameworks, and work flows for productivity with CMSIS based projects
 All Pages
/cprj/target

This element describes the hardware target, build output and command line options for a specific compiler tool-chain. These settings are applied to all modules of the project. The C/C++ and assembler flags can be refined for components, files. The following elements are available:

  • output : Build output options
  • includes : List of include paths
  • defines : List of preprocessor definitions
  • cflags : C compiler options applied to C modules (category="sourceC").
  • cxxflags : C++ compiler options applied to C++ modules (category="sourceCpp").
  • asflags : Assembler options applied to Assembler modules (category="sourceAsm").
  • ldflags : Linker options applied when output attribute type="exe".
  • arflags : Archiver options applied to Librarian when output attribute type="lib".

Note: The compiler referenced by the above command line flags is required to be listed in the <compilers> section.

Example target section:

<cprj xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CPRJ.xsd"/>
...
<compilers>
<compiler name="AC5" version="5.6.0"
</compilers>
...
<target Dname="ARMCM0" Dvendor="ARM:82" Dendian="Little-endian">
<output name="Blinky" type="exe" outdir="./Objects intdir="./Listings"/>
<includes>./path/to/header/files</includes>
<defines>DEF1=1;DEF2=2</defines>
<cflags compiler="AC5" add="-Osize"/>
...
<ldflags compiler="AC5" file="./RTE/Device/ARMCM0/gcc_arm.ld"/>
</target>
...
</cprj>


Parents Element Chain
cprj /cprj
Attributes Description Type Use
Bvendor Board vendor name. Either a board vendor and board name with optional board revision, or a device vendor and a device name. xs:string optional
Bname SPecify the board name. Either a board vendor and board name with optional board revision, or a device vendor and a device name. xs:string optional
Bversion Board version. Either a board vendor and board name with optional board revision, or a device vendor and a device name. xs:string optional
Dvendor Device vendor name. Either a board vendor and board name with optional board revision, or a device vendor and a device name. xs:string optional
Dname Device name. Either a board vendor and board name with optional board revision, or a device vendor and a device name. xs:string optional
Pname Processor instance name. In case of multi-processor devices, this processor ID is required. xs:string optional
Dfpu Selects the floating point unit option that is active for the project. Note, even if the device implements an FPU, setting Dfpu=0 here, will disable FPU code generation. Use predefined values from the table Device FPU. DfpuEnum optional
Dendian Selects the endianness to be used for the project. Note that selecting an endianness that is not supported by the device, will result in a build that will not run on the device. Use predefined values from the table DendianEnum. DendianEnum optional
Dmpu Selects the memory protection unit to be enabled or disabled for the project. Use predefined values from the table Device MPU. DmpuEnum optional
Dsecure Selects the software model for code generation on arm TrustZone-M enabled devices. Use predefined values from the table Dsecure DsecureEnum optional
Dmve Selects the code generation to utilize the Corex-M Vector Extensions (MVE) on devices with this features Use predefined values from the table Dmve DmveEnum optional
Child Elements Description Type Occurrence
output Configure the build output name and type, and specify whether to include debug information. Required if type="exe". OutputType 1..1
includes List of include paths xs:string 0..1
defines List of preprocessor definitions xs:string 0..1
ldflags Linker flags used for constructing the effective linker command line LinkerFlagsType 0..1
arflags Archiver command line flags for the toolchain selected by 'compiler' attribute. ArchiverFlagsType 0..1
cflags Compiler flags for C-modules used for constructing the effective compiler command line ToolOptionType 0..1
cxxflags Compiler flags for C++ modules used for constructing the effective compiler command line ToolOptionType 0..1
asflags Assembler flags for assembler modules used for constructing the effective assembler command line ToolOptionType 0..1
arflags Archiver flags for the archiver which creates library files. Constructing the effective assembler command line ToolOptionType 0..1

 


/cprj/target/output

Specify the build output directories, output file and type (executable vs. library).

Example output element

<cprj ...>
...
<target Dname="ARMCM0" Dvendor="ARM:83">
<output compiler="AC5" name="MyProject" type="exe" intdir="Listings" outdir="Objects"/>
...
</target>
...
</cprj>


Parents Element Chain
/cprj/target target /cprj/target
Attributes Description Type Use
name Name of the build output file to be generated. xs:string required
type Select the build target to be lib - library or exe - executable CompilerOutputType required
intdir Relative path of the folder containing intermediate files (such as object files). xs:string optional
outdir Relative path of the output folder containing the executable binaries. xs:string optional

 


/cprj/target/includes

This element specifies a semicolon separated list of include paths that are valid for the compilation of all modules in the project.

Example includes element

<cprj ...>
...
<target Ddsp="NO_DSP" Dendian="Little-endian" Dfpu="NO_FPU" Dmve="NO_MVE" Dname="LPC4357" Dtz="NO_TZ" Dvendor="NXP:11" Pname="Cortex-M4">
<output intdir="./Debug/" name="BSD_Client" outdir="./Debug/" type="exe"/>
<includes>./path/to/header/files</includes>
</target>
...
</cprj>
Parents Element Chain
target /cprj/target

 


/cprj/target/defines

This element specifies a semicolon separated list of preprocessor definitions that are valid for all project modules undergoing preprocessing. Key/value pairs are separated by the equal sign.

Example defines element

<cprj ...>
...
<target Ddsp="NO_DSP" Dendian="Little-endian" Dfpu="NO_FPU" Dmve="NO_MVE" Dname="LPC4357" Dtz="NO_TZ" Dvendor="NXP:11" Pname="Cortex-M4">
<output intdir="./Debug/" name="BSD_Client" outdir="./Debug/" type="exe"/>
<defines>DEF1=1;DEF2=2</defines>
</target>
...
</cprj>
Parents Element Chain
target /cprj/target

 


/cprj/target/ldflags

This element specifies strings of commandline options for the linker of the tool-chain selected by the attribute 'compiler'. A linker script file shall be specified using the attribute 'file'. Note that this option only takes effect if the type specified in the output tag is set to "exe".

Example ldflags element

<cprj ...>
...
<target Ddsp="NO_DSP" Dendian="Little-endian" Dfpu="NO_FPU" Dmve="NO_MVE" Dname="LPC4357" Dtz="NO_TZ" Dvendor="NXP:11" Pname="Cortex-M4">
<output intdir="./Debug/" name="BSD_Client" outdir="./Debug/" type="exe"/>
<ldflags compiler="AC5" add="--entry=Reset_Handler --load_addr_map_info --map --strict " file="BSD_Client.sct"/>
</target>
...
</cprj>
Parents Element Chain
target /cprj/target
Attributes Description Type Use
compiler selects the compiler the contained information is targeted at. Choose from available list: GCC, AC5, AC6, IAR, Tasking, GHS, Cosmic, G++ CompilerEnumType required
add commandline options to be added to the command line of the respective tool. xs:string optional

 


/cprj/target/arflags

This element specifies a string of commandline options for the archiver of the tool-chain selected by the attribute 'compiler'. Note that this option only takes effect if the type specified in the output tag is set to "lib".

Example arflags element

<cprj ...>
...
<target Ddsp="NO_DSP" Dendian="Little-endian" Dfpu="NO_FPU" Dmve="NO_MVE" Dname="LPC4357" Dtz="NO_TZ" Dvendor="NXP:11" Pname="Cortex-M4">
<output intdir="./Debug/" name="BSD_Client" outdir="./Debug/" type="lib"/>
<arflags compiler="AC5" add="--debug_symbols "/>
</target>
...
</cprj>
Parents Element Chain
target /cprj/target
Attributes Description Type Use
compiler selects the compiler the command line option string is targeted at. Choose from available list: GCC, AC5, AC6, IAR, Tasking, GHS, Cosmic, G++ CompilerEnumType required
add commandline string to be added to the command line of the archiver of the selected compiler tool-chain. xs:string required

 


/cprj/target/cflags

These additional compiler options affect all C modules contained in the project description unless particular settings are 'removed' on a lower level (component, group, file).

Example cflags element

<cprj ...>
...
<target Ddsp="NO_DSP" Dendian="Little-endian" Dfpu="NO_FPU" Dmve="NO_MVE" Dname="LPC4357" Dtz="NO_TZ" Dvendor="NXP:11" Pname="Cortex-M4">
<output intdir="./Debug/" name="BSD_Client" outdir="./Debug/" type="lib"/>
<cflags add="-O1 -fno-function-sections -fno-rtti -fshort-enums -fshort-wchar -funsigned-char"/>
<arflags compiler="AC5" add="--debug_symbols "/>
</target>
...
</cprj>
Parents Element Chain
target /cprj/target
Attributes Description Type Use
compiler selects the compiler the command line option string is targeted at. Choose from available list: GCC, AC5, AC6, IAR, Tasking, GHS, Cosmic, G++ CompilerEnumType required
add commandline string to be added to the command line of the compiler invoked for C-modules specific the selected compiler tool-chain. xs:string required

 


/cprj/target/cxxflags

These additional compiler options affect all C++ modules contained in the project description unless particular settings are 'removed' on a lower level (component, group, file).

Example cxxflags element

<cprj ...>
...
<target Ddsp="NO_DSP" Dendian="Little-endian" Dfpu="NO_FPU" Dmve="NO_MVE" Dname="LPC4357" Dtz="NO_TZ" Dvendor="NXP:11" Pname="Cortex-M4">
<output intdir="./Debug/" name="BSD_Client" outdir="./Debug/" type="lib"/>
<cflags add="-O1 -fno-function-sections -fno-rtti -fshort-enums -fshort-wchar -funsigned-char"/>
<cxxflags add="-O1 -fno-function-sections -fno-rtti -fshort-enums -fshort-wchar -funsigned-char"/>
<arflags compiler="AC5" add="--debug_symbols "/>
</target>
...
</cprj>
Parents Element Chain
target /cprj/target
Attributes Description Type Use
compiler selects the compiler the command line option string is targeted at. Choose from available list: GCC, AC5, AC6, IAR, Tasking, GHS, Cosmic, G++ CompilerEnumType required
add commandline string to be added to the command line of the compiler invoked for C++-modules specific the selected compiler tool-chain. xs:string required

 


/cprj/target/asflags

These additional assembler options affect all Assembler modules contained in the project description unless particular settings are 'removed' on a lower level (component, group, file).

Example asflags element

<cprj ...>
...
<target Ddsp="NO_DSP" Dendian="Little-endian" Dfpu="NO_FPU" Dmve="NO_MVE" Dname="LPC4357" Dtz="NO_TZ" Dvendor="NXP:11" Pname="Cortex-M4">
<output intdir="./Debug/" name="BSD_Client" outdir="./Debug/" type="lib"/>
<asflags add="--xref --split_ldm"/>
<arflags compiler="AC5" add="--debug_symbols "/>
</target>
...
</cprj>
Parents Element Chain
target /cprj/target
Attributes Description Type Use
compiler selects the compiler the command line option string is targeted at. Choose from available list: GCC, AC5, AC6, IAR, Tasking, GHS, Cosmic, G++ CompilerEnumType required
add commandline string to be added to the command line of the assembler invoked for Assembler-modules specific the selected compiler tool-chain. xs:string required
use selects legacy assembler to be invoked in place of the default assembler for a given tool-chain. Currently supported values: armasm (AC6), gas (GCC) xs:string optional