一、STM32MP157

1. 系列介绍

STM32MP157微处理器基于灵活的双Arm® Cortex®-A7内核(工作频率800 MHz)和Cortex®-M4内核(工作频率209 MHz)架构,并配一个专用的3D图形处理单元(GPU)、MIPI-DSI显示接口、以及一个CAN FD接口。

STM32MP157 3D OpenGL ES 2.0图形引擎专为在图形用户界面(GUI)、菜单显示或动画等应用中加速3D图形而设计,可以配合面向行业标准API优化的软件堆栈,支持Android™和Linux®嵌入式开发平台。

除了一个LCD-TFT显示控制器,STM32MP157系列还内嵌多达37个通信外设,包括10/100M或千兆以太网、3个 USB 2.0主机/OTG、29个定时器和高级模拟器件。

除了真随机数生成器(TRNG)、硬件加密和哈希处理器之外,安全选项还包括安全启动、TrustZone®外设、以及主动篡改检测功能。

STM32MP157开发笔记 | 01 - 开发环境搭建_python

2. STM32MP157A概览

STM32MP157开发笔记 | 01 - 开发环境搭建_3d_02

3. 文档

4. 工具与软件

STM32MP157开发笔记 | 01 - 开发环境搭建_python_03

4.1. STM32MP1 OpenSTLinux开发套件

This developer package provides elements for the OpenSTLinux Distribution (development on Arm® Cortex®-A processor).

It includes the software development kit (SDK software development kit), based on Yocto SDK software development kit, for cross-development on an host PC.

It also includes the following pieces of software in source code:


  • Linux® kernel
  • U-Boot
  • trusted firmware-A (TF-A)
  • an optional open source trusted execution environment (OP-TEE)

Note that the application frameworks for the OpenSTLinux Distribution are not available as source code in this package.

STM32MP157开发笔记 | 01 - 开发环境搭建_3d_04

5. STM32MPU wiki

Wiki地址:​​https://wiki.stmicroelectronics.cn/stm32mpu​​。

开发流程:

STM32MP157开发笔记 | 01 - 开发环境搭建_python_05

二、A核开发环境搭建(Develop on Arm® Cortex®-A7)

STM32MP157开发笔记 | 01 - 开发环境搭建_python_06

1. 系统要求

STM32MP157开发笔记 | 01 - 开发环境搭建_3d_07

存储空间建议100G,我安装完SDK之后的空间占用情况如下:

STM32MP157开发笔记 | 01 - 开发环境搭建_python_08

本文中我使用ubuntu 18.04,阿里源。

2. 安装SDK

(1)安装额外的包:

OpenEmbedded/Yocto需要的包:

sudo apt-get update
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 pylint xterm
sudo apt-get install make xsltproc docbook-utils fop dblatex xmlto
sudo apt-get install libmpc-dev libgmp-dev

开发包中需要用到的包:

sudo apt-get install libncurses5 libncurses5-dev libncursesw5-dev libssl-dev linux-headers-generic u-boot-tools device-tree-compiler bison flex g++ libyaml-dev libmpc-dev libgmp-dev

安装repo:

sudo apt-get install repo

一些有用的工具:

sudo apt-get install coreutils bsdmainutils sed curl bc lrzsz corkscrew cvs subversion mercurial nfs-common nfs-kernel-server libarchive-zip-perl dos2unix texi2html diffstat libxml2-utils

(2)额外的配置

Linux系统上,默认允许MMC上有8个分区,修改支持16个分区,将以下选项添加到modprobe中:

echo 'options mmc_block perdev_minors=16' > /tmp/mmc_block.conf
sudo mv /tmp/mmc_block.conf /etc/modprobe.d/mmc_block.conf

(3)下载SDK

下载链接

下载后放到 $HOME/STM32MPU_workspace/tmp 路径下,重命名为.tar.xz格式,解压:

cd $HOME/STM32MPU_workspace/tmp
tar xvf en.SDK-x86_64-stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17.tar.xz

(4)安装SDK

创建 STM32MP15 开发包SDK 路径:

mkdir -p $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.1.0/Developer-Package/SDK

给脚本可执行权限:

sudo chmod +x stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sdk/st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-3.1.11-openstlinux-5.10-dunfell-mp1-21-11-17.sh

执行脚本(将命令中的mculover666替换为自己的用户名):

./stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/sdk/st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-3.1.11-openstlinux-5.10-dunfell-mp1-21-11-17.sh -d /home/mculover666/STM32MPU_workspace/STM32MP15-Ecosystem-v3.1.0/Developer-Package/SDK

安装完成后如图:

STM32MP157开发笔记 | 01 - 开发环境搭建_python_09

(5)环境变量生效:

cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystem-v3.1.0/Developer-Package
source SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi

(6)检查SDK是否可用

① 检查目标架构(arm):

echo $ARCH

② 检查目标工具的工具链二进制前缀(arm-ostl-linux-gnueabi-):

echo $CROSS_COMPILE

③ 检查交叉编译器:

echo $CC

结果:

arm-ostl-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/mculover666/STM32MPU_workspace/STM32MP15-Ecosystem-v3.1.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi

④ 检查交叉编译器版本:

$CC --version

结果如下:

arm-ostl-linux-gnueabi-gcc (GCC) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

⑤ 检查SDK版本:

echo $OECORE_SDK_VERSION

结果如下:

3.1.11-openstlinux-5.10-dunfell-mp1-21-11-17

至此,SDK安装完成,STM32MP157 开发环境搭建完成。