STM32CubeMP2 Package - Getting started

Revision as of 13:35, 7 December 2023 by Registered User (Nathalie Sangouard moved page STM32CubeMP25 Package - Getting started to STM32CubeMP2 Package - Getting started without leaving a redirect: Sachin/Francois : Package applicable to the whole MP2 family)
Applicable for STM32MP25x lines


The STM32CubeMP25 Package / STM32CubeMP2 Package is part of the STM32 MPU embedded software offer. It runs on the Arm® Cortex®-M33 coprocessor.
It is included in the three software packages proposed by the Linux® Yocto-based embedded software:

  • in the starter package as pre-built examples (firmware),
  • in the developer package as full source code for development (associated with an IDE),
  • in the distribution package as a dedicated recipe (that integrates the full source code) in the OpenSTLinux distribution.

Therefore, this article explains how to develop, build and run existing or new examples thanks to these three software packages.

1. Prerequisites[edit source]

In the next chapters, it is assumed that the selected board is assembled according to the information provided in its hardware description article (e.g., STM32MP257x-EV1 - hardware description for STM32MP257x-EV1 Evaluation boards), and that the different boot related switches of the board are also known (e.g., boot related switches for STM32MP257x-EV1 Evaluation boards).

Refer also to the Which Package better suits your needs article for further information on all packages.

The firmware is loaded into the Arm® Cortex®-M33 coprocessor by the Arm® Cortex®-A35 processor running the Linux® distribution making use of the Linux Remote Proc framework. This method is also referred to as Production Mode


2. Starter Package for STM32CubeMP25[edit source]

The Linux Yocto-based starter packages (STM32MP25 Evaluation boards - Starter_Package) contain pre-built examples (firmware) that are located in the Linux file system (userfs folder: /usr/local/Cube-M33-examples/<board_name>/Examples), and that be run from a host console thanks to a dedicated script (fw_cortex_m33.sh).

This chapter, and its sub-chapters, aims to explain all steps needed to run an existing example.

2.1. User file system for Arm® Cortex®-M33 examples[edit source]

The folder structure of Linux User File System for STM32Cube M33 firmware is described below for STM32MP257F-EV1 board:


STM32CubeMP2MPUPackageLinuxStructure2.png


3. Developer Package for STM32CubeMP25[edit source]

The STM32MPU Developer Package article explains how to get the source code for the STM32CubeMP25 Package, and the associated tools (e.g., IDE).

This chapter and its sub-chapters aim to explain all steps needed to run an existing example using STM32CubeIDE. Once done, you can jump to the chapter #How to go further with the Developer Package to enhance your experience with the STM32CubeMP2 Developer Package.

3.1. Developer Package prerequisites[edit source]

Warning white.png Warning
  • Be sure to have installed the STM32CubeMP2 Package and the STM32CubeIDE.
  • Be sure also to have connected ST-Link and Ethernet cables to your board.

3.2. How to Build and run an existing example with the Eclipse IDE[edit source]

  • Open the folder containing the example and double-click on file .project to open Eclipse IDE:

MP2CubeExampleFolderStructure2.png

MP2IDEProjectLayout.png

  • Select a config and press hammer button to build the example

IDESelectBuildConfig.png

IDEBuildTrace.png


3.3. How to run examples[edit source]

After flashing images onto your board, you need to open a Linux console (Refer to How to get Terminal), and follow the steps defined in chapters below.

3.3.1. Copy Build Firmware to Correct directory in the Target(Our Board)[edit source]

  • When system boots from flash (production mode), the USB port can be connected to your host machine and it would appear as a device with IP address: 192.168.7.1
  • From a GitBash Shell (On Windows) or Terminal Windows on a Linux machine, run the following commands to copy the Firmware on to the target.
 $ ssh root@192.168.7.1 'mkdir -p /usr/local/Cube-M33-examples/STM32MP257F-EV1/Applications/OpenAMP_TTY_echo/lib/firmware'
 $ scp Projects/STM32MP257F-EV1/Applications/OpenAMP/OpenAMP_TTY_echo/STM32CubeIDE/CM33/NonSecure/CA35TDCID_m33_ns_sign/OpenAMP_TTY_echo_CM33_NonSecure_sign.bin root@192.168.7.1:/usr/local/Cube-M33-examples/STM32MP257F-EV1/Applications/OpenAMP_TTY_echo/lib/firmware/
 $ scp Utilities/scripts/fw_cortex_m33.sh  root@192.168.7.1:/usr/local/Cube-M33-examples/STM32MP257F-EV1/Applications/OpenAMP_TTY_echo/


3.3.2. Starting the Example Firmware[edit source]

  • Once Copied to the target, the firmware can be run by executing the script as follows:
  cd /usr/local/Cube-M33-examples/STM32MP257F-EV1/Applications/OpenAMP_TTY_echo/
   ./fw_cortex_m33.sh start
 fw_cortex_m33.sh: fmw_name=OpenAMP_TTY_echo_CM33_NonSecure_sign.bin
 Stopping running fw ...
 [ 1232.784799] remoteproc remoteproc0: stopped remote processor m33
 [ 1232.795058] remoteproc remoteproc0: powering up m33
 [ 1232.801334] remoteproc remoteproc0: Booting fw image OpenAMP_TTY_echo_CM33_NonSecure_sign.bin, size 34440
 [ 1232.806431] rproc-virtio rproc-virtio.10.auto: assigned reserved memory node vdev0buffer@812fa000
 [ 1232.815436] virtio_rpmsg_bus virtio0: rpmsg host is online
 [ 1232.820030] rproc-virtio rproc-virtio.10.auto: registered virtio0 (type 7)
 [ 1232.826673] remoteproc remoteproc0: remote processor m33 is now up
 [ 1232.833005] virtio_rpmsg_bus virtio0: creating channel rpmsg-tty addr 0x400
 [ 1232.840724] virtio_rpmsg_bus virtio0: creating channel rpmsg-tty addr 0x401

3.3.3. Stopping the Example Firmware[edit source]

  cd /usr/local/Cube-M33-examples/STM32MP257F-EV1/Applications/OpenAMP_TTY_echo/
   ./fw_cortex_m33.sh stop
 [ 2290.481170] remoteproc remoteproc0: warning: remote FW shutdown without ack
 [ 2290.482719] remoteproc remoteproc0: stopped remote processor m33
 [2]+  Done                       cat /dev/ttyRPMSG1 
 [1]+  Done                       cat /dev/ttyRPMSG0