Prepare the Project

Prepare the Project

The template doesn't define all the parameters, so the newly created project needs to be prepared.

This is done automatically during the first compilation.

  • Select one target, as Build or Make

  • Call the menu Product > Build or press Cmd+B or click on the Run icon.

The automatic procedure provides an easy way to:

  • Declare .pde or .ino file as C++ code for code-sense,

  • Define the directory for the targets,

  • Add all the cores, variants and libraries from the installed platforms under the group Reference for code-sense,

  • Add the user’s libraries for the selected platform under the group Sketchbook for code-sense,

  • Declare all the files of the project for code-sense.

  • Enter the password of the Arduino Yún board if connected through Ethernet or WiFi.

The automatic procedure is only launched once, so the manual procedures are detailed in the next section.

The manual procedures Declare Sketch .pde or .ino File as C++ File , Define the Directories for the Targets , Declare Sources for Code-Sense and Add User's Libraries are no longer required.

The manual procedure Declare User's Sketchbook is optional.

  • When removing files from the Resources group, always select Remove References and not Move to Trash.

The option Remove References only removes the reference from the Xcode project while the option Move to Trash deletes the original file.

Launch the Procedure

To proceed with the automatic configuration procedure,

  • Select any target, as Build or Make.

  • Check no other process is running on Xcode, like indexing or firewall scan.

Just after the launch of Xcode, the process socketfilterfw takes almost all the CPU. The macOS firewall scans the entire Xcode application.

  • Wait for this process to be completed.

  • Call the menu Product > Build or press Cmd+B or click on the Run icon.

The utility starts and prepares the project.

  • Please note the user’s libraries are taken from the platform corresponding to the board selected during the creation of the new project.

In this example, the LaunchPad with MSP430G2553 board was selected for the new project, and the corresponding platform is Energia.

The sketchbook folder is defined in the Energia preferences, and the user’s libraries are under the libraries or Libraries folder.

==== Prepare project embed1 ====
Project found: /Users/ReiVilo/Documents/Projets/Xcode/embed1/embed1.xcodeproj
Sketchbook found: /Users/ReiVilo/Documents/Projets/Energia/Libraries
---- Core, application and user libraries ----
Energia MSP430 release 1.0.2:   287 files
Energia CC1300 EMT release 4.9.1:   1175 files
Energia CC3200 release 1.0.2:   260 files
Energia CC3200 EMT release 1.0.0:   260 files
Energia MSP432 EMT release 3.8.0:   483 files
Energia MSP432 Red EMT release 4.9.1:   601 files
Energia Tiva C release 1.0.2:   344 files
Energia libraries : 84 files
Sketchbook  :   680 files
---- 4174 libraries collected ----
Build file section updated
File reference section updated
Group section updated
Sources build phase section updated
Libraries listed in makefile
==== Project embed1 prepared ====

A notification confirms the project has been prepared.

The process of preparing the project and then indexing the files for code-sense takes a while and is intensive.

The following message may appear if there are too many folders and libraries. In such a case, some user’s libraries may be missing as they are parsed after the core and application libraries.

WARNING Libraries overflow reached

To learn more about code-sense,

  • Please refer to the section Use Code-Sense and to the Xcode general help.

Customise the Fonts and Colours

The colours are customised on the Fonts & Colours pane available on the preferences.

To modify the colours of code-sense,

  • Call the menu Xcode > Preferences or press Cmd+,.

  • Select the Fonts & Colours pane.

List the Updated Parameters

Here’s the list of the parameters updated during the automatic preparation procedure, with the corresponding manual procedures:

  • The .pde or .ino files are declared as C++ code for code-sense.

Before and after

The corresponding manual procedure is detailed at Declare Sketch .pde or .ino File as C++ File .

  • The directories for the targets are set to allow the click-to-error.

Before

After

The corresponding manual procedure is detailed at Define the Directories for the Targets .

  • A new Resources group is created and includes all the cores, variants and libraries of the installed platforms.

Before and after

Here’s the detail for each platform:

Arduino 1.0 Arduino 1.5
Cosa Digistump
Energia Intel Galileo
Light Blue Little Robot Friends
Maple mbed
Microduino chipKIT
RedBear RFduino
Robotis Particle
Wiring Teensy
  • All the libraries for the selected platform are under the Sketchbook group.

For embedXcode,

Before and after

For embedXcode+,

Before and after

The corresponding manual procedure is detailed at Add User’s Libraries .

  • Additionally, the makefiles are updated with the type makefile.

Before and after

The corresponding manual procedure is the same as Declare Sketch .pde or .ino File as C++ File .

  • All the sources for code-sense are declared.

The corresponding manual procedure is detailed at Declare Sources for Code-Sense .

  • Finally, all the libraries are listed in the main Makefile for an easier management.

You're ready now!

Change the Path for Standard IDEs

This section requires embedXcode+.

By default, the folder where the standard IDEs are installed and located is the /Applications folder.

However, if all the IDEs are installed on another folder,

Alternatively, on a project basis, for example with the IDEs located on the /Applications/IDE folder,

  • Open the main Makefile of the project.

  • Uncomment the line APPLICATIONS_PATH.

  • Set the variable APPLICATIONS_PATH to /Applications/IDE in the main Makefile.

It is important to always specify the full path with a leading /.

APPLICATIONS_PATH = /Applications/IDE

In case embedXcode doesn't find the standard IDEs, an error message is displayed during compilation.

Please note all the standard IDEs must be in the same folder.

Download New Release

During the first compilation of the project, a dialog box appears if a new release of embedXcode is available.

The dialog box closes automatically after 5 seconds.

  • Click on Go to Download to download the new release or Ignore to ignore it.

  • Proceed with the installation of the new release as per the Install embedXcode procedure.

This procedure downloads and installs the new release of the template. New projects created after the update uses the new template. Existing projects are not updated with the new template.

If such message appears just after creating a new project, the best solution is to close the project and create a new one with the same name to use the latest revision of the template.

To update the other projects with the new template, open each project and launch a compilation; a dialog asks for updating the project.

For more details,

Enter Yún Password

This section requires embedXcode+.

The Arduino Yún board allows to use an over-the-air connection through Ethernet or WiFi for the upload and console. The connection is protected by a password defined during the installation of the board.

In the Arduino IDE, the Arduino Yún board appears with its IP address on the Tools > Port menu.

For more information about the Arduino Yún installation and over-the-air upload,

On embedXcode+,

  • Select the Arduino Yun (WiFi Ethernet) board among the other boards.

A message box asks for the password:

  • Enter the password of the Arduino Yún board.

  • Click on OK to validate or Cancel to cancel.

When validated, the password is saved on the board configuration file Arduino Yun (WiFi Ethernet) in the project.

Please note the password is not encrypted. The password is only asked once.

  • To erase the password, just delete the corresponding line.

Similarly, you can add or edit the password directly after the YUN_PASSWORD variable.

Set Options for Teensy

This section requires embedXcode+.

The Tools menu on the Teensyduino IDE provides additional options for setting the CPU Speed and Optimisation Option, as well as the USB Type and the Keyboard Layout.

Set CPU Speed and Optimisation

The CPU speed and optimisation options are listed under the Tools > CPU Speed menu on the Teensyduino IDE.

On embedXcode+, those options are defined with the two variables TEENSY_F_CPU and TEENSY_OPTIMISATION on the main Makefile.

Those two lines are commented and, by default, the CPU speed is set to 96000000 or 48000000 or 16000000 according to the selected board, and optimisation to -Os.

To change those parameters on embedXcode,

  • Open the main Makefile, and

  • Set the variable TEENSY_F_CPU to the desired speed, 48000000 in the example.

  • Set the variable TEENSY_OPTIMISATION to the desired options, -Os in the example.

Be sure to select a valid CPU speed and a valid optimisation option. The makefile lists the available options for both variables.

Set USB Type and Keyboard Layout

The USB type options are listed under the Tools > USB Type menu.

The keyboard layout options are listed under the Tools > Keyboard Layout menu.

On embedXcode+, those options are defined with the two variables TEENSY_USB and TEENSY_LAYOUT on the main Makefile.

Those two lines are commented and, by default, the USB type is set to USB Serial and the keyboard layout to US English.

To change those parameters on embedXcode,

  • Open the main Makefile, and

  • Set the variable TEENSY_USB to the desired type, USB_SERIAL in the example.

  • Set the variable TEENSY_LAYOUT to the desired layout, LAYOUT_US_ENGLISH in the example.

  • Be sure to select a valid USB type and a valid keyboard layout. The makefile lists the available options for both variables.