emBuild is a program used to build your software from the command line without using SEGGER Embedded Studio. You can, for example, use emBuild for nightly (automated) builds, production builds, and batch builds.

Building with a SEGGER Embedded Studio project file

You can specify a SEGGER Embedded Studio project file:

Syntax

emBuild [options…] project-file

You must specify a configuration to build using -config. For instance:

emBuild -config "V5T Thumb LE Release" arm.emProject 

The above example uses the configuration V5T Thumb LE Release to build all projects in the solution contained in arm.emProject.

To build a specific project that is in a solution, you can specify it using the -project option. For example:

emBuild -config "V5T Thumb LE Release" -project "libm" libc.emProject 

This example will use the configuration V5T Thumb LE Release to build the project libm that is contained in libc.emProject.

If your project file imports other project files (using the <import…> mechanism), when denoting projects you must specify the solution names as a comma-separated list in parentheses after the project name:

emBuild -config "V5T Thumb LE Release" -project "libc(C Library)" arm.emProject 

libc(C Library) specifies the libc project in the C Library solution that has been imported by the project file arm.emProject.

To build a specific solution that has been imported from other project files, you can use the -solution option. This option takes the solution names as a comma-separated list. For example:

emBuild -config "ARM Debug" -solution "ARM Targets,EB55" arm.emProject 

In this example, ARM Targets,EB55 specifies the EB55 solution imported by the ARM Targets solution, which was itself imported by the project file arm.emProject.

You can do a batch build using the -batch option:

emBuild -config "ARM Debug" -batch libc.emProject 

This will build the projects in libc.emProject that are marked for batch build in the configuration ARM Debug.

By default, a make-style build will be done—i.e., the dates of input files are checked against the dates of output files, and the build is avoided if the output is up to date. You can force a complete build by using the -rebuild option. Alternatively, to remove all output files, use the -clean option.

To see the commands being used in the build, use the -echo option. To also see why commands are being executed, use the -verbose option. You can see what commands will be executed, without executing them, by using the -show option.

Building without a SEGGER Embedded Studio project file

To use emBuild without a SEGGER Embedded Studio project, specify the name of an installed project template, the name of the project, and the files to build. For example:

emBuild -config … -template LM3S_EXE -project myproject -file main.c 

Or, instead of a template, you can specify a project type:

emBuild -config … -type "Library" -project myproject -file main.c 

You can specify project properties with the -property option:

emBuild … -property Target=LM3S811 
Options:
Option Description
-batch batch build
-clean remove all output and intermediate files
-config 'name' (batch) build in 'name' configuration
-D 'name'='value' set global macro $('name') to 'value'
-echo show command lines as they are executed
-export-build show the command lines and dependencies
-file 'name' add file 'name' to template-created project
-help show help text
-keepgoing keep building when errors occur
-nostderr redirect output from stderr to stdout
-nounity disable unity building
-packagesdir 'name' set $(PackagesDir) to 'name'
-project 'name' (batch) build 'name' project
-property 'name'='value' set project property 'name' to 'value'
-rebuild always do the build steps
-sconfig 'name' solution properties are set in 'name' configuration
-show show the build steps but don't execute them
-solution 'name' (batch) build 'name' solution
-sproperty 'name'='value' set solution property 'name' to 'value'
-studiodir 'name' set $(StudioDir) to 'name'
-template 'name' create the project from the template 'name'
-templatesfile 'path' get project template files from 'path'
-threadnum 'n' use 'n' threads for build
-time show time taken
-type 'type' create the project from the project 'type'
-verbose show build information