Events
Trade Shows
Seminars
Product Updates
 
          Home > News Center > Product Updates
 

Bring up the STM32MP135x - ST Training Course based on MYD-YF13X (Ⅲ)

 
2023-10-18   12:6:21     Click: 1043
 


This article will take MYIR’s MYD-YF13X and STM32MP135F-DK as examples, and continue to explain how to use STM32CubeMX combined with the developer package to implement the booting of the minimal system.



Following "Bring up the STM32MP135x - ST Training Course based on MYD-YF13X (I)"
"Bring up the STM32MP135x - ST Training Course based on MYD-YF13X (II)"


4.2 USB Boot: FW_CONFIG Configuration and Compilation

In the device tree file generated by STM32CubeMX, there is a config file stm32mp135d-myir_bring_up-mx-fw-config.dts, which defines the size of the DDR and contains the stm32mp13-fw-config.dtsi file. Once the DDR part of the configuration is completed, this file does not need to be changed and can be compiled directly to generate the stm32mp135d-myir_bring_up-mx-fw-config.dtb file, which is loaded into the board by TF-A in the form of a FIP package.

Please read WIKI How_to_configure_TF-A_FIP to learn about the FIP and the commands to generate it.

The FW_CONFIG file compiles:

PC $> cd

PC $> source

PC $> make -f ../Makefile.sdk TF_A_CONFIG=optee TF_A_DEVICETREE=stm32mp135d-myir_bring_up-mx DEPLOYDIR=../../myir_fip/arm-trusted-firmware/ stm32


After successful compilation:



In order to generate the FIP package, the rest of the components still need to be compiled: OP-TEE and U-Boot. We first compile the images of the components based on the nearly empty device tree of OP-TEE and U-Boot generated by STM32CubeMX. Note: Here we just compile a fake OP-TEE & U-Boot image first so that we can package up the FIP and load FW_CONFIG into it.

Compile OPTEE:

PC $> cd < optee-os-stm32mp-3.16.0-stm32mp-r2_path >

PC $> source

PC $> make -f ../Makefile.sdk CFG_EMBED_DTB_SOURCE_FILE=stm32mp135d-myir_bring_up-mx DEPLOYDIR=../../myir_fip/optee/ optee


Three files are generated after compilation, which need to be packaged into the FIP:




Compile U-Boot, and package FIP:

PC $> cd < u-boot-stm32mp-v2021.10-stm32mp-r2_path >

PC $> source

PC $> export FIP_DEPLOYDIR_ROOT=../../myir_fip /*Perform before any stage if requires FIP update*/

PC $> make -f ../Makefile.sdk FIP_CONFIG=optee UBOOT_DEFCONFIG=stm32mp13_defconfig DEVICETREE=stm32mp135d-myir_bring_up-mx DEPLOYDIR=../../myir_fip/u-boot/ all


Compile successfully and obtain:




Burn the generated FIP file to the board via USB and STM32CubeProgrammer. Test FW_CONFIG:

PC $> cd ../../myir_fip

PC $> STM32_Programmer_CLI -c port=usb1 -c port=usb1 -d arm-trusted-firmware/tf-a-stm32mp135d-myir_bring_up-mx-usb.stm32 0x1 -s 0x1 -d fip/fip-stm32mp135d-myir_bring_up-mx-optee.bin 0x3 -s 0x3


The serial port log after burning is as follows.

In the previous step, the serial port log stopped at:

"

INFO:    handle USB : Suspend int

INFO:    USB Suspend mode

INFO:    handle USB : Reset

"

Stuck at further load FIP, FW_CONFIG. In this section, FW_CONFIG has been packed into the FIP and burned into the board, the serial port outputs more information, please check the highlight section, and eventually stops at the OP-TEE stage, and the Error Reporting section is also highlighted. Note: if the serial output is with "x/TC", it proves that it has already jumped to OP-TEE running, for example:

I/TC: Early console on UART#4

NOTICE:  CPU: STM32MP135D Rev.Y

NOTICE:  Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23

INFO:    handle USB : Reset

INFO:    phase ID :3, Manifestation 0 at c716602a

INFO:    Send detach request

INFO:    Receive DFU Detach

INFO:    DFU USB STOP...

INFO:    BL2: Loading image id 1

INFO:    Loading image id=1 at address 0x30006000

INFO:    Image id=1 loaded: 0x30006000 - 0x300061fa

INFO:    FCONF: Reading FW_CONFIG firmware configuration file from: 0x30006000

INFO:    FCONF: Reading firmware configuration information for: mce_config

INFO:    FCONF: Reading firmware configuration information for: dyn_cfg

INFO:    FCONF: Reading firmware configuration information for: stm32mp1_firewall

INFO:    BL2: Loading image id 4

INFO:    Loading image id=4 at address 0xce200000

INFO:    Image id=4 loaded: 0xce200000 - 0xce20001c

INFO:    OPTEE ep=0xce200000

INFO:    OPTEE header info:

INFO:          magic=0x4554504f

INFO:          version=0x2

INFO:          arch=0x0

INFO:          flags=0x0

INFO:          nb_images=0x1

INFO:    BL2: Loading image id 8

INFO:    Loading image id=8 at address 0xce200000

INFO:    Image id=8 loaded: 0xce200000 - 0xce2772e8

INFO:    BL2: Loading image id 2

INFO:    Loading image id=2 at address 0xc0400000

INFO:    Image id=2 loaded: 0xc0400000 - 0xc040a4d0

INFO:    BL2: Skip loading image id 16

INFO:    BL2: Loading image id 5

INFO:    Loading image id=5 at address 0xc0000000

INFO:    Image id=5 loaded: 0xc0000000 - 0xc00e4534

NOTICE:  BL2: Booting BL32

INFO:    Entry point address = 0xce200000

INFO:    SPSR = 0x1d3

I/TC: Early console on UART#4

I/TC:

I/TC: Non-secure external DT found

I/TC: Embedded DTB found

E/TC:0 0 display_get_fb_addr_from_dtb:55 Can't find optee-framebuffer

E/TC:0 0 Panic at core/arch/arm/mm/core_mmu.c:364

E/TC:0 0 TEE load address @ 0xce200000

E/TC:0 0 Call stack:

E/TC:0 0  0xce203cb5

E/TC:0 0  0xce21bc1d

E/TC:0 0  0xce2040bb

E/TC:0 0  0xce2037e9

E/TC:0 0  0xce200198


Notes: If it is on STM32MP135F-DK, the serial port output is as follows:

NOTICE:  CPU: STM32MP135F Rev.?

NOTICE:  Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23

ERROR:   nvmem node board_id not found

INFO:    PMIC version = 0x21

INFO:    Reset reason (0x35):

INFO:      Power-on Reset (rst_por)

INFO:    FCONF: Reading TB_FW firmware configuration file from: 0x2ffe0000

INFO:    FCONF: Reading firmware configuration information for: stm32mp_io

INFO:    Using USB

INFO:      Instance 2

INFO:    Boot used partition fsbl1

NOTICE:  BL2: v2.6-stm32mp1-r2.0(debug):()

NOTICE:  BL2: Built : 05:42:16, Jul 11 2023

INFO:    BL2: Doing platform setup

INFO:    RAM: DDR3-DDR3L 16bits 533000kHz

INFO:    Memory size = 0x20000000 (512 MB)

INFO:    DFU USB START...

INFO:    handle USB : Suspend int

INFO:    USB Suspend mode

INFO:    handle USB : Reset

INFO:    handle USB : Reset

INFO:    phase ID :3, Manifestation 0 at c71661a6

INFO:    Send detach request

INFO:    Receive DFU Detach

INFO:    DFU USB STOP...

INFO:    BL2: Loading image id 1

INFO:    Loading image id=1 at address 0x30006000

INFO:    Image id=1 loaded: 0x30006000 - 0x30006246

PANIC at PC : 0x2ffe7a87

Exception mode=0x00000016 at: 0x2ffe7a87


PANIC appears after load image id 1, please note the difference between the design of the MYIR board and the STM32MP135F-DK: in addition to the different design of the power supply part, there is also a different selection of chips. MYIR uses the stm32mp135d series, while the demo board uses the stm32mp135f series. The difference between the two series is whether or not to include SAES, PKA, etc., secure IP and whether or not the DDRMCE attributes. MCE is enabled by default on the F series, and the FW_CONFIG file defines the area for DDR encryption, which needs to be configured by invoking MCE. The encryption process will use the RNG module, so the configuration of MCE, firewall need to enable the RNG in the TFA phase.


After enabling RNG, recompiling TFA, Deploy TF-A and FIP, the serial port output is as follows ( same as MYIR output):

NOTICE:  CPU: STM32MP135F Rev.?

NOTICE:  Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23

ERROR:   nvmem node board_id not found

INFO:    PMIC version = 0x21

INFO:    Reset reason (0x35):

INFO:      Power-on Reset (rst_por)

INFO:    FCONF: Reading TB_FW firmware configuration file from: 0x2ffe0000

INFO:    FCONF: Reading firmware configuration information for: stm32mp_io

INFO:    Using USB

INFO:      Instance 2

INFO:    Boot used partition fsbl1

NOTICE:  BL2: v2.6-stm32mp1-r2.0(debug):()

NOTICE:  BL2: Built : 07:44:48, Jul 11 2023

INFO:    BL2: Doing platform setup

INFO:    RAM: DDR3-DDR3L 16bits 533000kHz

INFO:    Memory size = 0x20000000 (512 MB)

INFO:    DFU USB START...

INFO:    handle USB : Suspend int

INFO:    USB Suspend mode

INFO:    handle USB : Reset

INFO:    handle USB : Reset

INFO:    phase ID :3, Manifestation 0 at c71661a6

INFO:    Send detach request

INFO:    Receive DFU Detach

INFO:    DFU USB STOP...

INFO:    BL2: Loading image id 1

INFO:    Loading image id=1 at address 0x30006000

INFO:    Image id=1 loaded: 0x30006000 - 0x30006246

INFO:    FCONF: Reading FW_CONFIG firmware configuration file from: 0x30006000

INFO:    FCONF: Reading firmware configuration information for: mce_config

INFO:    FCONF: Reading firmware configuration information for: dyn_cfg

INFO:    FCONF: Reading firmware configuration information for: stm32mp1_firewall

INFO:    BL2: Loading image id 4

INFO:    Loading image id=4 at address 0xde200000

INFO:    Image id=4 loaded: 0xde200000 - 0xde20001c

INFO:    OPTEE ep=0xde200000

INFO:    OPTEE header info:

INFO:          magic=0x4554504f

INFO:          version=0x2

INFO:          arch=0x0

INFO:          flags=0x0

INFO:          nb_images=0x1

INFO:    BL2: Loading image id 8

INFO:    Loading image id=8 at address 0xde200000

INFO:    Image id=8 loaded: 0xde200000 - 0xde2772e8

INFO:    BL2: Loading image id 2

INFO:    Loading image id=2 at address 0xc0400000

INFO:    Image id=2 loaded: 0xc0400000 - 0xc040a600

INFO:    BL2: Skip loading image id 16

INFO:    BL2: Loading image id 5

INFO:    Loading image id=5 at address 0xc0000000

INFO:    Image id=5 loaded: 0xc0000000 - 0xc00e4534

NOTICE:  BL2: Booting BL32

INFO:    Entry point address = 0xde200000

INFO:    SPSR = 0x1d3

I/TC: Early console on UART#4

I/TC:

I/TC: Non-secure external DT found

I/TC: Embedded DTB found

E/TC:0 0 display_get_fb_addr_from_dtb:55 Can't find optee-framebuffer

E/TC:0 0 Panic at core/arch/arm/mm/core_mmu.c:364

E/TC:0 0 TEE load address @ 0xde200000

E/TC:0 0 Call stack:


 
Prev:  How to Select MYIR’s STM32MP1 based CPU Modules? Next:  MYIR Attended NXP ECOSYSTEM SUMMIT in Shenzhen