1、什么是 STM32MPU
STM32MPU是 ST 推出的 Cortex-A7 + Cortex-M4 多核异构处理器
2、开发资源(ST官方)
1.硬件
目前为止(20190618),能够在官网找到的开发板有4款,分两类:
2.软件
ST官方推荐使用ubuntu 64bit,可以直接安装到PC里也可以是虚拟机(参考PC_prerequisites)。
安装完系统后,还需要安装一些依赖和软件:
sudo apt-get update
sudo apt-get install sed wget curl cvs subversion git-core coreutils unzip
texi2html texinfo docbook-utils gawk python-pysqlite2 diffstat help2man
make gcc build-essential g++ desktop-file-utils chrpath libxml2-utils xmlto
docbook bsdmainutils iputils-ping cpio python-wand python-pycryptopp
python-crypto
sudo apt-get install libsdl1.2-dev xterm corkscrew nfs-common nfs-kernelserver device-tree-compiler mercurial u-boot-tools libarchive-zip-perl
sudo apt-get install ncurses-dev bc linux-headers-generic gcc-multilib
libncurses5-dev libncursesw5-dev lrzsz dos2unix lib32ncurses5 repo libssldev
sudo apt-get install default-jre
下载:
解压:
tar xvf en.SDK-x86_64-stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31.tar.xz
修改权限:
chmod +x stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sdk/st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-3.1-openstlinux-5.10-dunfell-mp1-21-03-31.sh
新建个目录用做该编译器的安装目录:
mkdir STM32MP
cd STM32MP
mkdir SDK
安装:
$HOME/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/sdk/st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-3.1-openstlinux-5.10-dunfell-mp1-21-03-31.sh -d $HOME/STM32MP/SDK
SDK的安装目录提供一个脚本文件用来设置环境变量,该脚本文件是:
$HOME/STM32MP/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi
看下该脚本文件中有什么内容:
该文件主要就是设置一些环境变量,比如,如果你要用arm-openstlinux_weston-linux-gnueabi-gcc的话,可以使用变量CC。
首先使能环境变量
source $HOME/STM32MP/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi
查看下CC是什么内容:
hl@hl-ub:~$ echo $CC
arm-openstlinux_weston-linux-gnueabi-gcc -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/ub/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi
可以看到CC指定了编译器,设置了编译选项,还指定了sysroot路劲
创建一个简单的C程序,保存为helloworld.c:
#include <stdio.h>
int main(int argc,char **argv)
{
printf(“Hello STM32MP1\n”);
return 0
}
编译:
$CC -o helloworld helloworld.c
然后看下文件helloword信息:
编译环境安装完成
tar xvf en.SOURCES-u-boot-stm32mp1-openstlinux-4.19-thud-mp1-19-02-20.tar.xz
cd stm32mp1-openstlinux-4.19-thud-mp1-19-02-20/sources/arm-openstlinux_weston-linux-gnueabi/u-boot-stm32mp-2018.11-r0
该目录所包含的文件如下:
里面有一些补丁文件(*.path),有个说明文件,还有uboot源码:
解压uboot源码并打补丁:
tar xvf v2018.11.tar.gz
cd u-boot-2018.11
for p in `ls -1 ../*.patch`; do patch -p1 < $p; done
编译之前需要设置下环境变量
basic boot:
make stm32mp15_basic_defconfig
make DEVICE_TREE=stm32mp157c-dk2 all
trusted boot:
make stm32mp15_basic_defconfig
make DEVICE_TREE=stm32mp157c-dk2 all
basic boot:
make stm32mp15_trusted_defconfig
make DEVICE_TREE=stm32mp157c-ev1 all
trusted boot:
make stm32mp15_trusted_defconfig
make DEVICE_TREE=stm32mp157c-ev1 all
下载
解压
tar xvf en.SOURCES-kernel-stm32mp1-openstlinux-4.19-thud-mp1-19-02-20.tar.xz
打补丁
for p in ls -1 ../*.patch
; do patch -p1 < $p; done
make multi_v7_defconfig fragment*.config
for f in ls -1 ../fragment*.config
; do scripts/kconfig/merge_config.sh -m -r .config $f; done
yes '' | make oldconfig
编译内核
make uImage vmlinux dtbs LOADADDR=0xC2000040
手机扫一扫
移动阅读更方便
你可能感兴趣的文章