Published On: June, 14, 2019 By: Eshtaartha Basu | Updated: December 7, 2022 by Greg Sheridan
This application note will help to configure STM32CubeMX to work with the OSD32MP15x, the STM32MP1 System-in-Package.
Get updates to this STM32MP1 CubeMX Application Note and all of our Technical Documentation
"*" indicates required fields
STM32CubeMX (commonly called just “CubeMX”) is a STMicroelectronics processor configuration tool with an intuitive Graphical User Interface (GUI) that helps programmers and embedded designers configure their ST microcontrollers with ease. With the launch of STM32MP15x, CubeMX tool has been extended to support the MP1 microprocessor family as well, specifically the STM32MP15x, which is integrated within the Octavo Systems OSD32MP15x SiP, the STM32MP1 System in Package. As a result, ST microcontroller users can easily apply their knowledge and experience with CubeMX to configure OSD32MP15x. Through a step-by-step process, STM32CubeMX helps generate initialization C code for the ARM® Cortex®-M4 core and partial Linux® Device Trees for ARM® Cortex®-A7 cores. Apart from code generation, CubeMX can also help perform DDR tuning, testing and power consumption estimation.
Generating initialization code for the STM32MP1 using CubeMX involves configuring Pinout, Peripherals, and Clocks. An example screenshot of the “Pinout & Configuration” window is shown in Figure 1.
This application note provides pre-configured CubeMX project files in the OSD32MP15x_MinimalConfig.zip file. The minimal pinout, peripheral and clock configuration for the OSD32MP1 is already completed in this project so that you can quickly get started with the OSD32MP15x specific SiP device. You can use these configuration settings as a starting point to make modifications for your custom design.
In addition, this app note will briefly describe the STM32MP1 CubeMX settings which you should and should not modify for the OSD32MP15x. It will also point you to important documentation and user manuals to assist you. The tutorial assumes that you are already familiar with the OSD32MP15x device and the integrated peripherals and have a basic understanding of CubeMX. If not, please use the links in Section 2 to get more information.
Notice: The information provided within this document is for informational use only. Octavo Systems provides no guarantees or warranty to the information contained.
The minimal pinout, peripheral and clock configuration for the OSD32MP15x is provided in the CubeMX projects contained in the OSD32MP15x_MinimalConfig.zip file to help you quickly get started with OSD32MP15x using OSD32MP1-RED board. The projects were created using CubeMX v6.3.0.
The files within the OSD32MP15x_MinimalConfig.zip file follow the naming convention:
“<OCTAVO PART NUMBER>_MinimalConfig.ioc”
The CubeMX configuration that is made available for OSD32MP15x SiP as part of <OCTAVO PART NUMBER>_MinimalConfig.ioc project can be classified into two groups:
These settings are discussed in the following sections.
We DO NOT recommend changing the settings listed in this section.
Since OSD32MP15x SiP integrates several components along with the STM32MP15x processor, the following CubeMX settings correspond to components within the SiP that are fixed and therefore these settings should NOT be changed. The fixed settings are also part number specific. Make sure to use the CubeMX project that corresponds to the exact part number of OSD32MP15x device you are using in your design. The fixed settings in the minimal CubeMX Project are:
The Linux distributions and other software collateral provided by Octavo Systems and ST assume the following settings to function as expected. If you choose to modify the below settings, the corresponding device trees (and/or other software components) need to be updated to reflect the same to ensure proper functionality.
All the settings that are not part of the Fixed Settings can be customized to suit your design needs. Some commonly customized settings are:
See the Octavo Systems app note: Pin Mapping Between OSD32MP15x , the STM32MP1, and Other Integrated Devices, to understand how the pins of the discrete STM32MP15x processor are mapped to the OSD32MP15x System in Package (SiP).
The CubeMX Project Manager can generate partial Linux Device Trees for the ARM® Cortex®-A7 cores. It also can generate initialization C code for the ARM Cortex-M4 core for several toolchains and IDEs. You are free to use any supported toolchain. However, the M4 initialization C code of the minimal CubeMX Project has only been tested on the System Workbench for STM32 IDE (i.e., SW4STM32) with the STM32Cube FW_MP1 V1.4.0 firmware package. The partial device tree output files of the minimal CubeMX Project have been tested on corresponding OSD32MP15x device running OpenSTLinux Developer Package Linux Kernel v3.0.0.
To learn more about these tools, see section 4.9 of the CubeMX manual.
CubeMX is capable of generating initialization code for both the Dual Core Cortex-A7 microprocessor cores and M4 microcontroller core. Before proceeding to generate the code, make sure the Pinout & Configuration, Clock Configuration and Project settings match your expectations.
To generate initialization code for A7 core and M4 core:
Before you can use the custom device tree files generated from CubeMX, you need to complete the following steps:
Flash a micro-SD card with Octavo OpenSTLinux Image using instructions from the getting started guides – OSD32MP1-RED Getting Started Guide
In order to build the custom device tree files generated from CubeMX, it is necessary to install an SDK and Developer Package Linux Kernel for cross-development on the host Ubuntu computer. To do this, please complete the following steps:
Install the Developer Package Linux Kernel v3.0.0 on the host Ubuntu computer using the instructions given in Section 2.1 of the STM32MP1 Developer Package Linux Kernel v3.0.0 Wiki page (see Caveat below)
This section will guide you through the process of building a custom Trusted Firmware A (TF-A) that uses the custom TF-A Device Tree generated from the minimal CubeMX project. The following steps assume that you are using the OSD32MP1-RED development platform from Octavo Systems. The process of loading a custom TF-A Device Tree should be similar for your custom design.
The TF-A Device Tree generated by CubeMX consists of 3 files:
<ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx-fw-config.dts
The steps to build TF-A using a custom Device Tree are as follows:
In order to build TF-A using a custom Device Tree, we need to first download and install TF-A Developer Package on a Host Ubuntu computer. To do so, follow the steps under section 2.1 of Developer Package TF-A v3.0.0 Wiki page.
The TF-A developer package provided by ST supports two toolchains:
After extracting the source code for TF-A, the following steps show how to build TF-A from Custom Device Trees:
for p in `ls -a ../*patch`;do patch -p1 < $p; done
source <SDK Installation Directory>/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
cp <CubeMX project directory>/CA7/DeviceTree/<OCTAVO PART NUMBER>_minimalconfig/tf-a/* < TF-A source code directory>/fdts/
cd <TF-A source directory>
export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts
make -f $PWD/../Makefile.sdk TF_A_DEVICETREE=<ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx FIP_CONFIG="trusted" FIP_BL32_CONF="tfa," TF_A_CONFIG="trusted sdcard" DEPLOYDIR=$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware stm32
The above procedure also generates binaries that will later be used in FIP (Firmware Image Package) generation. STM32MP1 uses FIP to load boot stage binaries including u-boot after TF-A execution is done. The procedure to generate FIP binary with custom u-boot is shown in the next section.
Update micro-SD card with your custom TF-A using steps in section 10.1.
This section will guide you through the process of building a custom U-Boot that uses the custom U-Boot Device Tree generated from the minimal CubeMX project. The following steps assume that you are using the OSD32MP1-RED development platform from Octavo Systems. The process of loading a custom U-Boot Device Tree should be similar for your custom design.
The U-Boot device tree generated by CubeMX consists of 3 files (more info on this topic here):
The steps to build U-boot using a custom Device Tree are as follows:
Before making custom edits to the U-Boot device tree or its source code, we need to first download and install U-Boot Developer Package on Host Ubuntu computer. To do so, follow the steps under section 2.1 of STM32MP1 Developer Package U-Boot v3.0.0 Wiki page
The U-Boot developer package provided by ST supports two boot chains (more on this topic here):
To build U-Boot from Custom Device Trees, follow the below steps:
for p in `ls -a ../*patch`;do patch -p1 < $p; done
source <SDK Installation Directory>/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
cp <CubeMX project directory>/CA7/DeviceTree/<OCTAVO PART NUMBER>_minimalconfig/u-boot/* < U-Boot source code directory>/arch/arm/dts/
cd <U-Boot source directory>
export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts
make -f $PWD/../Makefile.sdk all UBOOT_CONFIG=trusted UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=uboot.dtb FIP_CONFIG="trusted" FIP_BL32_CONF="tfa," DEVICE_TREE=<ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx
<U-Boot source code directory>/../../FIP_artifacts/fip
Update micro-SD card with your custom U-Boot using steps in section 10.2.
This section will guide you through the process of how to use the Linux Device Tree generated from the minimal CubeMX project. The following steps assume that you are using the OSD32MP1-RED development platform from Octavo Systems. The process of loading a custom Linux Device Tree should be similar for your custom design.
The Linux device tree generated by CubeMX consists of only one file (more info on this topic here): <ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx.dts. The steps to build a custom OpenSTLinux Device Tree are as follows:
To build your custom device tree, you will need to complete the following steps:
for p in `ls -a ../*patch`;do patch -p1 < $p; done
source <SDK Installation Directory>/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
cp <CubeMX project directory>/CA7/DeviceTree/<OCTAVO PART NUMBER>_minimalconfig/kernel/<ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx.dts <Kernel source code directory>/arch/arm/boot/dts/
cd <Linux kernel build directory>
mkdir -p ../build
make ARCH=arm O="$PWD/../build" multi_v7_defconfig fragment*.config
make ARCH=arm dtbs O="$PWD/../build"
Update micro-SD card with your custom Linux device tree using steps in section 10.3.
ls -l /dev/disk/by-partlabel/
The part labels should look like Figure 5. In this case, the part labels that start with “sdb” belong to our OpenSTLinux micro-SD card. The part labels on your computer may be slightly different (e.g., sdaX, sdcX etc)
dd if=tf-a-<ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx-sdcard.stm32 of=/dev/sdb1 bs=1M conv=fdatasync
cd <U-boot source directory>/../FIP_artifacts/fip
dd if= fip-<ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx-trusted.bin of=/dev/sdb3 bs=1M conv=fdatasync
cd <Linux kernel build directory>/arch/arm/boot/dts
cp <Linux kernel build directory>/arch/arm/boot/dts/<ST SOC PART NUMBER>-<OCTAVO PART NUMBER>_minimalconfig-mx.dtb media/<username_of_ machine>/bootfs/
As an example, for CubeMX project customization, let’s consider modifying the given <OCTAVO PART NUMBER>_MinimalConfig.ioc CubeMX project for OSD32MP1-BRK platform (https://octavosystems.com/octavo_products/osd32mp1-brk).
The OSD32MP1-BRK platform typically uses micro-SD card (on SDMMC1 interface) as its primary boot device. Let us verify if <OCTAVO PART NUMBER>_MinimalConfig.ioc project’s SDMMC1 peripheral configuration matches that of BRK or if any modification is necessary.
Open the SDMMC1 peripheral in CubeMX GUI and observe the pins listed under GPIO Settings of SDMMC1 as shown in Figure 9. All the SDMMC1 DATA, CLK and CMD pins of the given project match with the hardware configuration of BRK (BRK schematic snippet shown in Figure 10). However, micro-SD interface also uses a chip detect pin to detect the presence of micro-SD card in the slot.
CubeMX GUI currently does not list chip detect under SDMMC1 as this is not a standard SDMMC pin. But declaration of this pin has been done for you under user code in the source Linux and U-Boot device tree files of given <OCTAVO PART NUMBER>_MinimalConfig project as highlighted in Figure 11 (Pin PE7 is used in the given project because OSD32MP1-RED platform uses the same pin)
However, the BRK platform uses pin PG7 for chip detect (named SDDET in schematic shown in Figure 10). Hence it is necessary to manually modify the chip detect pin declaration by commenting out OSD32MP1-RED chip detect pin definition and uncommenting OSD32MP1-BRK chip detect pin definition in the Linux and U-Boot device tree source files as shown in Figure 12 to match BRK’s hardware before building and deploying the device trees on the BRK platform.
Failure to configure chip detect pin or other SDMMC1 pins properly will result in boot failure with boot log error similar to Figure 13.
CubeMX features additional developmental tools like the DDR Test Suite and Power Consumption Calculator. These tools can also help you make your design process easier and do not require any modifications to use with the OSD32MP15x. The CubeMX DDR Test Suite window is shown in Figure 14.
Detailed information about DDR Test Suite can be found in section 5.3 of the CubeMX manual.
The pre-configured CubeMX project file provided in the OSD32MP15x_MinimalConfig.zip package is already tuned with recommended DDR parameters for OSD32MP15x family of devices. The DDR parameters are available in the GUI form under:
The same parameters can be found in Table 1 and also in the form of a Device Tree Include File (.DTSI file) as part of pre-built CubeMX source DT files provided in OSD32MP15x_MinimalConfig.zip package:
If you need to modify the DDR parameters yourself, you can do so using the following steps:
To find more detailed information about CubeMX tools, see Sections 5.1, 5.2 and 5.3 of the CubeMX manual and also DDR configuration on STM32MP1 Series MPUs application note.
The following table lists the recommended DDR parameters for OSD32MP15x family of devices.
Register Name | Recommended Value |
DDR_MSTR | 0x00041401 |
DDR_MRCTRL0 | 0x00000010 |
DDR_MRCTRL1 | 0x00000000 |
DDR_DERATEEN | 0x00000000 |
DDR_DERATEINT | 0x00800000 |
DDR_PWRCTL | 0x00000000 |
DDR_PWRTMG | 0x00400010 |
DDR_HWLPCTL | 0x00000000 |
DDR_RFSHCTL0 | 0x00210000 |
DDR_RFSHCTL3 | 0x00000000 |
DDR_RFSHTMG | 0x0081008B |
DDR_CRCPARCTL0 | 0x00000000 |
DDR_DRAMTMG0 | 0x121B2414 |
DDR_DRAMTMG1 | 0x000A041C |
DDR_DRAMTMG2 | 0x0608090F |
DDR_DRAMTMG3 | 0x0050400C |
DDR_DRAMTMG4 | 0x08040608 |
DDR_DRAMTMG5 | 0x06060403 |
DDR_DRAMTMG6 | 0x02020002 |
DDR_DRAMTMG7 | 0x00000202 |
DDR_DRAMTMG8 | 0x00001005 |
DDR_DRAMTMG14 | 0x000000A0 |
DDR_ZQCTL0 | 0xC2000040 |
DDR_DFITMG0 | 0x02060105 |
DDR_DFITMG1 | 0x00000202 |
DDR_DFILPCFG0 | 0x07000000 |
DDR_DFIUPD0 | 0xC0400003 |
DDR_DFIUPD1 | 0x00000000 |
DDR_DFIUPD2 | 0x00000000 |
DDR_DFIPHYMSTR | 0x00000000 |
DDR_ODTCFG | 0x06000600 |
DDR_ODTMAP | 0x00000001 |
DDR_SCHED | 0x00000C01 |
DDR_SCHED1 | 0x00000000 |
DDR_PERFHPR1 | 0x01000001 |
DDR_PERFLPR1 | 0x08000200 |
DDR_PERFWR1 | 0x08000400 |
DDR_DBG0 | 0x00000000 |
DDR_DBG1 | 0x00000000 |
DDR_DBGCMD | 0x00000000 |
DDR_POISONCFG | 0x00000000 |
DDR_PCCFG | 0x00000010 |
DDR_PCFGR_0 | 0x00010000 |
DDR_PCFGW_0 | 0x00000000 |
DDR_PCFGQOS0_0 | 0x02100C03 |
DDR_PCFGQOS1_0 | 0x00800100 |
DDR_PCFGWQOS0_0 | 0x01100C03 |
DDR_PCFGWQOS1_0 | 0x01000200 |
DDR_PCFGR_1 | 0x00010000 |
DDR_PCFGW_1 | 0x00000000 |
DDR_PCFGQOS0_1 | 0x02100C03 |
DDR_PCFGQOS1_1 | 0x00800040 |
DDR_PCFGWQOS0_1 | 0x01100C03 |
DDR_PCFGWQOS1_1 | 0x01000200 |
DDR_ADDRMAP1 | 0x00070707 |
DDR_ADDRMAP2 | 0x00000000 |
DDR_ADDRMAP3 | 0x1F000000 |
DDR_ADDRMAP4 | 0x00001F1F |
DDR_ADDRMAP5 | 0x06060606 |
DDR_ADDRMAP6 | 0x0F060606 |
DDR_ADDRMAP9 | 0x00000000 |
DDR_ADDRMAP10 | 0x00000000 |
DDR_ADDRMAP11 | 0x00000000 |
DDR_PGCR | 0x01442E02 |
DDR_PTR0 | 0x0022AA5B |
DDR_PTR1 | 0x04841104 |
DDR_PTR2 | 0x042DA068 |
DDR_ACIOCR | 0x10400812 |
DDR_DXCCR | 0x00000C40 |
DDR_DSGCR | 0xF200011F |
DDR_DCR | 0x0000000B |
DDR_DTPR0 | 0x38D488D0 |
DDR_DTPR1 | 0x098B00D8 |
DDR_DTPR2 | 0x10023600 |
DDR_MR0 | 0x00000840 |
DDR_MR1 | 0x00000000 |
DDR_MR2 | 0x00000208 |
DDR_MR3 | 0x00000000 |
DDR_ODTCR | 0x00010000 |
DDR_ZQ0CR1 | 0x00000038 |
DDR_DX0GCR | 0x0000CE81 |
DDR_DX0DLLCR | 0x40000000 |
DDR_DX0DQTR | 0x12122212 |
DDR_DX0DQSTR | 0x3DB00000 |
DDR_DX1GCR | 0x0000CE81 |
DDR_DX1DLLCR | 0x40000000 |
DDR_DX1DQTR | 0x00000000 |
DDR_DX1DQSTR | 0x3DB00000 |
DDR_DX2GCR | 0x0000CE80 |
DDR_DX2DLLCR | 0x40000000 |
DDR_DX2DQTR | 0xFFFFFFFF |
DDR_DX2DQSTR | 0x3DB02000 |
DDR_DX3GCR | 0x0000CE80 |
DDR_DX3DLLCR | 0x40000000 |
DDR_DX3DQTR | 0xFFFFFFFF |
DDR_DX3DQSTR | 0x3DB02000 |
If you have any additional questions using STM32MP1 CubeMX with OSD32MP15x, you can work directly with our engineers through our Forums or Contact our sales team. .
Revision Number | Revision Date | Changes | Author |
1 | 06/11/2019 | Initial Release | Eshtaartha Basu |
2 | 08/20/2019 | Revised Release – U-Boot and TF Boot info added | Eshtaartha Basu |
3 | 07/14/2020 | Revised Release – Updated info for latest CubeMX release, DDR parameters table added | Eshtaartha Basu |
4 | 11/15/2020 | Revised Release - Updated info and project files for latest OpenSTLinux (v2.0.0) & CubeMX release (v6.0.1) | Eshtaartha Basu |
5 | 07/05/2022 | Revised Release - Updated info and project files for OpenSTLinux v3.0.0 & CubeMX release v6.3.0. CubeMX project files/instructions now revolve around OSD32MP1-RED/BRK instead of STM32MP157C-DK2. Tutorial flow has been improved for easier understanding. Added support for OSD32MP153C/157F devices. | Eshtaartha Basu/Neeraj Dantu |
Octavo Systems LLC all rights reserved
OCTAVO is registered in the U.S. Patent and Trademark Office. OSD, C-SiP, and the Octavo Logo are trademarks of Octavo Systems LLC.
"*" indicates required fields
"*" indicates required fields
"*" indicates required fields
"*" indicates required fields