cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX breaks TF-A

AMurr.2282
Associate III

When building a custom machine for the STM32MP153AAC (using yocto), the device tree generated by CubeMX for the TF-A creates the following output:

NOTICE:  CPU: STM32MP153AAB Rev.B
NOTICE:  Model: STMicroelectronics custom STM32CubeMX board
INFO:    Reset reason (0x14):
INFO:      Pad Reset from NRST
INFO:    Using USB
INFO:      Instance 2
INFO:    Boot used partition fsbl1
NOTICE:  BL2: v2.2-r1.0(release):devtool-patched-dirty
NOTICE:  BL2: Built : 13:15:56, Sep 25 2020
INFO:    Using crypto library 'stm32_crypto_lib'
INFO:    BL2: Doing platform setup
INFO:    RAM: DDR3-DDR3L 16bits 533000Khz
INFO:    Memory size = 0x10000000 (256 MB)
INFO:    BL2 runs SP_MIN setup
INFO:    BL2: Loading image id 4
INFO:    Loading image id=4 at address 0x2ffed000
INFO:    Image id=4 loaded: 0x2ffed000 - 0x2ffff000
INFO:    BL2: Loading image id 5
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :
INFO:                   Phase ID : 0
INFO:                   address 0x2ffe5928
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :
INFO:                   Phase ID : 0
INFO:                   address 0x2ffe5928
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    Start Download partition 0 to address 0xc0000000 length 0
INFO:    USB : DFU : end of download partition : 0
INFO:    Loading image id=5 at address 0xc0100000
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :
INFO:                   Phase ID : 3
INFO:                   address 0x2ffe5928
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    receive request 6
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :
INFO:                   Phase ID : 3
INFO:                   address 0x2ffe5928
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    usb_partition_size: partition size : 0xce9cf
INFO:    Start Download partition 3 to address 0xc0100000 length 846287
INFO:    USB : DFU : end of download partition : 3
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :
INFO:                   Phase ID : 0
INFO:                   address 0xffffffff
INFO:    Send detach request
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    Receive Detach
INFO:    Image id=5 loaded: 0xc0100000 - 0xc01ce9cf
NOTICE:  BL2: Booting BL32
INFO:    Entry point address = 0x2ffed000
INFO:    SPSR = 0x1d3

This is as far as it gets. The CPU appears to hang here.

After an extremely tiring and timely process of diffing/binary searching the TF-A device tree with one that works, I have found that adding the following to the generated TF-A device tree fixes the issue:

/* USER CODE BEGIN addons */
&cpu0 {
    cpu-supply = <&v1v2_vdd_core>;
};
&cpu1 {
    cpu-supply = <&v1v2_vdd_core>;
};
/* USER CODE END addons */

Where v1v2_vdd_core is a node in the pmic section:

pmic: stpmic@33 {
    compatible = "st,stpmic1";
    /* (stuff) */
    regulators {
        v1v2_vdd_core: buck1 {
                regulator-name = "v1v2_vdd_core";
                regulator-min-microvolt = <1200000>;
                regulator-max-microvolt = <1350000>;
                regulator-always-on;
                regulator-initial-mode = <0>;
                regulator-over-current-protection;
                lp-stop {
                    regulator-on-in-suspend;
                    regulator-suspend-microvolt = <1200000>;
                };
                standby-ddr-sr {
                    regulator-off-in-suspend;
                };
                standby-ddr-off {
                    regulator-off-in-suspend;
                };
        };
 
        /* (more stuff) */
    };
};

I don't understand why this fixes it, nor do I understand why it hangs in the first place.

If you need more information I'd be happy to supply it.

1 REPLY 1
Olivier GALLIEN
ST Employee

​Hi @AMurr.2282​ ,

You may know that for "sample" project as you ( STM32MP153AAC ) STM32CubeMX generate only "partial" Device Tree.

You need to fill all USER SECTION in order to get a complete and bootable Device Tree.

To help you we provide this wiki page :

https://wiki.st.com/stm32mpu/wiki/How_to_create_your_board_device_tree

+ you can use complete dts generated in case of project for DK2 or EV1 board in order to help how to fill USER SECTION

Hope it help

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.