Skip to content

STM32MP1 Board Support Package

Atharva Nandanwar edited this page Apr 30, 2020 · 12 revisions

Board Support Information for STM32MP1 boards

Why this board?

This board features interesting processor stack up. It has a dual core ARM Cortex-A7 and ARM Cortex-M4 in a single package. I choose this board for development, because it interests me how Linux would be built for such a complicated configuration.

STM32MP1 Microprocessor Architecture Information Page

STM32MP1 Microprocessor Block Diagram

Setting up host system for development

  1. STM32 CubeMX

This will be used to configure the hardware and generate device tree files for Linux distribution.

  1. STM32 Cube Programmer

This can be used to flash the STM32MP157A-DK1 board through USB from the host PC. I have made a choice to pack the binaries for x86_64 system into the repository. flash.sh script uses this program to flash through USB.

  1. STM32 Developer Package

Use this to verify applications.

  1. STM32 Distribution Package

This will be used to build target distribution and layer our custom application, or custom distribution, or custom machine setup.

Starter Package

Use the starter package to test basic system functionality.

Get Started Guide

Building a yocto image

  1. Use the master branch to layout the git submodules, and build scripts.

  2. Execute build.sh to start a build.

  3. Connect the STM32MP157A-DK1 Board as mentioned here

  4. Boot the board as specified here

  5. Check the boot sequence and access to the board terminal - Boot Sequence and Terminal Guide

Adding a custom application

  1. A meta-aesd layer was added, add recipe to this layer.

  2. Add the recipe through devtool

    a. devtool add <recipe-name> <url> to add the recipe to workspace

    b. devtool finish <recipe-name> <layer-name> to add the recipe to your layer

  3. Add CORE_IMAGE_EXTRA_INSTALL += " <recipe-name>" to layers/meta-st/meta-aesd/recipes-st/images/st-image-aesd.bb

  4. Build the image st-image-aesd

Customizing device tree and peripheral assignment

This part is tricky to track down to the basics. ST has their own layers and recipes that take care of default device tree configuration. However, whatever we add from the STM32CubeMX generated files.

  1. Set the device up in STM32CubeMX and generate device tree files - How to assign peripherals

Image of Peripheral Assignment

  1. Add the device tree files into the distribution. Please refer to the repository to understand how to create files in your layer.

File tree for mx and conf directory

  1. Verify the device tree settings - Instructions to verify Cortex A7 devices Here, we need some more resources to verify. First, get the reference manual for STM32MP157 processors. You can find peripheral addresses from Page 159. Once you find the peripheral address, you can see all the peripherals in /proc/device-tree/soc. Below are the screenshots for further verification.

Checking in sysfs

Checking in dmesg

Checking for the device in /dev

Note: Assigning different peripherals to different processor will result in some changes in device tree files. If you are curious about the changes, look at these pull request

Adding ARM Cortex M4 Applications

  1. Temporarily, we are using applications made by STMicroelectronics. Hence, following their directory structure.

  2. Create a new recipe recipes-extended. Add a folder m4projects in the recipe directory. Further, add m4projects-stm32mp1.bbappend into m4projects folder. This step is required to leverage ARM Cortex M4 application build support in OpenSTLinux Distribution Package. Here, we are just doing to replace the variables set in meta-st-stm32mp/recipes-extended/m4projects/* files.

  3. Refer to this commit change to understand how to develop recipes for Custom M4 Applications - link