Getting started with XTC 15.3.0 Topic is solved

New to XMOS and XCore? Get started here.
alwalker
Experienced Member
Posts: 70
Joined: Sun Apr 08, 2018 11:19 pm

Getting started with XTC 15.3.0

Post by alwalker »

Hi,

Back working with XMOS after a while...

I've set up XTC 15.3.0 and VS Code with CMake and Task Runner in Windows 11 and can build the ExampleXCommonCmake project. When I select Run example.xe with no xTAG connected, despite what the Tools Guide suggests, the program does not show "Hello World!" in the terminal view and instead terminates with:

xrun: No available XTAGs
xrun: xgdbserver failed to launch correctly, return code 1

* The terminal process "C:\Program Files\XMOS\XTC\15.3.0\bin\xrun.exe '--io', 'C:\Workspace\XMOS\XTC_15.3.0\ExampleXCommonCMake/bin/example.xe'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

The implication is that I need to have a target board connected for the .xe file to run. Is this expected behaviour please?

I note that in CmakeLists.txt that the target hardware is set to:

set(APP_HW_TARGET XK-EVK-XU316)

Is there a list of the other supported target hardware options (boards/ICs) please?

Specifically, whilst I wait on delivery of an XK-AUDIO-316-MC-AB board, can I specify an XC-200 Explorer module as the target please?

Kind regards,

Al
View Solution
alwalker
Experienced Member
Posts: 70
Joined: Sun Apr 08, 2018 11:19 pm

Post by alwalker »

I found that CMakeLists.txt doesn't support c style commenting, is this expected behaviour please?
250107 Comments.png
You do not have the required permissions to view the files attached to this post.
alwalker
Experienced Member
Posts: 70
Joined: Sun Apr 08, 2018 11:19 pm

Post by alwalker »

So checking at the CLI with what the xcc compiler supports:

C:\Workspace\XMOS\XTC_15.3.0\ExampleXCommonCMake>xcc -print-boards
XCORE-200-EXPLORER;xCORE-200 Explorer Kit
XCORE-AI-EXPLORER;xcore.ai Explorer Kit
XK-EVK-XU316;xcore.ai Explorer Kit (XK-EVK-XU316)

This is different to what can be set in CMakeLists.txt as

set(APP_HW_TARGET XCORE-200-EXPLORER)

generates an error
danielp
Member++
Posts: 26
Joined: Tue Jul 16, 2024 9:52 am
Location: Bristol, UK

Post by danielp »

The ExampleXCommonCMake application is written to run either on hardware or using the simulator, however the VS Code task runner definition in tasks.json only defines an xrun command, so hardware must be attached.

If you run the XE using xsim directly on the command line as shown in the README, you should see the expected print of "Hello World!"

However, If you want to do this in VS Code, you will have to modify the task runner in tasks.json to run an xsim command instead of xrun.

Regarding the CMake comment, you can't use C-style comments inside a CMakeLists.txt file. In the CMake language, a comment line begins with '#' - see here (if you're not familiar with the CMake language, there is a lot more on that page, but you shouldn't have to learn much of it - one of the intentions of the XCommon CMake build system is that users should be able to build xcore applications without becoming experts in the CMake language)

Without making other changes to ExampleXCommonCMake, you can't change the target from XK-EVK-XU316 to XCORE-200-EXPLORER. The reason is that the XK-EVK-XU316 target has a defined name PORT_LEDS which is a 4-bit port connected to the LEDs.

I think that port 4F on tile 0 on your XCORE-200-EXPLORER may be connected to the LEDs, so if you modify main.xc so that p_leds uses this port, you should be able to build and run the application on your board (maybe the LEDs will flash, but I only took a brief look at the schematic, so I'm not completely sure that I've got the correct port).
XMOS, Senior Software Engineer
alwalker
Experienced Member
Posts: 70
Joined: Sun Apr 08, 2018 11:19 pm

Post by alwalker »

Hi danielp,

Thanks very much, running ExampleXcommonCMake in xsim produced the expected "Hello Word!"

Also by modifying the CMakeLists.txt to reference XCORE-200-EXPLORER and changing main.xc to port out p_leds = XS1_PORT_4F; I was able to build and run the code on the target hardware and all the LEDs flash as expected.

Kind regards,

Al
alwalker
Experienced Member
Posts: 70
Joined: Sun Apr 08, 2018 11:19 pm

Post by alwalker »

My next step is to build some existing xC applications using the XTC 15.3.0 tool chain. I used the AN00155_-xCORE-200-explorer---Simple-GPIO_1_0_0rc3 example as a starting point, cloning lib_gpio and lib_xassert from the XMOS GitHub Repository into the project folder. Looking at the repository for lib_gpio, the example code shows that the USED_MODULES variable in the Makefile is used to identify the modules to be included in the build, however as the Makefile created by the CMake process explicitly states "CMAKE generated file: DO NOT EDIT!", where are the modules used specified please?

As things stand, cmake -G "Unix Makefiles" -B build runs correctly but xmake -C build terminates with the error that it can't open the include file.
250108_Simple_GPIO.png

Kind regards,

Al
You do not have the required permissions to view the files attached to this post.
danielp
Member++
Posts: 26
Joined: Tue Jul 16, 2024 9:52 am
Location: Bristol, UK

Post by danielp »

Unfortunately, this situation is going to require a little more work. XTC 15.3.0 provides the new XCommon CMake build system and there are many XMOS libraries which support it, but lib_gpio hasn't been updated yet.

I assume you are trying to extend the ExampleXCommonCMake application. If you want to continue with XCommon CMake and this example, you will need to add a file locally in your clone of lib_gpio. To do this, please create the file lib_gpio/lib_gpio/lib_build_info.cmake with the following contents:

Code: Select all

set(LIB_NAME lib_gpio)
set(LIB_VERSION 2.2.0)
set(LIB_INCLUDES api)
set(LIB_COMPILER_FLAGS -O3)
set(LIB_DEPENDENT_MODULES "lib_xassert")

XMOS_REGISTER_MODULE()
Once you have added this file in your lib_gpio clone, please have a look at the XCommon CMake documentation example for module dependencies:
https://www.xmos.com/documentation/XM-0 ... ncies.html
XMOS, Senior Software Engineer
alwalker
Experienced Member
Posts: 70
Joined: Sun Apr 08, 2018 11:19 pm

Post by alwalker »

Hi danielp,

Thanks very much, I added the \lib_gpio\lib_gpio\lib_build_info.cmakefile and amended CMakeLists.txt as follows:

cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(250108_Simple_GPIO)

set(APP_HW_TARGET XCORE-200-EXPLORER)
set(APP_DEPENDENT_MODULES "lib_gpio")
set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR})

XMOS_REGISTER_APP()



I was able to build the project and run it successfully on the target XC-200 Explorer board.

Kind regards,

Al
danielp
Member++
Posts: 26
Joined: Tue Jul 16, 2024 9:52 am
Location: Bristol, UK

Post by danielp »

Excellent! I'm pleased you were able to get this running.

Over time, more XMOS libraries will be released with XCommon CMake support so you won't have to carry this local modification to lib_gpio forever.

The audio libraries generally have better support for this along with the USB Audio software product, so if you want to build an audio application when you get your XK-AUDIO-316-MC-AB board, I think you will have a smoother development experience.
XMOS, Senior Software Engineer