Difference between revisions of "How to install and use the X-LINUX-AI SDK add-on"

[quality revision] [quality revision]
m
m
Applicable for STM32MP13x lines, STM32MP15x lines

1 Article purpose[edit]

This article describes how to install and use the X-LINUX-AI SDK add-on. The X-LINUX-AI SDK add-on extends the OpenSTLinux SDK with AI functionality to develop and build an AI application easily. It is available from the X-LINUX-AI product web page.

2 Prerequisites[edit]

2.1 Install the OpenSTLinux SDK[edit]

First of all, you must download and install the OpenSTLinux SDK, which contains all the basis needed for the X-LINUX-AI add-on. To do this, follow the first four sections of the OpenSTLinux SDK installation guide. Once this has been done, you have a directory containing the OpenSTLinux SDK.

Warning white.png Warning
You only need to follow the section 1 to 4 of the OpenSTLinux SDK installation guide.
Info white.png Information
Once this is done, the path to the OpenSTLinux SDK is the following:
  • STM32MP15x series
$HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
  • STM32MP13x series
  • $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK


    3 X-LINUX-AI SDK add-on installation[edit]

    3.1 Download the X-LINUX-AI SDK add-on[edit]

    To add the Artificial Intelligence part into the OpenSTLinux SDK, you must download and install the X-LINUX-AI SDK add-on. The add-on is delivered through a tarball file named : en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz. It can be downloaded here: X-LINUX-AI SDK add-on.

    Warning white.png Warning
    The X-LINUX-AI SDK add-on version must be the same as the OpenSTLinux SDK. If the version are not aligned, it might not work correctly.

    3.2 Install the X-LINUX-AI SDK add-on[edit]

    3.2.1 For STM32MP15x lines[edit]

    After that, you must uncompress the tarball file in your OpenSTLinux SDK directory. First, copy the add-on to the OpenSTLinux SDK directory:

     
     cp ~/Downloads/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz  $HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
    

    Then, move to your OpenSTLinux SDK directory:

     
     cd  $HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
    

    Finally, uncompress the tarball:

     
     tar xJf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz
    
    Warning white.png Warning
    It is mandatory to uncompress the tarball inside the OpenSTLinux SDK directory.

    3.

    2.2 For STM32MP13x lines[edit]

    After that, you must uncompress the tarball file in your OpenSTLinux SDK directory. First, copy the add-on to the OpenSTLinux SDK directory:

    cp ~/Downloads/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK

    Then, move to you OpenSTLinux SDK directory:

    cd $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK

    Finally, uncompress the tarball:

    tar xJf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz
    Warning white.png Warning
    It is mandatory to uncompress the tarball inside the OpenSTLinux SDK directory.

    3.3 Start the SDK[edit]

    Info white.png Information
    The SDK environment setup script must be run once on each new working terminal on which you cross-compile.

    3.3.1 For STM32MP15x lines[edit]

    The add-on is now installed into the OpenSTLinux SDK. You can start the SDK. Go to your OpenSTLinux SDK directory and source the environment:

     
     cd $HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
      source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
    

    3.3.2 For STM32MP13x lines[edit]

    The add-on is now installed into the OpenSTLinux SDK. You can start the SDK. Go to your OpenSTLinux SDK directory and source the environment:

    cd $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi

    4 Use the SDK[edit]

    4.1 Build an application with the SDK[edit]

    Info white.png Information
    In this section, the image classification application is used as an example, but all the applications can be built with this method.

    Once the SDK is correctly set up, the applications can be built easily. In this example, it is the image classification application that is built.

    Download the github repository:

     
     git clone https://github.com/STMicroelectronics/meta-st-stm32mpu-ai.git
    
    
    Warning white.png Warning
    The version of the downloaded meta-st-stm32mpu-ai is be the same as the one of the X-LINUX-AI SDK add-on.

    Go to the image classification directory:

     
     cd meta-st-stm32mpu-ai/recipes-samples/tflite-cv-apps/files/image-classification/src
    

    Then, use the make command to build the application:

     
     make
    

    A new file is displayed, named label_tfl_gst_gtk. This is a binary file, which has been generated using the make command. It is compiled for the STM32MP1x architecture. It must now be transferred to the board.

    4.2 Use the application[edit]

    Warning white.png Warning
    To use the application, it is mandatory to have an STM32MP1x board with OpenSTLinux and X-LINUX-AI packages installed. If it is not the case, refer to the X-LINUX-AI installation guide sections 2 and 3.

    Once the STM32MP1x board is correctly set up and the X-LINUX-AI packages are installed with the right version, it is possible to send the application to the board.

    Info white.png Information
    The X-LINUX-AI packages versions must be the same as the ones in the X-LINUX-AI SDK add-on.

    To do it, use the following command using your own IP address:

     
     scp -r -p label_tfl_gst_gtk root@<ip_address>:/usr/local/demo-ai/computer-vision/tflite-image-classification/bin/
    

    Then, use the ssh protocol to connect to the board:

     
     ssh root@<ip_address>
    

    On the board, go to the right directory and use the image classification script to launch the application:

     
     cd /usr/local/demo-ai/computer-vision/tflite-image-classification/bin/
      ./launch_bin_label_tfl_mobilenet.sh
    

    This script is using the label_tfl_gst_gtk application that has been compiled before.


    <noinclude>{{ApplicableFor
    |MPUs list=STM32MP13x, STM32MP15x
    |MPUs checklist=STM32MP13x,STM32MP15x
    }}</noinclude>
    
    
    ==Article purpose==
    This article describes how to install and use the X-LINUX-AI SDK add-on.   
    The X-LINUX-AI SDK add-on extends the OpenSTLinux SDK with AI functionality to develop and build an AI application
    easily. It is available from the [https://www.st.com/en/product/x-linux-ai X-LINUX-AI] product web page.
    
    ==Prerequisites==
    === Install the OpenSTLinux SDK ===
    First of all, you must download and install the '''OpenSTLinux SDK''', which contains all the basis needed for the '''X-LINUX-AI add-on'''. To do this, follow the first four sections of the [[_Install_the_SDK| OpenSTLinux SDK installation guide]]. Once this has been done, you have a directory containing the OpenSTLinux SDK.
    
    {{warning| You only '''need''' to follow the '''section 1 to 4''' of the [[_Install_the_SDK| OpenSTLinux SDK installation guide]].}}
    
    {{info| Once this is done, the path to the '''OpenSTLinux SDK''' is the following:* STM32MP15x series:: '''$HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK'''
    
    * STM32MP13x series
    :: '''$HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK'''}}
    }}
    == X-LINUX-AI SDK add-on installation ==
    === Download the  X-LINUX-AI SDK add-on ===
    To add the '''Artificial Intelligence''' part into the OpenSTLinux SDK, you must download and install the '''X-LINUX-AI SDK add-on'''. 
    The add-on is delivered through a tarball file named : '''en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz'''. It can be downloaded here: [https://www.st.com/en/product/x-linux-ai  X-LINUX-AI SDK add-on].
    {{warning| The '''X-LINUX-AI SDK add-on''' version must be the same as the '''OpenSTLinux SDK'''. If the version are not aligned, it might not work correctly.}}
    
    === Install the X-LINUX-AI SDK add-on ======= For STM32MP15x lines ====After that, you must '''uncompress''' the tarball file in your OpenSTLinux SDK directory. First, '''copy''' the add-on to the '''OpenSTLinux SDK directory''':
      {{PC$}} cp ~/Downloads/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz  $HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
    Then, '''move''' to your '''OpenSTLinux SDK directory''':
      {{PC$}} cd  $HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
    Finally, '''uncompress''' the tarball:
      {{PC$}} tar xJf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz
    {{warning| It is mandatory to uncompress the tarball '''inside the OpenSTLinux SDK directory.'''}}
    
    ==== For STM32MP13x lines ====
    After that, you must '''uncompress''' the tarball file in your OpenSTLinux SDK directory. First, '''copy''' the add-on to the '''OpenSTLinux SDK directory''':
      {{PC$}} cp ~/Downloads/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz  $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK
    Then, '''move''' to you '''OpenSTLinux SDK directory''':
      {{PC$}} cd  $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK
    Finally, '''uncompress''' the tarball:
      {{PC$}} tar xJf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz
    {{warning| It is mandatory to uncompress the tarball '''inside the OpenSTLinux SDK directory.'''}}
    
    ===  Start the SDK ===
    {{info| The SDK environment setup script must be run once on each new working terminal on which you cross-compile.}}==== For STM32MP15x lines ====The add-on is now installed into the OpenSTLinux SDK. You can '''start''' the SDK. Go to your '''OpenSTLinux SDK directory''' and '''source''' the environment:
      {{PC$}} cd $HOME/STM32MPU_workspace/STM32MP15STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
      {{PC$}} source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
    
    ==== For STM32MP13x lines ====
    The add-on is now installed into the OpenSTLinux SDK. You can '''start''' the SDK. Go to your '''OpenSTLinux SDK directory''' and '''source''' the environment:
      {{PC$}} cd $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK
      {{PC$}} source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
    
    ==  Use the SDK ==
    === Build an application with the SDK ===
    {{info| In this section, the image classification application is used as an example, but all the applications can be built with this method.}}
    Once the SDK is correctly set up, the applications can be built easily. In this example, it is the image classification application that is built. 
    
    Download the github repository:
      {{PC$}} git clone https://github.com/STMicroelectronics/meta-st-stm32mpu-ai.git
    {{warning| The '''version''' of the downloaded '''meta-st-stm32mpu-ai''' is be the '''same''' as the one of the '''X-LINUX-AI SDK add-on'''.}}
    Go to the image classification directory:
      {{PC$}} cd meta-st-stm32mpu-ai/recipes-samples/tflite-cv-apps/files/image-classification/src
    Then, use the '''make''' command to build the application:
      {{PC$}} make
    
    A new file is displayed, named '''label_tfl_gst_gtk'''. This is a binary file, which has been generated using the '''make''' command. It is compiled for the STM32MP1x architecture. It must now be transferred to the board.
    === Use the application ===
    {{warning| To use the application, it is '''mandatory''' to have an STM32MP1x board with '''OpenSTLinux and X-LINUX-AI packages''' installed. If it is not the case, refer to the [[_X-LINUX-AI_OpenSTLinux_Expansion_Package| X-LINUX-AI installation guide]] '''sections 2 and 3'''.}}
    
    Once the STM32MP1x board is correctly set up and the X-LINUX-AI packages are installed with the right version, it is possible to send the application to the board. 
    {{info| The '''X-LINUX-AI packages versions''' must be the '''same''' as the ones in the '''X-LINUX-AI SDK add-on'''.}}
    
    To do it, use the following command using your own IP address:
      {{PC$}} scp -r -p label_tfl_gst_gtk root@<ip_address>:/usr/local/demo-ai/computer-vision/tflite-image-classification/bin/
    Then, use the '''ssh protocol''' to connect to the board:
      {{PC$}} ssh root@<ip_address>
    
    On the '''board''', go to the right directory and '''use the image classification script''' to launch the application:
      {{Board$}} cd /usr/local/demo-ai/computer-vision/tflite-image-classification/bin/
      {{Board$}} ./launch_bin_label_tfl_mobilenet.sh
    This script is using the '''label_tfl_gst_gtk''' application that has been compiled before.
    <noinclude>
    
    [[Category:Artificial intelligence expansion packages|05]]
    {{PublicationRequestId | 23826 | 17Jun'22}}</noinclude>
    Line 16: Line 16:
       
     
    {{info| Once this is done, the path to the '''OpenSTLinux SDK''' is the following:
     
    {{info| Once this is done, the path to the '''OpenSTLinux SDK''' is the following:
    * STM32MP15x series
    +
    :: '''$HOME/STM32MPU_workspace/STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK'''}}
    :: '''$HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v4.0.0/Developer-Package/SDK'''
    +
     
    * STM32MP13x series
     
    :: '''$HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK'''}}
     
       
     
    == X-LINUX-AI SDK add-on installation ==
     
    == X-LINUX-AI SDK add-on installation ==
    Line 28: Line 26:
       
     
    === Install the X-LINUX-AI SDK add-on ===
     
    === Install the X-LINUX-AI SDK add-on ===
    ==== For STM32MP15x lines ====
     
     
    After that, you must '''uncompress''' the tarball file in your OpenSTLinux SDK directory. First, '''copy''' the add-on to the '''OpenSTLinux SDK directory''':
     
    After that, you must '''uncompress''' the tarball file in your OpenSTLinux SDK directory. First, '''copy''' the add-on to the '''OpenSTLinux SDK directory''':
       {{PC$}} cp ~/Downloads/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz  $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v4.0.0/Developer-Package/SDK
    +
       {{PC$}} cp ~/Downloads/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz  $HOME/STM32MPU_workspace/STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
     
    Then, '''move''' to your '''OpenSTLinux SDK directory''':
     
    Then, '''move''' to your '''OpenSTLinux SDK directory''':
       {{PC$}} cd  $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v4.0.0/Developer-Package/SDK
    +
       {{PC$}} cd  $HOME/STM32MPU_workspace/STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
    Finally, '''uncompress''' the tarball:
     
      {{PC$}} tar xJf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz
     
    {{warning| It is mandatory to uncompress the tarball '''inside the OpenSTLinux SDK directory.'''}}
     
     
     
    ==== For STM32MP13x lines ====
     
    After that, you must '''uncompress''' the tarball file in your OpenSTLinux SDK directory. First, '''copy''' the add-on to the '''OpenSTLinux SDK directory''':
     
      {{PC$}} cp ~/Downloads/en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz  $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK
     
    Then, '''move''' to you '''OpenSTLinux SDK directory''':
     
      {{PC$}} cd  $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK
     
     
    Finally, '''uncompress''' the tarball:
     
    Finally, '''uncompress''' the tarball:
     
       {{PC$}} tar xJf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz
     
       {{PC$}} tar xJf en.SDK-x86_64-stm32mp1-openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15-addon-x-linux-ai-v2.2.0.tar.xz
    Line 48: Line 36:
     
    === Start the SDK ===
     
    === Start the SDK ===
     
    {{info| The SDK environment setup script must be run once on each new working terminal on which you cross-compile.}}
     
    {{info| The SDK environment setup script must be run once on each new working terminal on which you cross-compile.}}
    ==== For STM32MP15x lines ====
     
    The add-on is now installed into the OpenSTLinux SDK. You can '''start''' the SDK. Go to your '''OpenSTLinux SDK directory''' and '''source''' the environment:
     
      {{PC$}} cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v4.0.0/Developer-Package/SDK
     
      {{PC$}} source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
     
     
    ==== For STM32MP13x lines ====
     
     
    The add-on is now installed into the OpenSTLinux SDK. You can '''start''' the SDK. Go to your '''OpenSTLinux SDK directory''' and '''source''' the environment:
     
    The add-on is now installed into the OpenSTLinux SDK. You can '''start''' the SDK. Go to your '''OpenSTLinux SDK directory''' and '''source''' the environment:
       {{PC$}} cd $HOME/STM32MPU_workspace/STM32MP13-Ecosystem-v4.0.0/Developer-Package/SDK
    +
       {{PC$}} cd $HOME/STM32MPU_workspace/STM32MP1-Ecosystem-v4.0.0/Developer-Package/SDK
     
       {{PC$}} source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
     
       {{PC$}} source environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi