Tinkering with STM32MP2

2026-01-01

Intro

That post simply describes my tinkering notes on STM32MP2.

I would love to play with Yocto and Embedded kernel builds, as in my job unfortunately we are writing on bare metal, as we yearn energy - our devices needs to work up to 16 years, thus neither Linux nor even RTOS are valid here. Of course there are some disadvantages - we are not even close to real-time, although we do not it.

Nevertheless (too much on my job) - I somehow get STM32MP257F, thus I can play with it!

OpenOCD

Of course - OpenOCD does not support STM32MP2x in apt packed version. When I am writing this package the latest version commit is was authored @ Oct 3, 2024, and latest released OpenOCD version was v0.12.0-rc3, which did not have MP2 support yet.

That leads to me building OpenOCD from scratch.

I needed to install libjim-dev to on Debian Sid to overcome the issue with:

configure: error: jimtcl is required but not found via pkg-config and system includes

After that I was able to connect to my board via:

/usr/local/bin/openocd -f tcl/board/st/stm32mp257f-dk.cfg

Make connection

According to STM wiki to make an connection via OpenOCD I needed to put the devboard into Development boot by switching BOOT0 and BOOT1 to ON positions.

Without this I got this error gdb:

Info : accepting 'gdb' connection on tcp/3335
Error: Target not examined yet
Error: [stm32mp25x.m0p] Execution of event gdb-attach failed:
embedded:startup.tcl:1664: Error:
Traceback (most recent call last):
  File "embedded:startup.tcl", line 1664
    halt 1000
Info : New GDB Connection: 1, Target stm32mp25x.m0p, state: examine deferred
Error: [stm32mp25x.m0p] Target not examined yet, refuse gdb connection 1!
Error: attempted 'gdb' connection rejected

Compiling Yocto

Okay, now when I have the OpenOCD connection, I do have compile Yocto. Of course I could simply download OpenST distro, but as we all know a samurai has no goal, only the path, thus I had to build it from scratch, to not have it too easy. Actually the world helped - DockerHub have many images. The best I have found was Crops' build, and this is probably the image I will use, although it have ton of weird scripts, which I have to analyze, before I run it. I have found also Gianpaolo Macario image, but it was pretty outdated, and not able to build yocto-5.4, due to missing dependencies, as well as obsolete Python3.8.1, whereas bitbake required at least Python3.9. This is Ubuntu based image, and seemed abandoned, so I have decided not to create PRs to it.

Maybe I will create my own Docker image, tho I am curious why Crops' needs that much of scripts.


TO BE CONTINUED