Using STM32F769i Discovery board
Background
I used to work with 8051/2 and Microchip PIC18/24. Comparing them with recent MCU like ARM Cortex M, the M4/M7 has so much more processing power and the ability to access much more memory resources.
This is a short documentation about my findings on building uboot, Linux kernel and root file systems for the STM32F769i discovery board.
Keypoints
- uBoot: Disable Falcone Mode
- Linux kernel: Change DRAM address to 0x0c000000 and size to 0x01000000
- Rootfs: Based on default config for stm32f469
There are four lines of uBoot commands:
setenv bootargs console=ttySTM0,115200 earlyprintk consoleblank=0 ignore_loglevel
fatload mmc 0 0xc0000000 zImage
fatload mmc 0 0xc0500000 rootfs.cpio.uboot
bootz 0xc0000000 0xc0500000 0x081c0000
Preparing uBoot
wget https://source.denx.de/u-boot/u-boot/-/archive/v2021.04/u-boot-v2021.04.tar.gz
tar xzf u-boot-v2021.04.tar.gz
cd u-boot-v2021.04
make stm32f769-disco_defconfig
make menuconfig
From “SPL/TPL” uncheck “Activate Falcon Mode”
Save & exit
CROSS_COMPILE=arm-none-eabi- ARCH=arm make -j 8
The binaries we need are “u-boot.bin” and “spl/u-boot-spl.bin”
Preparing Linux Kernel
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.13.tar.xz
tar xJf linux-5.13.tar.xz
cd linux-5.13
CROSS_COMPILE=arm-none-eabi- ARCH=arm make stm32_defconfig
CROSS_COMPILE=arm-none-eabi- ARCH=arm make menuconfig
update “System Type” > “DRAM Base” = 0xc0000000 and “DRAM Size” = 0x01000000
uncheck “Boot options” -> “XIP Kernel”
CROSS_COMPILE=arm-none-eabi- ARCH=arm make -j 8
The files we need are zImage and stm32f769-disco.dtb
Preparing rootfs with Buildroot
wget https://buildroot.org/downloads/buildroot-2021.05.tar.gz
tar zxf buildroot-2021.05.tar.gz
cd buildroot-2021.05
Since there is no default configs for stm32f769, will based on stm32f469 instead
make stm32f469_disco_defconfig
make menuconfig
update “Target options” -> “Target Architecture Variant” = cortex-M7
check “Filesystem images” -> “TARGET_ROOTFS_CPIO_UIMAGE”
Not fix.. KNOW PROBLEM: Kernel Headers only have Linux 5.12.x, it would be good if it has 5.13, anyway 5.12.x header still works for the case.
Save & exit
make -j 8
the file we need is “output/images/rootfs.cpio.uboot”
Using it
Here is how the memory map looks like,
Here is how it looks like from uboot to prepare kernel to boot from,
Reference
I won’t be able to do all that without the follow blog/people/projects who kindly share their knowledge online. Thank you very much and you might find they are useful too.
- STM32F746 Discovery and U-boot | Clockwork Bird (wordpress.com)
- STM32 – eLinux.org
- buildroot-labs.pdf (bootlin.com)
- Building uClinux for STM32F7 Discovery board | A else B (wordpress.com)
- STM32F769I-disco_Buildroot/Makefile at master · fdu/STM32F769I-disco_Buildroot · GitHub
- Build Linux for STM32F769I DISCO Using Buildroot // Embedded Linux (adrianalin.gitlab.io)
- Linux Boot Options on STM32F769I DISCO // Embedded Linux (adrianalin.gitlab.io)
- STM32F7 SOM Release 2.4.0 Resource Directory (emcraft.com)
- Building uClinux for STM32F7 Discovery board | A else B (wordpress.com)
- (5) Cross-Compiling GCC Toolchain for ARM Cortex-M Processors | LinkedIn
- Buildroot with Raspberry Pi – U-Boot (ltekieli.com)