2021-06-07 09:54 AM
In addition to this question:
https://community.st.com/s/question/0D53W00000pUh4gSAC/tfa-and-uboot-custom-compile-fails
I'm still unable to boot from qspi. I addition to question about I've discovered, that it's necessary to add STM32MP_SPI_NAND=1 option to t-fa build command line
There are two issues:
1.If I add it to commend line as described in wiki I've got following compilation error while compiling TF-A for USB :
arm-ostl-linux-gnueabi-ld.bfd: BL2's RO content has exceeded its limit.
arm-ostl-linux-gnueabi-ld.bfd: section .data VMA [000000002fffa000,000000002fffa543] overlaps section ro VMA [000000002ffea000,000000002fffafff]
arm-ostl-linux-gnueabi-ld.bfd: region `ROM' overflowed by 5444 bytes
....
../Makefile.sdk:190: recipe for target 'tf-usb' failed
2.If I add it only for nand target all ok:
Makefile.sdk line 46:
# Init default config settings
TF_A_DEVICETREE_nand ?= stm32mp157c-ed1 stm32mp157f-ed1 stm32mp157a-ev1 stm32mp157c-ev1 stm32mp157d-ev1 stm32mp157f-ev1
TF_A_EXTRA_OPTFLAGS_nand ?= STM32MP_SPI_NAND=1 STM32MP_FORCE_MTD_START_OFFSET=0x00200000
# TF_A_EXTRA_OPTFLAGS_nand ?= STM32MP_RAW_NAND=1 STM32MP_FORCE_MTD_START_OFFSET=0x00200000
TF_A_BINARY_nand ?= tf-a
TF_A_MAKE_TARGET_nand ?= all
And I've regenerated UBI image to get it fitted to 128Mb flash
Not I've got following console output while trying to boot qspi:
Download done
STM32MP> NOTICE: CPU: STM32MP157DAB Rev.Z
NOTICE: Model: STMicroelectronics STM32MP157A-DK1 STM32CubeMX board
INFO: Reset reason (0x14):
INFO: Pad Reset from NRST
INFO: PMIC version = 0x21
INFO: FCONF: Reading TB_FW firmware configuration file from: 0x2ffe3000
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using SPI NAND
INFO: Instance 1
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.4-r1.0(debug):
NOTICE: BL2: Built : 16:27:52, Jun 7 2021
INFO: BL2: Doing platform setup
INFO: RAM: DDR3-DDR3L 16bits 533000Khz
WARNING: Couldn't find property st,phy-cal in dtb
INFO: Memory size = 0x20000000 (512 MB)
INFO: BL2: Loading image id 31
ERROR: mtd_add_extra_offset: Seek error -5
WARNING: Failed to access image id=0 (-5)
WARNING: Failed to obtain reference to image id=31 (-2)
ERROR: BL2: Failed to load image id 31 (-2)
If I specify both STM32MP_SPI_NAND=1 and STM32MP_RAW_NAND=1 I've got following error:
region `ROM'
arm-ostl-linux-gnueabi-ld.bfd: BL2's RO content has exceeded its limit.
arm-ostl-linux-gnueabi-ld.bfd: region `ROM' overflowed by 1248 bytes
....
../Makefile.sdk:190: recipe for target 'tf-nand' failed
Could you please give me steps to debug this issue?
@PatrickF @Community member
2021-06-08 04:55 AM
Hi @ASkri.1 ,
I confirm that you can't build tf-a combining STM32MP_SPI_NAND=1 and STM32MP_RAW_NAND=1 or STM32MP_SPI_NAND=1 and STM32MP_USB_PROGRAMMER = 1
Those combination exceed the max authorized size.
But your trial with only STM32MP_SPI_NAND=1 trigged that this setup was not present in our delivery and maybe require some tuning.
I will ask some expert and come back
Olivier
2021-06-08 12:30 PM
2021-06-14 03:56 AM
Hi!
Do you have any news on this issue?
Thank you in advance
Looking forward for your reply
2021-06-16 12:58 AM
Hello,
ST does not deliver a ready to use configuration for the snand because we don't have any board reference to provide to the customers.
snand was a change request during the project but many customers are using it now. It is clear for us we need to improve all the documentation around this use case that is now tested on every delivery internally.
Some snand can be booted from Rom code but for TF-a, some parameters need to be provisioned from the OTP (this is the standard way of working) but in your case you may force the snand config of your memory directly in TF-A code.
I/ First of all, print the config Tf-a is seeing:
in drivers/mtd/nand/spi_nand.c:
VERBOSE("SPI_NAND Detected ID 0x%x 0x%x\n", id[0], id[1]);
VERBOSE("Page size %i, Block size %i, size %lli\n",
spinand_dev.nand_dev->page_size,
spinand_dev.nand_dev->block_size,
spinand_dev.nand_dev->size);
Replace VERBOSE by INFO to see the trace in the console.
II/ configure the snand:
In ./plat/st/stm32mp1/stm32mp1_boot_device.c:static int get_data_from_otp(struct nand_device *nand_dev, bool is_slc)
you will see the different parameters TF-a needs from the OTP.
You can patch on a first step the values from your snand memory:
nand_dev->page_size
nand_dev->block_size
nand_dev->nb_planes
I think this is the issue here but if still not working, please give your snand reference.
2021-06-17 11:11 AM
2021-06-18 03:43 AM
This is good job !
I/ INFO: SPI_NAND Detected ID *0xff* 0x2c 0x14 0x2c: The issue is from the read_id function from TF-A that does not take into account the Dummy Byte present in this Micro memory for this command. But this has no impact on the behavior because this ID code is not used at all for a Micron memory.
Then, No issue here.
II/ from your logs:
"Loading Environment from UBI... ubi0 error: validate_ec_hdr: bad VID header
offset 4096, expected 2048"
We can see the UBI FS is configured for 4K block size (that is EV1 ST NAND default block size) instead of 2K for your memory. Probably you did not update on Yocto these configurations for your device. After you do that, I think i will be ok.
I will check If I can find the right link to follow but it is self explained at list in Yocto recipe.
2021-09-19 04:55 AM
Hi, Bernard!
Thank you very much for your reply. Sorry, for very long aswer, I was little busy with other projects... Anyway I've come back, there are some steps forward and still some issues. First, about VID header offset, There are options availabla in machine.cfg file:
MKUBIFS_ARGS_nand_4_256 = "--min-io-size 2048 --leb-size 126976 --max-leb-cnt 1024 --space-fixup"
UBINIZE_ARGS_nand_4_256 = "--min-io-size 2048 --peb-size 128KiB"
EXTRA_UBIFS_SIZE_nand_4_256 = "2304"
So, I can adjust UBI image parameters.
That prpblem WAS, that these parameters are not taken into account until full rebuild, with deleting of build-openstlinuxweston-stm32mp1-duck folder. bitbale -c cleanall not helps... Is it ok? Do you have an Idea how to fix this issue without full image rebiult.
After adjusting parameters that mutch my flash I've got following other error during boot:
U-Boot 2020.10-stm32mp-r1 (Jun 07 2021 - 20:24:04 +0300)
CPU: STM32MP157DAB Rev.Z
Model: STMicroelectronics STM32MP157A-DK1 STM32CubeMX board
Board: stm32mp1 in trusted mode (st,stm32mp157a-stm32mp151-dk1-mx)
DRAM: 512 MiB
Clocks:
- MPU : 800 MHz
- MCU : 208.878 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
WDT: Started with servicing (32s timeout)
NAND: 0 MiB
MMC: STM32 SD/MMC: 0
Loading Environment from UBI... ubi0 error: vtbl_check: too large reserved_pebs 6180, good PEBs 944
ubi0 error: vtbl_check: volume table check failed: record 4, error 9
Volume table record 4 dump:
reserved_pebs 6180
alignment 1
data_pad 0
vol_type 1
upd_marker 0
name_len 6
name rootfs
crc 0xd79b6bc3
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
944 is a partition size in LEB
But what is 6180?
How to fix this?
Thank you in advance
Looking forward for your reply
2021-09-20 05:46 AM
Hello,
The variables you modified are not for snand, you need to modify these ones:
./meta-st/meta-st-stm32mp/conf/machine/include/st-machine-common-stm32mp.inc:MKUBIFS_ARGS_spinand_2_128 = "--min-io-size 2048 --leb-size 126976 --max-leb-cnt 4096 --space-fixup"
./meta-st/meta-st-stm32mp/conf/machine/include/st-machine-common-stm32mp.inc:UBINIZE_ARGS_spinand_2_128 = "--min-io-size 2048 --peb-size 128KiB"
./meta-st/meta-st-stm32mp/conf/machine/include/st-machine-common-stm32mp.inc:EXTRA_UBIFS_SIZE_spinand_2_128 = "1408"
2021-09-20 06:08 AM
Ok, thank you very much.
But how to deal with following variables:
DEVICE_BOARD_ENABLE_NAND += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand_2_128', '${CUBEMX_DTB}', '', d)}"
FLASHLAYOUT_TYPE_LABELS_spinand_2_128 = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'spinand_2_128', '${CUBEMX_DTB}', '', d)}"
BOOTFS_PARTITION_SIZE = "8192"
IMAGE_ROOTFS_MAXSIZE = "58968"
ROOTFS_PARTITION_SIZE = "${IMAGE_ROOTFS_MAXSIZE}"
USERFS_PARTITION_SIZE = "1024"
VENDORFS_PARTITION_SIZE = "10240"
?