Build and upload¶
To build and upload a project,
- Select the target All or Fast.
- Press the button Run or press Cmd+B.
The sketch is going to be built and linked, and the resulting executable uploaded to the board and open.
At the end, the Terminal application opens a serial console.
Customise the serial port¶
The serial port is used for the upload of the sketches and for the console.
By default, embedXcode uses the names of the serial port defined in the board configuration file and set the speed to 9600 for the serial console.
Both parameters can be changed.
Change the upload serial port¶
Each platform has a different implementation of the USB port naming. Arduino uses the physical USB port of the Mac while each LaunchPad has a unique port name.
Now, two issues may appear:
Some USB hubs change the USB port names.
When Mac goes to sleep and then wakes up, USB ports are enumerated with an different name.
In either case, the following error message is displayed when trying to upload.
As a solution,
- Open the main
Makefileand uncomment the line
BOARD_PORTby removing the leading
#BOARD_PORT = /dev/tty.usbmodem1* BOARD_PORT = /dev/tty.usbmodem1*
- Edit the line and either specify a more general name.
BOARD_PORT = /dev/tty.usbmodem*.
- Or enter the specific USB port name of the board.
BOARD_PORT = /dev/tty.usbmodem1403
To know the USB port name of the active board, proceed as follow:
Launch a Terminal window
Plug the board on the USB port.
Run the following command and note the name of the port.
$ ls /dev/tty.usb* /dev/tty.usbmodem1403
Change the serial console speed¶
By default, the speed of the serial console is 9600. To change the speed,
Open the main
Uncomment the line
SERIAL_BAUDRATEand set the desired speed.
# SERIAL_BAUDRATE for the serial console, 9600 by default # Uncomment and specify another speed # SERIAL_BAUDRATE = 19200
Change the optimisation options¶
By default, the optimisation options are set to standard. To change them,
Open the main
Uncomment the line
OPTIMISATIONand set the desired options.
# OPTIMISATION for the optimisation and debugger levels # Uncomment and specify another options # OPTIMISATION = -O0 -g3
Select among two Arduino connected boards¶
This section requires the embedXcode+ edition.
In case two similar boards are connected, for example two Arduino boards, a windows lists the connections and ask to select one:
The first port is the default option.
To select the default port, press Enter, click on the button 1 or wait 10 seconds.
To select the second port, click on the button 2.
The following message is added to the Log navigator:
==== 2 ports available ==== 1: /dev/tty.usbmodem1411 2: /dev/tty.usbmodem1421 ==== /dev/tty.usbmodem1411 port selected ====
This feature works with the Arduino boards and the boards using a serial through USB connection.
It is not available for the LaunchPads, as they use a different management that combines different services under a single USB port.
Display the Report Navigator¶
The Report Navigator provides information about the compilation and the size of the final binary file.
- To display the Report Navigator, call the menu View > Navigators > Show Report Navigator, or press Cmd+8 or click on the rightmost icon.
The Report Navigator provides the detail of the whole process.
Once compilation is completed, the Report Navigator displays the total size of the sketch on the flash memory and an estimation of the RAM usage.
It also provides the elapsed time spent for building and linking.
---- Size ---- Binary sketch size: 880 bytes (of a 16384 byte maximum) Estimated SRAM used: 22 bytes (of a 512 byte maximum) Elapsed time: 0.3 s ==== Make done ====
The embedXcode+ edition provides additional information with remaining free memory and percentages.
---- Size ---- Estimated Flash: 880 bytes used (5.3% of 16384 maximum), 15504 bytes free (94.7%) Estimated SRAM: 22 bytes used (4.2% of 512 maximum), 490 bytes free (95.8%) Elapsed time: 1.1 s ==== Make done ====
Display the serial console on a Terminal window¶
If the target All or Fast is selected, once the sketch is built, linked and uploaded to the board, the Terminal application opens a serial console with the
To launch the serial console in a Terminal window,
- Select the target Serial.
- Click on Run.
macOS may ask for permission.
- Click on OK.
The serial console is bi-directional: it displays data sent by the board on the Terminal window, and sends data typed in the Terminal window to the board.
For more information on the
- Please refer to the official Screen User's Manual .
To close the serial connection,
- Use the Ctrl+A Ctrl+K key sequence.
- Then press Y to confirm.
Otherwise, the USB port is no longer listed. This is a bug on the USD drivers with macOS .
For the moment, the serial console isn't displayed on the debug pane in the main Xcode window.
On the embedXcode+ edition, an option allows not to open the serial console after the upload.
- Please refer to the procedure at the section Manage the serial console after upload .