NOTICE: This website will be shut down in the near future. Product content has moved to nxp.com. Forum content and FAQs have been moved to community.nxp.com. We encourage you to create a user account on nxp.com to use the new community forums and access NXP microcontroller content. We greatly appreciate your contributions and look forward to seeing you at our new web location.

 

Build Macros

lpcxpresso-support's picture

A list of available Build Macros (variables) can be found by

  • selecting the project
  • opening its properties
  • Select C/C++ Build
  • Click on Build Variables
  • ensure Show system variables is checked

File-specific macros

The set of file-context macros is predefined by the Managed Build System (MBS). Neither a tool-integrator nor a user can define new file-context macros.

Macro

Value Type

Description

${InputFileName}

Text

Represents the input file name. The input file has the following meaning:

If a tool does not accept building multiple files of the primary input type with one tool invocation, the input file is the file of the primary input type being built.

If a tool accepts building multiple files of the primary input type with one tool invocation the input file is undefined and the macros representing the input file contain information about one of the inputs of the primary input type being built.

${InputFileExt}

Text

Represents the extension of the input file.

${InputFileBaseName}

Text

Represents the base name of the input file. That is the file name with an extension stripped.

${InputFileRelPath}

Path(File)

Represents the input file path relative to the builder current directory.

${InputDirRelPath}

Path(Dir)

Represents the input file directory path relative to the builder current directory.

${OutputFileName}

Text

Represents the output file name. The output file has the following meaning:

1.If a tool is not capable of producing multiple files of the primary output type with one tool invocation the output file is the file of the primary output type that is built with a given tool invocation.

2.If a tool is capable of producing multiple files of the primary output type with one tool invocation the output file is undefined and the macros representing the output file contain information about one of the files of the primary output type that are built with a given tool invocation.

${OutputFileExt}

Text

Represents the output file extension.

${OutputFileBaseName}

Text

Represents the output file base name. That is the output file name with an extension stripped.

${OutputFileRelPath}

Path(File)

Represents the output file path relative to the current builder directory.

${OutputDirRelPath}

Path(Dir)

Represents the output file directory path relative to the current builder directory.

 Configuration-specific macros

Macro

Value Type

Description

${ConfigName}

Text

Represents the name of a given configuration.

${ConfigDescription}

Text

Represents the description of a given configuration.

${BuildArtifactFileName}

Text

Represents the name of the build artifact.

${BuildArtifactFileExt}

Text

Represents the extension of the build artifact.

${BuildArtifactFileBaseName}

Text

Represents the base name of the build artifact.

${BuildArtifactFilePrefix}

Text

Represents the prefix of the build artifact.

${TargetOsList}

Text-List

Represents the list of the target OS names.

${TargetArchList}

Text-List

Represents the list of the target Arch names.

Project-specific macros

${ProjName}

Text

Represents the name of a given project.

${ProjDirPath}

Path(Dir)

Represents the absolute path of a given project.

Workspace-specific macros

${WorkspaceDirPath}

Path(Dir)

Represents the workspace absolute path.

${DirectoryDelimiter}

Text

Represents the directory delimiter used on the system. That is the “\? for Win32 systems and the “/? for Unix-like systems

This could be useful, e.g. in the case a user needs the absolute path of an input file. The absolute path would be represented in the following way: ${CWD}${DirectoryDelimiter}${InputFileRelPath}

${PathDelimiter}

Text

Represents the default path delimiter used on the system to separate paths in the path environment variables. That is the “;? for Win32 systems and the “:? for Unix-like systems

This might be used in the environment variable definitions

CDT/Eclipse installation-specific macros

${EclipseVersion}

Text

Represents the current Eclipse version.

${CDTVersion}

Text

Represents the current CDT version.

${MBSVersion}

Text

Represents the current MBS version.

${HostOsName}

Text

Represents the operating system name on which eclipse is running.

${HostArchName}

Text

Represents the architecture name on which eclipse is running.

${env_var:ENV_VAR}

Text

Replaces the macro with the value of the environment variable ENV_VAR

LPCXpresso specific macros

${TargetChip}

Text

Represents the name of the MCU, for example LPC1768.

${TargetProc}

Text

Represents the name of the CPU, for example cortex-m3.

${TargetVendor}

Text

Represents the name of the vendor, for example NXP.

Usage


These are typically used in Pre- and Post- Build steps. For example, a Post-Build step to copy the built file to a fixed location:

cp ${BuildArtifactFileName} c:\temp;

Another example is to convert the executable file into a binary file:

arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin ;
 

For more information on post build step, please see the FAQ Post-processing your linked application

Links


More information can be found on Build Macros can be found at: http://publib.boulder.ibm.com/infocenter/rsahelp/v7r0m0/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_mprop_macros.htm

 

0
Your rating: None
feedback