Select a Target

embedXcode includes six targets and embedXcode+ eleven.

The targets for embedXcode (left) and embedXcode+ (right)

  • All cleans the files from a previous compilation, compiles and links, uploads and opens a serial window in Terminal.

  • Build cleans the files from a previous compilation, compiles and links.

  • Boards lists all the boards with their tags and their names.

  • Serial open the serial console in a Terminal window.

  • Upload uploads the resulting HEX or BIN executable file to the board.

  • Clean erases the files generated from a previous compilation.

  • Fast compiles only the main sketch and the local libraries, links, uploads and opens a serial window in Terminal.

  • Make compiles only the main sketch and the local libraries, and links.

  • Debug compiles only the main sketch and the local libraries, links and uploads them, and opens a debugging session in a Terminal window.

  • Style improves the presentation of the code.

  • Document builds the documentation.

  • Distribute prepares a folder for distribution.

  • Archive prepares archives for the local libraries.

  • Unarchive erases the archives for the local libraries.

The additional target Index is a proxy target solely used for code-sense. Do not launch it.

Compare the Targets

The following table shows the scope of each target:

Target... Cleans Compiles Uploads Opens Terminal Debugs
All
Build
Serial
Upload
Clean
Fast
Make
Debug

For example, the All target cleans, compiles, uploads and opens a Terminal window.

The All and Build targets are recommended for a clean compilation, for example when a user’s library has been changed.

On embedXcode+, an option for the target Fast allows not to open the serial console after the upload of the sketch to the board.

Select a Target

To select a target,

  • Click on the list on the top right of the Xcode window.

  • Then select the target you want.

The targets for embedXcode (left) and embedXcode+ (right)

Once the target is selected,

  • Click on the Run button or press Cmd+B to launch it.

As a matter of fact, I mainly use four of them:

  • Build and Make for developing the code,

  • All and Fast for compiling and uploading the code.

  • Other targets may be useful for specific needs.

Locate the Builds Folder

The Builds folder contains all the files generated during compilation.

For the standard edition of embedXcode, all the files are under the Builds sub-folder of the project.

embedXcode+ relies on the folders managed by Xcode. The full path is provided on the Report Navigator, under the Tools section, /Users/ReiVilo/Library/Developer/Xcode/DerivedData/embed1-fykzaoosymfojzbkmxucgqqixhyu/Build/Products/Debug in the example below.

Use Faster Targets

embedXcode+ offers additional faster targets.

The Make and Fast targets feature an optimisation for the build of the foundation libraries, which include the core, application and user's libraries.

The first time the Make and Fast targets are launched, they build all the foundation libraries into an archive for later reuse.

On their first launch, the Make and Fast targets act exactly the same way as the corresponding Build and All targets.

The second time the Make and Fast targets are launched, they only compile the main sketch and the local libraries, and link them reusing the foundation archive built previously. The Fast target also uploads and opens a serial console in a Terminal window.

So on their second launch, the Make and Fast targets are on average 10 times faster than the corresponding Build and All targets.

For the mbed framework, the library is built the first time and takes about 20 seconds. Second compilation with the Make or Fast takes less than one second.

Use Parallel Build

This section requires embedXcode+.

By default, embedXcode uses one single thread to perform the build and link process. embedXcode+ features parallel build for faster targets, up to four times. Instead of one thread, the parallel build process uses as many threads as cores available.

To enable parallel build,

  • On the Project navigator, select the project on the top of the tree and then the Build target.

  • Select the Info pane and navigate to External Build Tool Configuration.

  • Add -j parameter to the Arguments field.

The impact of parallel build on speed depends on the number of cores of the microprocessor. In the example below, build is up to 3.1 times faster, 7.7 against 24.2 seconds.

Standard build (left) and parallel build (right)

If parallel build is unstable, return to the standard build.

  • To reverse to standard build, just remove the -j parameter.

Manage the Serial Console after Upload

This section requires embedXcode+.

By default, the Fast target opens a serial console in a Terminal window once the sketch has been uploaded to the board.

In case you prefer not to open the serial console,

  • Open the main Makefile.

  • Set the variable NO_SERIAL_CONSOLE in the main Makefile to true.

# Serial console for Fast target
# ----------------------------------
# For Fast target, open serial console, false or true
#
NO_SERIAL_CONSOLE = true
  • Otherwise, comment the line with a leading #, set the value to false or leave it empty.
#NO_SERIAL_CONSOLE =
NO_SERIAL_CONSOLE = false
NO_SERIAL_CONSOLE =

As an alternative to the serial console on a Terminal window, I recommend CoolTerm . It features a nice graphic interface. 

Other solutions for the serial console with a graphic interface include goSerial , MacWise and ZTerm .

  • Please note the variable NO_SERIAL_CONSOLE option only affects the Fast target. The All and Serial targets aren't concerned.

  • When using an external serial monitor, ensure it is disconnected before proceeding with the upload.

Define Compiler Options

This section requires embedXcode+.

Some project may require additional options.

  • Open the main Makefile and

  • Add the parameters to the variable COMPILER_OPTIONS in the main Makefile.

# Compiler options
# ----------------------------------
#
# If 0 or empty, no additional options
#
COMPILER_OPTIONS = -fpermissive

In this example, -fpermissive has been added.

For more information on the authorised parameters,

  • Please refer to the compiler documentation.