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¶
Browse to the installation directory of the XTC Tools, for example
C:\Program Files\XMOS\XTC\15.3.1\
Browse to the subsirectory
examples
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.
Change directory to the copied
ExampleXCommonCMake
directoryType
$ 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.
Type
$ xrun --io bin\example.xe
A message will be printed on the console and the LEDs on the target board will flash
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.
Type
$ xflash --io bin\example.xe
The LEDs on the target board will flash
Power-cycle the target board (by disconnecting and re-connecting the USB cables)
The LEDs on the target board will flash