Elprotronic GangFlasher ST provides convenient procedure for programming boards with ST MPx microprocessor inside. Within this procedure called User-Defined boards programming it is possible to automatically adapt user Device Trees. They provide non-recoverable peripherals and external devices as a static structure. One of GangFlasher (GF) functionalities is export of used minimal Device Tree (DTmin) and direct user correction of used nodes via DTmin configuration file. Let us consider one of microprocessor (MPU) Vendor example board, in this case it will be Karo TXMP-1570 board.
1. GangFlasher-CLI example
Firstly compile GF-CLI with F_LoadOS()
functionality (argument cmd
cmd equal 3). GF-CLI functionalities are described in details in GF-CLI tutorial. To setup Karo in GF User-Defined mode please set in configuration file and load it with usage of function F_LoadTargetConfig()
:
MCU_name Karo UserDefined_Board_1_Name Karo UserDefined_Board_1_tfa_File /home/UserXX/Karo/tf-a-stm32mp157c-txmp-1570-trusted.stm32 UserDefined_Board_1_zImage_File /home/UserXX/Karo/fip-stm32mp157c-txmp-1570-trusted.bin
Compile and run this configuration, in UART console there will be shown log:
INFO: DT: bsec_probe() OK INFO: DT: dt_open_and_check() OK INFO: DT: stm32mp1_clk_probe() OK ERROR: CLKSRC 281 start failed @ 0x50000028: 0x1 INFO: DT: stm32mp1_clk_init() ERROR ERROR: TFA PANIC at func: "bl2_el3_plat_arch_setup() file "plat/st/stm32mp1/bl2_plat_setup.c" l.:322"; PANIC at PC : 0x2ffec63f Exception mode=0x00000016 at: 0x2ffec63f
In this particular setup (environment is ST Toolkit version 4, and board Karo TXMP-1570 with STM32MP157C MPU) the problem lies in HSE configuration. Documentation could be found in STM32MP157 Reference Manual (RM0436 Rev 6, pp.526) and Trusted Firmware ARM (TFA) synchronized with ST Toolkit version 4 (Developer Package v4 TFA/plat/st/stm32mp1/bl2_plat_setup.c
l. 322 provides about probable problem with clock). It is quite easy to figure out where lies source of problem - in clock or uart configuration.
2. Karo environment
Secondly please analyze Karo documentation and build environment with Karo build tutorial. Then build image with usage of provided instructions and analyze board TFA source code. Find board Device Tree and analyze clock and uart nodes.
3. DTmin analysis
Thirdly export minimal Device Tree used in GangFlasher-ST. For doing this there is special DLL function. In GF-CLI use function F_SaveDTmin(DTMIN_TYPE_FSBL, (char*)"DTmin.dtb")
to save processed DTmin. Exported file must be recompiled with usage od Device Tree Compiler (DTC) dtc -I dtb -O dts -o DTmin.dts DTmin.dtb
. Open recompiled DTmin source file and compare it with recompiled Karo source code. Recompilation means that firstly there must be avaiable binary version of DT and then it is recompiled with DTC to human-readable source version. It could be ease to compare two recompiled source files with source comparison tool for example Meld.
It is obvious that clocks node could differ in HSE Digital clock source bypass mode. It is possible to edit GangFlasher minimal Device Tree with usage of DTmin configuration file.
4. DTmin configuration file
It is possible to provide user fine-tuning of GangFlasher minimal Device Tree. Functionalities consist of:
add/remove node (
ADD/RM
),add/remove subnode,
add/remove node/subnode property.
In case of Karo TXMP board this will be as easy as removal of subnode property:
#echo "RM clk-hse st,digbypass" > /home/UserXX/Karo/DTmin_config.cfg
Provided changes are automatically included in FSBL and SSBL Device Trees (TFA DT; TFA-OPTEE DT; UBOOT DT; LINUX DT which is the same as UBOOT DT). Load DTmin config file before run functions (f.e. F_AutoProgram()
or F_LoadOS()
via function F_LoadDTminConfig("/home/UserXX/Karo/DTmin_config.cfg")
. After reset Karo TXMP board boots normally.
INFO: DT: bsec_probe() OK INFO: DT: dt_open_and_check() OK INFO: DT: stm32mp1_clk_probe() OK INFO: DT: stm32mp1_clk_init() OK NOTICE: CPU: STM32MP157CAB Rev.B NOTICE: Model: STMicroelectronics custom TFA Elprotronic; 5.15 NOTICE: Bootrom authentication failed INFO: DT: fixed_regulator_register() OK INFO: DT: stm32_iwdg_init() OK INFO: Reset reason (0x15): INFO: Power-on Reset (rst_por) INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe2000 INFO: FCONF: Reading firmware configuration information for: stm32mp_io INFO: Using USB INFO: Instance 2 INFO: Boot used partition fsbl1 INFO: ==== bl2_el3_plat_arch_setup() executed successfully. ==== NOTICE: BL2: v2.6-stm32mp1-r1.0 NOTICE: BL2: Built : 13:14:26, Nov 23 2021 INFO: BL2: Doing platform setup INFO: RAM: DDR3-DDR3L 16bits 533000kHz INFO: Memory size = 0x8000000 (128 MB) INFO: DFU USB START...