STM32MP157 Target Setup Guide
Before you Begin
Before starting with the setup guide, we recommend the following to get familiar with CGI-Studio:
- Explore CGI-Studio
Watch the Video Tutorials and read the Quick Start Guide. - Learn to create SceneComposer Solutions
The documentation provides instructions on how to create simple SceneComposer solutions. To access SceneComposer navigate to:
<cgi-studio-installation-path>\bin\SceneComposer\SceneComposer.exe Generate Assets for Simulation and Target Environments
You can find guidance on generating assets from solutions (binary files containing solution information for the player) for both simulation and target environments in the documentation.
With this knowledge you should be fit to complete this guide.
Software Image Setup
Please note, that this chapter contains links to an external resource (e.g. ST image and wiki). These links were used by Candera for this guide in December 2024 and might have changed inFlashing the meanwhile.Target Device
Download the official ST targetprepared image fromprovided here:by Candera:STM32MP1Starter - STM32MP1 OpenSTLinux Starter Package - STMicroelectronicsST Image version 3.1.0 must be used for the CGI Professional Edition 3.15 due some API changes in ST image version 4+.FlashLayout_sdcard_stm32mp157f-dk2-opteemin.raw

To
Forflash the image andto hardwarea setupmicro pleaseSD followcard with minimum size of 8GB, use a tool such as Etcher.io. After the officialflashing STprocess guide:STM32MP15is complete, insert the SD card into the STM32MP157 Discovery kitsKit, -then Starterpower Packageon -the stm32mpudevice to boot from the SD card.
Please check that your boot settings are correctly set to boot from the SD card according to the official guide.
PleaseAfter bebooting, awareconnect ofto the target device via a serial terminal (e.g. Tera Term) or SSH and run the following potentialsetup issuesscript whileto followingcomplete the setupinstallation guide.
cd the/opt/cgistudio/PlayerConnector
extracted./install.sh
stm32mp1.tar archive into the flashlayout_st-image-weston/extensible folder. The following files and folders from the root folder (images\stm32mp1) were necessary in the extensible folder for successful SD card flashing:
|- arm-trusted-firmware
|- fip
- st-image-bootfs-openstlinux-weston-stm32mp1.ext4
- st-image-userfs-openstlinux-weston-stm32mp1.ext4
- st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
- st-image-weston-openstlinux-weston-stm32mp1.ext4
After following the official setup, you should have a running target device with a terminal connection. This is required for the next steps. For the Python installation (needed for Python-based data binding) it is required to connect the target to the internet.
At Candera we have used Tera TermWinSCP for the remote serial terminal connection and WinSCP for theto transfer ofadditional files to the target device.device as needed.
After this step, your target system will be prepared to run Python-based data binding examples or any assets using the CGI-Studio runtime environment.
To change the location of the Weston taskbar (which is positioned at the bottom by default) or to remove it entirely you can use our set_weston_panel.sh script located in /opt/cgistudio/PlayerConnector/set_weston_panel.sh.
Blood Pressure Sample
We have prepared several samples to demonstrate the capabilities of CGI-Studio on the target image. These samples are located at:
/opt/cgistudio/PlayerConnector/Samples/ on the target image and in <cgi-studio-installation-path>\bin\Player\PlayerConnector\Samples on the host computer.
We will use the Blood Pressure Sample as an example to demonstrate how to run our samples. The Blood Pressure device sample is a Scene Composer sample that demonstratesshowcases a blood pressure measurement device with exemplary scenes and animations.
For the Professional Edition, the sample was extended with a data binding sample programmed in Python. The Python part of the sample relies on the Python-based player data binding library to interact with the data bindings of the scene.
In this section we will explain how to run the BloodPressureSample with our precompiled target player and with the Player Connector Library.
For this chapter the completed “Image Setup” is required, and it is assumed that WinSCP is downloaded and installed.
required.
Run Blood Pressure Sample with Target Player
Follow the steps given below to run the Blood Pressure sample on the target with our precompiled target player:
ConnectNavigate to thetargetPlayerdevice withWinSCP.directoryLaunch WinSCP, in the host name field enter the IP address of the target device, and for the username use“root”. Default values should be used for the remaining fields.ReferNavigate to theST Setup Guidefor information on obtaining the device’s IP address.
chmodcd +x Player/opt/cgistudio/TargetPlayer
Run the AssetExecute the below command in remote terminal, to run the player and asset
./Player ../PlayerConnector/Samples/BloodPressureDevice/BloodPressureDevice_Target.bin
The asset will be visible on the target device.
Run Blood Pressure Sample with Python
In this section, we explain how to execute the Blood Pressure sample including Python-based data binding with our Player Connector Library and how to install the required software on the target.Library. The Player Connector Library allows the simple connection between CGI Studio Player and a Python-based script.Please note that the “Blood Pressure sample with Python” has been prepared for integration with the Soundhound voice recognition service. For the sake of simplicity in this guide, we will not use this service. By running the sample, you will be presented with a start scene waiting for voice input. As the voice recognition service is not configured, it will not perform any action. To continue using the sample, simply press 'Start'.For guidance on configuring the voice recognition service by utilizing our Soundhound integration, please refer to our CGI-Studio Documentation: Blood Pressure Sample
Python Installation
Python is required for the Player Connector Library, to enable Python-based data binding for CGI-Studio. The target device needs to have an internet connection for installing python.
This section only covers the Python installation on the target device. In the host environment Python can be installed with the help of the python download guide on the Python webpage. We have used Python version 3.12.6, but the latest version is supported.
To install Python on the target device, follow these steps on the target:
apt-get update && apt-get upgrade
apt-get install python3
python3 -m ensurepip –-upgrade
Python Script
Before we proceed with executing the script, let's first take a moment to review the key components of the Player Connector Library script, which can be found at the following location:location on your host computer:
<cgi-studio-installation-path>\bin\Player\PlayerConnector\Samples\BloodPressureDevice\BloodPressureDevice.py
This script can also be found in /opt/cgistudio/PlayerConnector/Samples/BloodPressureDevice/BloodPressureDevice.py on the image.
Understanding the structure and the key steps of the script will help you execute and modify it effectively. Below are the key sections of the script:
- Import the Player Connector Library and additional required libraries.
import argparse import time import signalfrom SoundhoundCommandClient import SoundhoundCommandClientfrom CanderaAppConnector import CanderaAppConnector, Logger from Generated.BindingSourceEnum import BindingSourceItem - Constructing the library with the Player Connector Library binary contained in the delivered package (PlayerConnectorLibrary)
#Getting an instance of the CanderaAppConnector Python class App = CanderaAppConnector(args.LibraryBinaryPath) - Initializing the library with the asset binary
#initializing the player with the asset App.Init(args.AssetBinaryPath) - Set or get databinding values.
#Initializing binding values for back communication App.SetBoolValue(BindingSourceItem.SOURCE2ITEM1, False) App.SetBoolValue(BindingSourceItem.SOURCE2ITEM2, False) App.SetStringValue(BindingSourceItem.SOURCE1ITEM5, TRANSCRIPTION_DEFAULT_STRING) - Optionally register data binding callbacks
def BindingCallback(SourceItem, Value): global menuSceneActive, valueSceneActive ... #Registering databinding callback method App.RegisterCallback(BindingCallback - Continuously calling step to invoke the render loop and internal message delivery
#Looping until sig int try: while not sigintCaptured: ... App.Step() - Interact with data bindings. Note that internally, changes to the data bindings are reflected on the view when App.step() is called
App.SetFloatValue(BindingSourceItem.SOURCE1ITEM1, normalizedProgress * 100.0) - Shutdown library and gracefully exit program
except KeyboardInterrupt: logger.info("Caught KeyboardInterrupt from Python") finally: App.ShutDown() if SoundhoundCommandClient is not None: SoundhoundCommandClient.destroy() exit()
More information on the capabilities of our library can be found here.
Run Blood Pressure Sample with Player Connector Library in Simulation Environment (Host)
To run the Python-based data binding in the simulation environment (on the host computer) execute the steps below on the host computer:Please make sure to create a clean copy of the <cgi-studio-installation-path>\bin\Player\PlayerConnector folder before creating the Python environment, since this folder is required in its original form for the target.
- Open a command line interface in
<cgi-studio-installation-path>\bin\Player\PlayerConnector\Samples\BloodPressureDevice
python -m venv .
Script\activate
In order to install the Player Connector Library and other required libraries you need to
pip install -r requirements.requirementsWithoutSoundhound.txt
Run Blood Pressure Sample Simulation Asset with Python-based Data BindingBy running the sample, you will be presented with a start scene waiting for
Please note that the -wsh parameter is only necessary for the Blood Pressure Sample and not for the Slider and Gauge sample script.
python BloodPressureDevice.py -wsh -lbp ..\..\PlayerConnectorLibrary.dll -abp BloodPressureSample_Simulation.bin
The asset is displayed in host environment.

Run Blood Pressure Sample with Player Connector Library in Target Environment
The following steps are required to run the asset on the target.
It’s assumed that a remote terminal (Tera Term) and WinSCP connection is established.
established and the setup script /opt/cgistudio/PlayerConnector/install.sh was executed successfully.
cd <path-to-PlayerConnector-folder>/opt/cgistudio/PlayerConnector/Samples/BloodPressureDevice
python3 -m venv .
source bin/activate
pip3 install -r requirements.txt
Run asset with Python-based Data BindingBy running the sample, you will be presented with a start scene waiting for
Please note that the -wsh parameter is only necessary for the Blood Pressure Sample and not for the Slider and Gauge sample script.
python3 BloodPressureDevice.py -wsh -lbp ../../libPlayerConnectorLibrary.so -abp BloodPressureSample_Target.BloodPressureDevice_Target.bin
The asset and the configured databinding are running on the target.
Empty Solution with Slider and Gauge Control
This chapter shows how you can create your own solution with Python data binding on host and target withthrough a simple use case.case, and how to run it on host and target. It is using a Gauge Control for HMI data output for the user and a Slider Control for HMI data input via user.
Before proceeding with the example, it is recommended to explore CGI-Studio by viewing the Video Tutorials and the Quick Start Guide, both of which are available in the CGI-Studio DocumentationDocumentation.
The documentation also contains information on how to create simple SceneComposer solutions.
- Start Scene Composer in <cgi-studio-installation-path>\bin\SceneComposer\Scenecomposer.exe
- Open Empty Solution by either double clicking the empty solution thumbnail or through the File > New Solution dialog.

- In the Render Targets panel (on the right side of the SceneComposer), set the resolution of Display (0) to X Resolution (width) of 800 and Y Resolution (height) of 480.

- Drag and drop a Slider Control and a Gauge Control from the Control section of the Toolbox (on the right side of the Scene Composer) into the Scene Editor.

- You can move the controls in the Scene Editor by selecting the translation icon (the red square in the screenshot below) in the top left corner of the Scene Editor and then selecting the control which you want to move. Just select the item you want to move and drag it to a new location.

- Select the Gauge Control in either the Scene Editor or the Scene Tree, navigate to the properties, and adjust the scale to ensure it fits comfortably within the display.

- To set up a data binding for the Gauge value, first select the Gauge either in the Scene Editor or the Scene Tree. In the properties panel locate the Value property under the Control section and click the chain icon next to it to establish the binding.

A "Define Data Binding" window will appear. In this window, select Item1 (under PredefinedBindingSource1). Finally, click OK at the bottom to confirm your selection.
- To set a data binding for the Slider property, select the Slider control in either the Scene Editor or the Scene Tree. Then, click the chain icon next to the Value property in the Control section of the Properties panel. Next, choose Item2 (under PredefinedBindingSource1) from the available options.
- Next, generate two asset libraries for both the target and simulation environments to run the solution in the player.
- Save the solution, then go to File > Generate Asset Library

- A popup window will appear each time, allowing you to generate the asset library. Choose your desired asset location, set the environment to “Simulation” for the first run and to “Target” for the next, then click “Generate” to create each asset library.

- Save the solution, then go to File > Generate Asset Library
- Next, create a Python script. You can use the provided Sample.py file located in
<cgi-installation-path>\bin\Player\PlayerConnector\Samples\SliderAndGauge\Sample.py.py in your local CGI-Studio installation folder and in /opt/cgistudio/PlayerConnector/Samples/SliderAndGauge/Sample.py on the target image. -
Run the asset in the simulation environment (Host):
Do it analogous to the steps from chapter RunAssetBlood Pressure Sample with Player Connector Library in Simulation Environment (Host).Important:aA requirements.txt file is not necessary, since only the Player Connector Library needs to be installed:pip install <cgi-studio-installation-path>\bin\Player\PlayerConnector - Run the asset on the target device:
(ensureEnsure the device is set upcorrectly,correctlyfollowingaccording to theofficialchapterguide)Software Image Setup. Use WinSCP or a similar tool to copy the generated target asset from the host computer to the target device.DoRun it analogous to the steps from chapter RunAssetBlood Pressure Sample with Player Connector Library in Target Environment.Important:Only the Player Connector Library needs to be installed on the target:pip3 install <path-to-player-connector-folder>
Final comments
Congratulations you have successfully completed the Target Setup of CGI Studio Professional Edition on STM32MP157 development kit. With the completion of this guide, you can run an asset on the target with Python-based data binding and with Candera CGI Studio target player.
For more information on how to create brilliant HMI solutions with CGI Studio, please refer to the general documentation.