Development environment setup

This page describes the host setup (STM32Cube IDE and the STM32 Developer Packages) and the BSP changes needed to run firmware on the Cortex-M coprocessor of our STM32MP modules — STM32MP1 (Cortex-M4, QSMP-1xxx/TXMP-1xxx) and STM32MP2 (Cortex-M33, QSMP-2xxx/TXMP-2xxx) — while Linux runs on the Cortex-A cores. For the SoC-specific content see Running firmware on the STM32MP coprocessor.

STM32Cube IDE and Developer Packages

STM provides the STM32MP1 Developer Package to develop on the Arm® Cortex®-M4 side (STM32MP1) and the STM32MP2 Developer Package to develop on the Arm® Cortex®-M33 side (STM32MP2).

Starting up with development on the Cortex-M core, read the STM documentation:

Warning

The following contents does only work with our Kirkstone release, or newer. In older mainline based BSPs, like Hardknott or Gatesgarth, the device tree files and kernel configurations do not support the Linux RPMsg framework.

Customizing the BSP for coprocessor support

To run Cortex-M firmware on the STM32MP, a number of kernel features and device tree entries must be in place. This is accomplished in Yocto by using the distro feature copro, and the U-Boot provides the karo-copro devicetree overlay for the device tree entries.

To add the distro feature, open your local.conf and add the following line:

DISTRO_FEATURES:append = " copro"

On STM32MP1, the distro feature also builds the ST firmware examples into the userfs — see Running firmware on the STM32MP coprocessor.

For more information about FDT overlays, please see FDT Overlays

To install the overlay, a baseboard variable must be set in the U-Boot environment, and the overlay name must be added to the appropriate overlays_${baseboard} variable, e.g.:

setenv baseboard <baseboard>
setenv overlays_<baseboard> ${overlays_<baseboard>} karo-copro
saveenv

Kernel configuration and device tree (STM32MP1)

To use the RemoteProc and the RPMsg frameworks on the STM32MP1, be sure that they are enabled in your Linux kernel configuration.

Please note

The following kernel features are enabled by default in the Kirkstone release, or newer. In older mainline based BSPs, like Hardknott or Gatesgarth, this has to be done by the cutomer.

using the Linux Menuconfig tool:

Device drivers  --->
   -*- Mailbox Hardware Support  --->
   <*> STM32 IPCC Mailbox
Device drivers  --->
   Remoteproc drivers  --->
      <*> Support for Remote Processor subsystem
      <*> STM32 remoteproc support
Device Drivers  --->
   Character devices  --->
      <*> RPMSG tty driver

Please note

With the Kirkstone release, or newer, the U-Boot provides an FDT Overlay (karo-copro) that installs the following device tree settings.

Some features must be configured in the Linux device tree:

  • reserved memory buffers, used by the RemoteProc framework

  • the Cortex®-M4

  • the mailbox registers

reserved-memory {
   #address-cells = <1>;
   #size-cells = <1>;
   ranges;

   mcuram2:mcuram2@10000000{
      compatible = "shared-dma-pool";
      reg = <0x10000000 0x40000>;
      no-map;
   };

   vdev0vring0:vdev0vring0@10040000{
      compatible = "shared-dma-pool";
      reg = <0x10040000 0x1000>;
      no-map;
   };

   vdev0vring1:vdev0vring1@10041000{
      compatible = "shared-dma-pool";
      reg = <0x10041000 0x1000>;
      no-map;
   };

   vdev0buffer:vdev0buffer@10042000{
      compatible = "shared-dma-pool";
      reg = <0x10042000 0x4000>;
      no-map;
   };

   mcuram:mcuram@30000000{
      compatible = "shared-dma-pool";
      reg = <0x30000000 0x40000>;
      no-map;
   };

   retram:retram@38000000{
      compatible = "shared-dma-pool";
      reg = <0x38000000 0x10000>;
      no-map;
   };

   gpu_reserved: gpu@d4000000 {
      reg = <0xd4000000 0x4000000>;
      no-map;
   };
};
&m4_rproc {
   memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
      <&vdev0vring1>, <&vdev0buffer>;
   mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
   mbox-names = "vq0", "vq1", "shutdown";
   interrupt-parent = <&exti>;
   interrupts = <68 1>;
   interrupt-names = "wdg";
   wakeup-source;
   recovery;
   status = "okay";
};
&ipcc {
   status = "okay";
};