# STM32MP257F-DK Study ## Why choose STM32MP257F-DK? * From hardware perspectives * Support heterogeneous computing * Primary Processor: ARM Cortex‑A35 (dual-core) * Coprocessor: ARM Cortex‑M33 (single-core) * Support ARM trusted firmware: [Boot chain overview](https://wiki.st.com/stm32mpu/wiki/STM32MP2_boot_chain_overview) * BL1: BootROM * BL2: TF-A * BL31: TF-A * BL32: OP-TEE * BL33: U-Boot * Non-Secure OS: Linux * From software perspectives * STM32 provides well-written docs. * STM32 community is very active. ## Where to order? You can order it from different sources in Taiwan. * [Mouser](https://mou.sr/4a4fPQv) * [DigiKey](https://www.digikey.tw/short/42trdf03) ## Enviroment Setup * PC 1. Install [Ubuntu 24.04.3 LTS](https://documentation.ubuntu.com/desktop/en/latest/tutorial/install-ubuntu-desktop/#install-ubuntu-desktop) on your PC. 2. Disable [GRUB_DISABLE_OS_PROBER](https://askubuntu.com/questions/1475735/check-grub-disable-os-prober) if dual boot like Win+Ubuntu is needed. 3. Follow [stm32mpu wiki: PC prerequisites](https://wiki.st.com/stm32mpu/wiki/PC_prerequisites) to install packages. 4. Follow [stm32mpu wiki: directory structure](https://wiki.st.com/stm32mpu/wiki/Example_of_directory_structure_for_Packages) to create your working directory. ```shell working-directory ├── Developer-Package │ ├── en.SOURCES-stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27.tar.gz │ ├── SDK-x86_64-stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11.tar.gz │ ├── stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11 │ │ ├── sdk │ │ └── sources │ │ ├── cli_hello_world_example │ │ └── gtk_hello_world_example │ └── stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27 │ └── sources │ └── ostl-linux └── Starter-Package ├── FLASH-stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11.tar.gz └── stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11 └── images └── stm32mp2 ``` ## Starter Package: STM32 official images The following steps are for Arm Cortex-A35 flavor. 1. Follow [stm32mpu wiki: images](https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP2_boards/STM32MP257x-DK/Let%27s_start/Populate_the_target_and_boot_the_image) to flash the board and bring Linux (i.e. OpenSTLinux - Weston) up from the SD card. 2. Follow [stm32mpu wiki: basic commands](https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP2_boards/STM32MP257x-DK/Let%27s_start/Execute_basic_commands) to interact with the board. ```shell # UART minicom -D /dev/ttyACM0 # SSH ssh root@192.168.7.1 ``` ## Developer Package The following steps are for Arm Cortex-A35 flavor. ### Source Code #### Board Support Package (BSP) Follow [stm32mpu wiki: BSP](https://wiki.st.com/stm32mpu/wiki/STM32MPU_Developer_Package#Installing_the_OpenSTLinux_BSP_packages) to fetch and extract the source code. ```shell= cd Developer-Package tar xvf en.SOURCES-stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27.tar.gz ``` #### Software Development Kit (SDK) 1. Follow [stm32mpu wiki: install SDK](https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP2_boards/STM32MP257x-DK/Develop_on_Arm_Cortex-A35/Install_the_SDK) to fetch and extract the source code. ```shell= cd Developer-Package/ tar xvf SDK-x86_64-stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11.tar.gz ``` 2. Souce the environmemt script ```shell= cd Developer-Package/ source stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11/sdk/environment-setup-cortexa35-ostl-linux ``` ### User-space Applications * GUI hello-world Follow [stm32mpu wiki: GUI hello-world](https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP2_boards/STM32MP257x-DK/Develop_on_Arm_Cortex-A35/Create_a_simple_hello-world_application) to build and deploy the GUI hello world application. ```shell= cd Developer-Package/stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11/sources/gtk_hello_world_example/ make scp gtk_hello_world root@192.168.7.1:/usr/local ``` * CLI hello-world Follow [stm32mpu wiki: CLI hello-world](https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Developer_Package#Adding_a_-22hello_world-22_user_space_example) to build and deploy the CLI hello world application. ```shell= cd Developer-Package/stm32mp2-openstlinux-6.6-yocto-scarthgap-mpu-v25.06.11/sources/cli_hello_world_example/ make scp hello_world_example root@192.168.7.1:/usr/local ``` ### Linux Kernel 1. Follow [stm32mpu wiki: Kernel](https://wiki.st.com/stm32mpu/wiki/Cross-compile_with_OpenSTLinux_SDK#Modifying_the_Linux_kernel) to fetch Linux Kernel source code. ```shell= cd Developer-Package/stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27/sources/ostl-linux/linux-stm32mp-6.6.78-stm32mp-r2-r0 git clone https://github.com/STMicroelectronics/linux.git cd linux git checkout -b WORKING v6.6-stm32mp-r2 ``` 2. Create output directory ```shell= cd Developer-Package/stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27/sources/ostl-linux/linux-stm32mp-6.6.78-stm32mp-r2-r0/linux/ export OUTPUT_BUILD_DIR=$PWD/../build mkdir -p ${OUTPUT_BUILD_DIR} ``` 3. Config Kernel ```shell= cd Developer-Package/stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27/sources/ostl-linux/linux-stm32mp-6.6.78-stm32mp-r2-r0/linux/ make O="${OUTPUT_BUILD_DIR}" defconfig fragment*.config for f in `ls -1 ../fragment*.config`; do scripts/kconfig/merge_config.sh -m -r -O ${OUTPUT_BUILD_DIR} ${OUTPUT_BUILD_DIR}/.config $f; done (yes '' || true) | make oldconfig O="${OUTPUT_BUILD_DIR}" ``` 4. Build Kernel, DTB and modules ```shell= cd Developer-Package/stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27/sources/ostl-linux/linux-stm32mp-6.6.78-stm32mp-r2-r0/linux/ make Image.gz vmlinux dtbs modules compile_commands.json O="${OUTPUT_BUILD_DIR}" ``` 5. Deploy Kernel and DTB ```shell= mkdir -p ${OUTPUT_BUILD_DIR}/install_artifact/boot/ cp ${OUTPUT_BUILD_DIR}/arch/${ARCH}/boot/Image.gz ${OUTPUT_BUILD_DIR}/install_artifact/boot/ find ${OUTPUT_BUILD_DIR}/arch/${ARCH}/boot/dts/ -name 'st*.dtb' -exec cp '{}' ${OUTPUT_BUILD_DIR}/install_artifact/boot/ \; scp -r ${OUTPUT_BUILD_DIR}/install_artifact/boot/* root@192.168.7.1:/boot/ ``` 6. Deploy modules ```shell= make INSTALL_MOD_PATH="${OUTPUT_BUILD_DIR}/install_artifact" modules_install O="${OUTPUT_BUILD_DIR}" rm -f ${OUTPUT_BUILD_DIR}/install_artifact/lib/modules/6.6.78-gf01241fbba4d/build scp -r ${OUTPUT_BUILD_DIR}/install_artifact/lib/modules/* root@192.168.7.1:/lib/modules/ ssh root@192.168.7.1 /sbin/depmod -a ``` 7. Reboot the board ```shell= ssh root@192.168.7.1 sync ssh root@192.168.7.1 reboot ``` ### BL33: U-Boot 1. Follow [stm32mpu wiki: U-Boot](https://wiki.st.com/stm32mpu/wiki/Cross-compile_with_OpenSTLinux_SDK#Modifying_the_U-Boot) to fetch the source code. ```shell= cd Developer-Package/stm32mp-openstlinux-6.6-yocto-scarthgap-mpu-v25.08.27/sources/ostl-linux/u-boot-stm32mp-v2023.10-stm32mp-r2-r0 git clone https://github.com/STMicroelectronics/u-boot.git cd u-boot git checkout -b WORKING v2023.10-stm32mp-r2 ``` 2. TBD