Last edited one year ago

STM32MP1 Developer Package for Android

This article describes how to obtain and use the Developer Package of the STM32MPU Embedded Software for Android™ for any STM32MP1 family development platform (STM32MP15 boards) in order to develop applications on it.

It details some prerequisite knowledge and the development environment, and gives step-by-step instructions to download and install the STM32MPU Embedded Software for Android components for the Package.

Finally, it gives guidelines on upgrading (to add, remove, configure, or improve) any piece of software.

Warning white.png Warning

STM32MPU Embedded Software distribution for Android™ is no more supported by ST. You can contact our ST partner, Witekio, who can help you to port and maintain it on STM32MP15 platform.

1 Developer Package content[edit source]

If you are not familiar with the STM32MPU Embedded Software for Android distribution and its Packages, please read the following articles:

In summary, this Developer Package provides:

  • for the STM32MPU distribution for Android™ (development on Arm® Cortex®-A processor):
    • the software development kit (SDK) update associated with Android Studio IDE, adding a service to connect your application to the coprocessor (customization)
  • for the STM32Cube MPU Package (development on Arm® Cortex®-M processor):
    • source code for all pieces of software (BSP, HAL, middleware and applications)
    • the integrated development environment (IDE) (STM32CubeIDE)
    • a pre-configured project for CubeMx including default resources allocations for the Arm® Cortex®-M4
    • a multicore application example using the coprocessor service (Android application linked with a Arm® Cortex®-M4 firmware)

2 Prerequisite knowledge[edit source]

The STM32MP1 Developer Package aims to enrich Linux-based software for the targeted product. A basic knowledge of Linux and Android is recommended in order to make the most of this Package. Reading the STM32MPU Embedded Software for Android architecture overview is also highly recommended.

3 Installing the components to develop software running on Arm Cortex-A (STM32MPU distribution for Android)[edit source]

3.1 Installing the Android Studio IDE[edit source]

The IDE is available in the Android developer site[1].

3.2 Installing the SDK update[edit source]

The official SDK for Android must be loaded through Android Studio using the SDK manager, selecting the correct version for the Starter package version used.

The SDK can then be updated by replacing the android.jar file (JAVA archive file for Android) of the loaded SDK with the one provided within the Developer package (adding the coprocessor service classes). Refer to Install SDK in Android Studio.

Warning white.png Warning

STM32MPU Embedded Software distribution for Android™ is no more supported by ST. You can contact our ST partner, Witekio, who can help you to port and maintain it on STM32MP15 platform.

4 Installing the components needed to develop software running on the Arm Cortex-M4 (STM32Cube MPU Package)[edit source]

4.1 Installing STM32CubeMX[edit source]

Please refer to the STM32CubeMX page.

4.2 Installing STM32CubeIDE[edit source]

Please refer to the STM32CubeIDE page.

5 Developing multi-core applications using the coprocessor service (CoproManager)[edit source]

STM32MP1 Platforms for Android propose an environment for developing Android applications running on the Arm Cortex-A7, combined with a remote firmware offloaded in the Arm Cortex-M4.
This is based in the coprocessor service. Please check How to use coprocessor service for Android page for details.

A STCoproM4Example project, containing both Android application and Cortext-M4 firmware, is given with the STM32MP1 Developer Package for Android, and is used to illustrate below chapters.

5.1 Software running on Arm Cortex-M4[edit source]

It is possible to develop Arm Cortex-M4 software based on the default resources allocated in the Linux kernel device tree (detailed in Default resources allocation for Arm Cortex-M4 in Developer Package for Android).

5.1.1 Prerequisites[edit source]

Main components to be used:

5.1.2 Creating project from CubeMx[edit source]

It's required to configure your project using STM32CubeMX. It's possible to start from the provided STM32CubeMX project .ioc file which reserve (not activate and not configure) the available Cortex-M4 resources as listed in Default resources allocation for Arm Cortex-M4 in Developer Package for Android.

Warning white.png Warning

STM32MPU Embedded Software distribution for Android™ is no more supported by ST. You can contact our ST partner, Witekio, who can help you to port and maintain it on STM32MP15 platform.

You can also refer to the configured STM32CubeMX project copro_m4example.ioc associated to the STCoproM4Example firmware project available on GitHub: STCoproM4Example.

5.1.3 Building your project using STM32CubeIDE[edit source]

At this stage, it's possible to open the generated project using STM32CubeIDE. Pleaser refer to STM32CubeIDE user guide to understand it's usage.

The default IPC mechanism is based on a virtual UART which must be used to receive commands from the Cortex-A7 and transmit results. It's possible to refer to the example available in GitHub: STCoproM4Example firmware project.

Warning white.png Warning

The generated sources include CA7 device tree files are not needed in Android context. As mentioned, only the listed reserved Cortex-M4 resources can be used. Otherwise, it's required to use the STM32MP1 Distribution Package for Android.

At this stage your project has been built and a generated .elf file is available.

5.1.4 Loading your generated image in the device[edit source]

The download of the firmware .elf image (Arm Cortex-M4 firmware) on the target is performed using ADB.

Info white.png Information

All firmware .elf images using the coprocessor service must be downloaded in the /vendor/firmware/copro/ directory.


To load the Arm Cortex-M4 firmware image on the target, execute the following commands using a terminal:

 adb root; adb remount
 adb push <path_to>/<project image>.elf /vendor/firmware/copro/
 adb reboot

5.1.5 Testing your project[edit source]

There are several solutions to test your project on the device (using STM32CubeIDE in engineering mode, using test binary, using Android application).

It's also possible to load, start and send commands manually.

Open a console:

 adb root
 adb shell
 ...

Configure the firmware to be loaded by Linux in the Cortex-M4:

:/ # echo copro/<project image>.elf > /sys/class/remoteproc/remoteproc0/firmware

Start the firmware:

:/ # echo start > /sys/class/remoteproc/remoteproc0/state

Check that all required resources have been reserved without error

:/ # dmesg

Example of dmesg trace with copro/copro_m4example.elf:

[ 5183.938679] remoteproc remoteproc0: powering up m4
[ 5183.947729] remoteproc remoteproc0: Booting fw image copro/copro_m4example.elf, size 3107616
[ 5183.989105] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:timer@40000000 (ops rproc_srm_dev_ops)
[ 5184.001239] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:timer@40005000 (ops rproc_srm_dev_ops)
[ 5184.014541] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:serial@4000f000 (ops rproc_srm_dev_ops)
[ 5184.027795] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:i2c@40015000 (ops rproc_srm_dev_ops)
[ 5184.043446] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:dac@40017000 (ops rproc_srm_dev_ops)
[ 5184.055294] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:spi@44004000 (ops rproc_srm_dev_ops)
[ 5184.068340] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:dma@48001000 (ops rproc_srm_dev_ops)
[ 5184.081449] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:adc@48003000 (ops rproc_srm_dev_ops)
[ 5184.094565] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:hash@4c002000 (ops rproc_srm_dev_ops)
[ 5184.107796] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:rng@4c003000 (ops rproc_srm_dev_ops)
[ 5184.120918] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:crc@4c004000 (ops rproc_srm_dev_ops)
[ 5184.134054] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:cryp@4c005000 (ops rproc_srm_dev_ops)
[ 5184.147277] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:qspi@58003000 (ops rproc_srm_dev_ops)
[ 5184.160489] rproc-srm-core mlahb:m4@10000000:m4_system_resources: bound mlahb:m4@10000000:m4_system_resources:m4_led (ops rproc_srm_dev_ops)
[ 5184.173700] remoteproc0#vdev0buffer: assigned reserved memory node vdev0buffer@10042000
[ 5184.182181] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 5184.182335] virtio_rpmsg_bus virtio0: creating channel rpmsg-tty-channel addr 0x0
[ 5184.187346] remoteproc0#vdev0buffer: registered virtio0 (type 7)
[ 5184.200672] remoteproc remoteproc0: remote processor m4 is now up
[ 5184.204352] rpmsg_tty virtio0.rpmsg-tty-channel.-1.0: new channel: 0x400 -> 0x0 : ttyRPMSG0

Send command:

:/ # echo <command> > /dev/ttyRPMSG0

Receive returned data (to be executed in another console before sending the command):

:/ # od -c < /dev/ttyRPMSG0

Stop the firmware:

:/ # echo stop > /sys/class/remoteproc/remoteproc0/state

5.2 Android application running on Arm Cortex-A7[edit source]

Please refer to the Android developer guide[2] for generic information about standard Android application development.

Then based on the SDK delivered within the Developer Package for Android (see Installing the SDK update), this is possible to develop an application which can use the coprocessor service (CoproManager), in order to interact with remote Arm Cortex-M4 core software.

Coprocessor service detailed information and API are described in dedicated page. Please see How to use coprocessor service for Android.


As example, you can refer to the STCoproM4Example application available on GitHub.

6 How to go further[edit source]

Now that your developments are ready, you may switch to the STM32MP1 Distribution Package for Android in order to create your own distribution and to generate your own SDK and image.

7 References[edit source]