DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Step-By-Step Tutorial: Installing Eclipse IDE
  • Remote Pair Programming with IntelliJ, Eclipse and VS Code
  • AWS Kiro: The Agentic IDE That Makes Specs the Unit of Work
  • 7 Techniques That Supercharged My Claude-Assisted Development

Trending

  • Understanding MCP Architecture: LLM + API vs Model Context Protocol
  • Working With Cowork: Don’t Be Confused
  • Stranger Things in Java: Enum Types
  • The Cost of Knowing: When Observability Becomes the Outage
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Building Eclipse and MCUXpresso IDE Projects From the Command Line

Building Eclipse and MCUXpresso IDE Projects From the Command Line

Love working from the command line? Well, here's how to build your Eclipse IDE projects (specifically MCUXpresso IDE projects) from a command line.

By 
Erich Styger user avatar
Erich Styger
·
Aug. 07, 17 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
10.0K Views

Join the DZone community and get the full member experience.

Join For Free

Eclipse as an IDE takes care of compiling and building all my source files. But in an automated build system, I would like to build it from the command line, too. While using make files (see Tutorial: Makefile Projects with Eclipse) is an option, there is another easy way to build Eclipse projects from the command line:

Building MCUXpresso IDE from Command Line

Building MCUXpresso IDE from the command line

I’m using MCUXpresso 10.0.2 (Eclipse Neon-based with GNU ARM tools) in this article, but the same should work for any other Eclipse version. The principle is to launch Eclipse in ‘headless mode’ using the org.eclipse.cdt.managedbuilder.core.headlessbuild plugin.

Batch File

I’m using the following batch file to do a command line (aka ‘headless’ build) with Eclipse:

# Batch file to build an Eclipse project from the command line on Windows
# Example for using MCUXpresso IDE

# path to GNU tools and compiler: arm-none-eabi-gcc.exe, ....
SET TOOLCHAIN_PATH=C:\nxp\MCUXpressoIDE_10.0.2_411\ide\tools\bin

# variable to the command line Eclipse IDE executable
SET IDE=C:\nxp\MCUXpressoIDE_10.0.2_411\ide\mcuxpressoidec.exe

ECHO Extending PATH if not already present
ECHO %PATH%|findstr /i /c:"%TOOLCHAIN_PATH:"=%">nul || set PATH=%PATH%;%TOOLCHAIN_PATH%

ECHO Launching Eclipse IDE
"%IDE%" -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data "c:\tmp\wsp" -build frdmk64f_rtos_examples_freertos_event


The batch file can be found on GitHub.

It uses the following batch variables:

  • TOOLCHAIN_PATH: path variable to the compiler/linker/etc.
  • IDE: path/name variable of the command line IDE. On Windows, it is the Eclipse executable with a ‘c’ at the end. For Linux, it is the normal Eclipse executable.

Additional variables (or arguments) could be used for the workspace name and project name. The batch file checks if the toolchain path is already present in the PATH. If not, it gets added.

Then it launches the IDE with the following options:

  • -nosplash: do not show splash screen
  • –launcher.suppressErrors: do not show error dialog (e.g. if the workspace is already used)
  • -application org.eclipse.cdt.managedbuilder.core.headlessbuild: launch the IDE in command line/headless mode
  • -data <wsp folder name>: workspace to be used. Can be an empty workspace, but then I have to use the -import or -importAll option to import projects (see options in next section)
  • -build <project name>: build the project

The above builds a single project in a workspace. See the next section or the Links section at the end for other options.

Other Headless Build Options

The complete set of options can be found here:

/**
 * Helper method to process expected arguments
 *
 * Arguments
 *   -import     {[uri:/]/path/to/project}
 *   -importAll  {[uri:/]/path/to/projectTreeURI} Import all projects in the tree
 *   -build      {project_name_reg_ex/config_name_reg_ex | all}
 *   -cleanBuild {project_name_reg_ex/config_name_reg_ex | all}
 *   -I          {include_path} additional include_path to add to tools
 *   -include    {include_file} additional include_file to pass to tools
 *   -D          {prepoc_define} addition preprocessor defines to pass to the tools
 *   -E {var=value} replace/add value to environment variable when running all tools
 *   -Ea {var=value} append value to environment variable when running all tools
 *   -Ep {var=value} prepend value to environment variable when running all tools
 *   -Er         {var} remove/unset the given environment variable
 *   -T          {toolid} {optionid=value} replace a tool option value
 *   -Ta         {toolid} {optionid=value} append to a tool option value
 *   -Tp         {toolid} {optionid=value} prepend to a tool option value
 *   -Tr         {toolid} {optionid=value} remove a tool option value
 *   -no-indexer Disable indexer
 *   -markerType Which markers to consider
 *   -printErrorMarkers Print all error markers that caused build to fail
 *
 * Each argument may be specified more than once
 * @param args String[] of arguments to parse
 * @return boolean indicating success
 */


Summary

With the headless build options, I can use Eclipse to build projects from the command line.

Another option would be to use Eclipse with normal makefile projects. Then I could use make with that makefile (make -f myMakefile.mak). That builds faster because it does not need to start the IDE, but is more work to set up the make files. Otherwise, the IDE headless build is a very good alternative.

Happy commanding!

Links

  • Files on GitHub: https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/MCUXpresso/CmdLineBuild
  • Building Projects with Eclipse from the Command Line
  • Building from the command line: https://community.nxp.com/thread/388962
Integrated development environment Eclipse Command (computing)

Published at DZone with permission of Erich Styger. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Step-By-Step Tutorial: Installing Eclipse IDE
  • Remote Pair Programming with IntelliJ, Eclipse and VS Code
  • AWS Kiro: The Agentic IDE That Makes Specs the Unit of Work
  • 7 Techniques That Supercharged My Claude-Assisted Development

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook