2024-08-01 08:43 AM - edited 2024-08-01 08:51 AM
I made a custom board with the processor STM32MP151AAC3 and own firmwire https://github.com/DanielMartensson/STM32-Computer/tree/main/STM32CubeIDE/STM32-Computer-Firmware . I have compiled the TF-A by using STM32CubeIDE. It was some bugs with the TF-A configuration, but it seems I fixed them in this thread:
Solved: BUG: Label or path X_pins_y not found - Compiling ... - STMicroelectronics Community
PANIC at PC : 0x2ffec98b
Exception mode=0x00000016 at: 0x2ffec98b
I have tried to flash it with firmware of STM32MP157 with another I2C4 pin configuration. And it failed.
NOTICE: CPU: STM32MP151AAC Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157A eval daughter on eval mother
ERROR: I2C device not ready
PANIC at PC : 0x2fff101b
Exception mode=0x00000016 at: 0x2fff101b
Trying the Flashout Delete All DK1 STM32MP157a.
Exception mode=0x00000016 at: 0x2fff101b
NOTICE: CPU: STM32MP151AAC Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157A-DK1 Discovery Board
ERROR: I2C device not ready
PANIC at PC : 0x2fff101b
That means the following:
Question:
This new error must lead to an answer. What can it be?
Solved! Go to Solution.
2024-08-04 01:18 PM - edited 2024-08-04 01:19 PM
I found the solution! The solution is this.
Add this to your stm32mp15xx-<project name->-mx.dts inside the tf-a device tree.
/* USER CODE BEGIN includes */
#include "stm32mp15xx-dkx.dtsi"
#include "stm32mp15-pinctrl.dtsi"
/* USER CODE END includes */
and this
/* USER CODE BEGIN root */
aliases {
serial0 = &uart4;
};
chosen {
stdout-path = "serial0:115200n8";
};
/* USER CODE END root */
clocks {
/* USER CODE BEGIN clocks */
clk_hsi: clk-hsi {
clock-frequency = <64000000>;
/* USER CODE BEGIN clk_hsi */
/* USER CODE END clk_hsi */
};
clk_lse: clk-lse {
clock-frequency = <32768>;
st,drive = < LSEDRV_MEDIUM_HIGH >;
/* USER CODE BEGIN clk_lse */
/* USER CODE END clk_lse */
};
clk_hse: clk-hse {
clock-frequency = <24000000>;
st,digbypass;
/* USER CODE BEGIN clk_hse */
/* USER CODE END clk_hse */
};
/* USER CODE END clocks */
};
Last thing is to add cpu1 inside the stm32mp151.dtsi file in the fdts folder inside tf-a folder. Or else, you get one error when you're compiling.
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu0: cpu@0 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0>;
nvmem-cells = <&part_number_otp>;
nvmem-cell-names = "part_number";
};
cpu1: cpu@1 {
/* EMPTY */
};
};
Anyway!
With my FlashLayout, I only run to Id = 0x8 because I haven't done any more.
#Opt Id Name Type IP Offset Binary
- 0x01 fsbl-boot Binary none 0x0 arm-trusted-firmware/debug/debug-tf-a-stm32mp151a-stm32-computer-firmware-mx-usb.stm32
- 0x03 fip-boot FIP none 0x0 fip/fip-stm32mp151a-stm32-computer-firmware-mx-optee-emmc.bin
P 0x04 fsbl1 Binary mmc2 boot1 arm-trusted-firmware/tf-a-stm32mp151a-stm32-computer-firmware-mx-optee-emmc.stm32
P 0x05 fsbl2 Binary mmc2 boot2 arm-trusted-firmware/tf-a-stm32mp151a-stm32-computer-firmware-mx-optee-emmc.stm32
P 0x06 metadata1 FWU_MDATA mmc1 0x00080000 arm-trusted-firmware/metadata.bin
P 0x07 metadata2 FWU_MDATA mmc1 0x00100000 arm-trusted-firmware/metadata.bin
P 0x08 fip-a FIP mmc2 0x00180000 fip/fip-stm32mp151a-stm32-computer-firmware-mx-optee-emmc.bin
PED 0x09 fip-b FIP mmc2 0x00580000 none
PED 0x0A u-boot-env ENV mmc1 0x00980000 none
P 0x10 bootfs System mmc1 0x00A00000 st-image-bootfs-openstlinux-weston-stm32mp1.ext4
P 0x11 vendorfs FileSystem mmc1 0x04A00000 st-image-vendorfs-openstlinux-weston-stm32mp1.ext4
P 0x12 rootfs FileSystem mmc1 0x05A00000 st-image-weston-openstlinux-weston-stm32mp1.ext4
P 0x13 userfs FileSystem mmc1 0xC5A00000 st-image-userfs-openstlinux-weston-stm32mp1.ext4
This is the UART output. It seems that
I think that the memory configuration is not correct, because I have 4GB RAM.
NOTICE: CPU: STM32MP151AAC Rev.Z
NOTICE: Model: STMicroelectronics custom STM32CubeMX board - openstlinux-6.1-yocto-mickledore-mpu-v24.06.26
INFO: PMIC version = 0x21
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: FCONF: Reading firmware configuration information for: stm32mp_fuse
INFO: Using USB
INFO: Instance 2
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.8-stm32mp1-r2.0(debug):9b8d7c5be-dirty(9b8d7c5b)
NOTICE: BL2: Built : 20:53:22, Aug 3 2024
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-DDR3L 16bits 533000kHz
INFO: Memory size = 0x20000000 (512 MB)
INFO: DFU USB START...
INFO: phase ID :3, Manifestation 3 at c714f9a2
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 0x2ffff000
INFO: Image id=1 loaded: 0x2ffff000 - 0x2ffff1ea
INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0x2ffff000
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 0xde000000
INFO: Image id=4 loaded: 0xde000000 - 0xde00001c
INFO: OPTEE ep=0xde000000
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 0xde000000
INFO: Image id=8 loaded: 0xde000000 - 0xde028e08
INFO: BL2: Skip loading image id 9
INFO: BL2: Loading image id 2
INFO: Loading image id=2 at address 0xc0500000
INFO: Image id=2 loaded: 0xc0500000 - 0xc0511bd8
INFO: BL2: Skip loading image id 16
INFO: BL2: Loading image id 5
INFO: Loading image id=5 at address 0xc0100000
INFO: Image id=5 loaded: 0xc0100000 - 0xc0214c94
NOTICE: BL2: Booting BL32
INFO: Entry point address = 0xde000000
INFO: SPSR = 0x1d3
I/TC: Early console on UART#4
I/TC:
I/TC: Embedded DTB found
I/TC: OP-TEE version: f8cb4e8d8-dev (gcc version 12.3.0 (GCC)) #5 Sat Aug 3 23:25:35 UTC 2024 arm
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: Platform stm32mp1: flavor PLATFORM_FLAVOR - DT stm32mp151a-stm32-computer-firmware-mx.dts
I/TC: OP-TEE ST profile: system_services
E/TC:0 0 probe_dt_drivers:795 Probe sequence result: 0x80000000
E/TC:0 0 Panic
Conclusion:
I think I have answered my own question.
The problem was that SYSRAM did not start. But now it seems that I have made progress.
2024-08-01 09:14 AM
Hi,
please clarify how did you get this message ? Boot from flash or download from CubeProgrammer ?
Few tips (maybe already covered):
- check if HSE setting (digital clock (bypass) or crystal oscillator) is aligned between HW (e.g. OSC_OUT) and TF-A Device Tree.
e.g. if you are using a crystal, the st,digbypass should not be present in the DT
https://github.com/STMicroelectronics/arm-trusted-firmware/blob/v2.8-stm32mp/docs/devicetree/bindings/clock/st,stm32mp13-rcc.txt#L409
- Check (with an oscilloscope) if there is I2C correct transactions on the STPMIC1 pins
- Check what function could be related around address 0x2ffec98b in your compiled code.
- add more debugging messages
See also https://wiki.st.com/stm32mpu/wiki/How_to_debug_TF-A_BL2
Regards,
2024-08-01 10:22 AM - edited 2024-08-01 10:32 AM
Hi @PatrickF
>> please clarify how did you get this message ? Boot from flash or download from CubeProgrammer ?
I got the message from UART via Arduino Monitor. I downloaded TF-A from CubeProgrammer.
>> - check if HSE setting (digital clock (bypass) or crystal oscillator) is aligned between HW (e.g. OSC_OUT) and TF-A Device Tree.
e.g. if you are using a crystal, the st,digbypass should not be present in the DT
Yes. I have chosen Digital Pass and "st,digbypass" is present due to my 24 MHz Oscillator (not crystal).
>> - Check (with an oscilloscope) if there is I2C correct transactions on the STPMIC1 pins
It must be. I mean, it seems to be soldered correctly.
>> - Check what function could be related around address 0x2ffec98b in your compiled code.
How can I do that?
Update:
I re-configure all the clocks to make sure that I did not miss anything.
Still got the same error code:
19:27:23 : STM32CubeProgrammer API v2.17.0 | Windows-64Bits
19:28:25 : Read TSV File: C:\Users\danie\Downloads\en.FLASH-stm32mp1-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26\stm32mp1-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26\images\stm32mp1\flashlayout_st-image-weston\optee\FlashLyout_STM32_Computer-Firmware.tsv
19:28:25 : Number of partitions: 13
19:29:20 : UR connection mode is defined with the HWrst reset mode
19:29:21 : USB speed : High Speed (480MBit/s)
19:29:21 : Manuf. ID : STMicroelectronics
19:29:21 : Product ID : DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
19:29:21 : SN : 002600373431510433383938
19:29:21 : DFU protocol: 1.1
19:29:21 : Board : --
19:29:21 : Device ID : 0x0500
19:29:27 : Start Embedded Flashing service
19:29:27 : Memory Programming ...
19:29:27 : Opening and parsing file: tf-a-stm32mp151a-stm32-computer-firmware-mx-optee-emmc.stm32
19:29:27 : File : tf-a-stm32mp151a-stm32-computer-firmware-mx-optee-emmc.stm32
19:29:27 : Size : 224.44 KB
19:29:27 : Partition ID : 0x01
19:29:27 : Download in Progress:
19:29:30 : File download complete
19:29:30 : Time elapsed during download operation: 00:00:02.536
19:29:30 : RUNNING Program ...
19:29:30 : PartID: :0x01
----------------------------
PANIC at PC : 0x2ffec98b
Exception mode=0x00000016 at: 0x2ffec98b
2024-08-02 05:26 AM - edited 2024-08-02 05:59 AM
Hi @PatrickF
I tried to change the clocks, without success.
I tried to change the clocks so they will be exactly the same as these ones: STM32MP15 clock tree - stm32mpu
Then I generated the TF-A meta with stm32mp-stm32-computer-mx.stm32 file. I ONLY flashing the stm32mp-stm32-computer-mx.stm32 and not the fip/bin file.
I get the exactly the same issue:
PANIC at PC : 0x2ffec98b
Exception mode=0x00000016 at: 0x2ffec98b
But then I tried to use a pre-made FlashLayout FlashLayout_emmc_stm32mp157c-ed1-optee.tsv with CubeProgrammer. Then I got the classical issue that my I2C4 have wrong pinouts.
NOTICE: CPU: STM32MP151AAC Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157C eval daughter on eval mother
ERROR: I2C device not ready
PANIC at PC : 0x2fff101b
Exception mode=0x00000016 at: 0x2fff101b
So that means:
So my next question is: If I get the error 0x2ffec98b....and it's not the clocks. Perhaps you could send me the .ioc configuration file for STM32MP157x so I can copy over the most necessary parts to STM32MP151? I mean, it quite obvious that I have forgot something in the .ioc configuration.
Update:
Do you think this has caused the problem: Solved: BUG: Label or path X_pins_y not found - Compiling ... - STMicroelectronics Community
I just changed the stm32mp15-bl2.dtsi file because the pins could not be found.
2024-08-02 06:27 AM
Hi @DMårt
ST boards .ioc configuration could obtained by just loading an STM32MP157x board (EV1 or DK1/2) in CubeMX. But it might not bring so much.
For ST boards .dts, please have a look to this folder https://github.com/STMicroelectronics/arm-trusted-firmware/tree/v2.8-stm32mp/fdts (see also https://wiki.st.com/stm32mpu/wiki/STM32_MPU_device_tree#STM32MP1_series)
Regards.
2024-08-02 07:19 AM
Hi @PatrickF
I have looked at stm32mp15-bl2.dtsi and it seems that there are some errors there.
If I comment the /omit-if-no-ref/, then the error disapear. But I might think that will cause the issue that my clocks wont start.
If I don't comment the /omit-if-no-ref/ then I will get the error "Label or path not found", because my pins are named e.g "i2c2_pins_mx" and not "i2c2_pins_a".
I think the ending "_mx" is the issue here. What do you think?
2024-08-02 07:28 AM
Hi,
the I2C naming of pins reference should be consistant with pinmux definitions elsewhere in the device tree.
_mx is when it has been generated from CubeMX. _a is for our Starter Package DT (not generated from CubeMX) . This is because in starter package DT, we have to ensure multiple board support with same portions of the DTs (so we sometimes use _b when there is pin differences).
So, you should align your i2c node.
Regards.
2024-08-02 07:35 AM
But when I compile with the bulild "meta stm32mp-stm32-computer-firmware-mx" option, then I get that error.
Try it your self.
Generate an empty STM32MP151AAC3 project, setup the SDK, add the TF-A. Then go to build artifacts and build the TF-A with the "meta stm32-<your project>-mx" command.
Then you will get the errors.
I have avoid these errors by comment the "/omit-if-not-ref/". But I think that will cause another future problem. I don't know.
2024-08-02 05:02 PM - edited 2024-08-03 08:47 AM
Hi Patrick! Do you think it's the SYSRAM that causing this code?
I'm sure that it's only a configuration. My I2C peferial did start when I used another .tsv file.
I'm pretty sure that the cause of the error 0x2ffec98b
So what should I do next?
By the way, I found the new solution to the build artifact without removing any code lines. Yes, it's a BUG, but very simple to solve.
Watch: Solved: BUG: Label or path X_pins_y not found - Compiling ... - STMicroelectronics Community
2024-08-04 04:19 AM - edited 2024-08-04 04:40 AM
I have made one change. First, I did not use tf-a-usb.stm32 for fsbl-boot. Instead I was using tf-a-stm32mp151a-<projet name>-mx-optee-emmc.stm32 or tf-a-stm32mp151a-<project name>-mx-optee-sdcard.stm32. Which gave the same error code: 0x2ffec98b
But now I'm using tf-a-stm32mp151a-<project name>-mx-usb.stm32 for fsbl-boot and I got this error code now:
PANIC at PC : 0x2ffead5d
Exception mode=0x00000016 at: 0x2ffead5d
The memory map of ARM Trusted Firmware: 6.34. STMicroelectronics STM32MP1 — Trusted Firmware-A documentation
So that means that It's somthing with Bootloader 2 (BL2).
0x00000000 +-----------------+
| | ROM
0x00020000 +-----------------+
| |
| ... |
| |
0x2FFC0000 +-----------------+ \
| BL32 DTB | |
0x2FFC5000 +-----------------+ |
| BL32 | |
0x2FFDF000 +-----------------+ |
| ... | |
0x2FFE3000 +-----------------+ |
| BL2 DTB | | Embedded SRAM
0x2FFEA000 +-----------------+ |
| BL2 | |
0x2FFFF000 +-----------------+ |
| SCMI mailbox | |
0x30000000 +-----------------+ /
| |
| ... |
| |
0x40000000 +-----------------+
| |
| | Devices
| |
0xC0000000 +-----------------+ \
| | |
0xC0100000 +-----------------+ |
| BL33 | | Non-secure RAM (DDR)
| ... | |
| | |
0xFFFFFFFF +-----------------+ /
What I have done is to change the build artifact for tf-a sources. I have replaced ..=optee-sdcard with ..=optee-usb.
When I'm trying to build the stm32 meta <project name>-mx build artifact. I'm not sure if that's correct.
I have also change the clocks so they are 100% the same as the default initialization of the system clocks of STM32MP157F-DK1.
Notice:
In STM32CubeIDE, for U-boot and Linux, you need to manually configure the clocks by pasting them into the .dts file. Yes, it's a bug and I hope the dev team of STM32CubeIDE will solve that in next version 1.17.0.
Question:
Which build artifact for tf-a in order to implement it into the SYSRAM by changing BL2?
https://github.com/DanielMartensson/STM32-Computer/tree/main/Firmware/STM32-Computer-Firmware