Using the command line tools

The following section shows how to build a simple example program from the command line. This example will print a message on the console and flash an LED on the XK-EVK-XU316 board. On other boards with the xcore.ai device it will print the message on the console but the LEDs may not flash.

It uses the XMOS build system. See the Hello World Example for details on the file structure and content required to describe and build a project.

Copy the example

  1. Browse to the installation directory of the XTC Tools, for example C:\Program Files\XMOS\XTC\15.3.1\

  2. Browse to the subsirectory examples

  3. Copy the sub-directory ExampleXCommonCMake to a temporary working directory

Open a console

Open an XTC Tools Command Prompt

All the following commands must be entered in this console.

Use a shell in which the XTC Tools have been setup for command line usage

All the following commands must be entered in this console.

Use a shell in which the XTC Tools have been setup for command line usage

All the following commands must be entered in this console.

Build the example

The example is built using the XMOS build system, and this will produce a binary file with the .xe extension in the bin subdirectory. This binary file will be used by XTC Tools to run the built example on the target.

  1. Change directory to the copied ExampleXCommonCMake directory

  2. Type

    $ cmake -G "Unix Makefiles" -B build
    $ xmake -C build
    

This will create an executable package file (with the extension .xe) in the subdirectory bin\example.xe. This will be used in the following steps.

Run the example

This will use the program xrun to load the example into volatile memory on the target and lunach it. If the target is power-cycled the program will need to be launched again.

Connect a single XK-EVK-XU316 target board to the host computer using two USB A to micro-B cables.

  1. Type

    $ xrun --io bin\example.xe
    
  2. A message will be printed on the console and the LEDs on the target board will flash

  3. Press Ctrl-C to stop the program and return the command prompt

Program the example into non-volatile flash memory

This step will use xflash to commit the program to non-volatile flash memory so it is started when the target is power-cycled. Note the console message will not be printed.

  1. Type

    $ xflash --io bin\example.xe
    
  2. The LEDs on the target board will flash

  3. Power-cycle the target board (by disconnecting and re-connecting the USB cables)

  4. The LEDs on the target board will flash