MarvellEmbeddedProcessors / atf-marvell

BSD 3-Clause "New" or "Revised" License
24 stars 24 forks source link

Booting from EMMC on Armada 3700 does not work #3

Closed k-o-s-m-o closed 6 years ago

k-o-s-m-o commented 6 years ago

The EMMCNORM boot is not working. BootROM finds the firmware in partition 1 (as expected), loads and "executes" TIM_ATF.bin (TIM-1.0 string appears on the console). However other firmware components are not loaded (neither wtmi.bin nor boot-image.bin). The BootROM just starts looking for firmware in next EMMC partition.

The attached archive contains logic analyzer session capture which illustrates the problem.

MMC Boot.zip

ezaluzec commented 6 years ago

@k-o-s-m-o , sorry if this issue is stale but did you ever resolve? There appears to be espressobin emmc support from armbian community. Not sure if your A3700 platform can re-use any of their work.

I'm currently observing the same issue that you have reported, where BootROM finds the firmware in partition 1; loads and "executes" TIM_ATF.bin (TIM-1.0 string appears on the console) but then halts. However, my build steps is with using a trusted bootloader signed by keys other then the generic keys provided. I wanted to know if you were using a trusted or untrusted bootloader.

Repository branch/commits using:

k-o-s-m-o commented 6 years ago

Hi @ezaluzec.

The issue still exists in the newest firmware, however I was able to trace it down. It looks that firmware component size must be aligned to 4 bytes if you would like to boot from EMMC. If you pad the WTMI binary to correct its size, everything works.

The atf-marvell Makefile ensures that other firmware components have correct size, however this step is skipped for the WTMI binary.

Best Regards, k-o-s-m-o

kostapr commented 6 years ago

Should be already fixed in 17.10 release

Author: allen yan <yanwei@marvell.com>
Date:   Wed Jun 21 17:02:20 2017 +0800

    fix: makefile: a3700: pad boot-image.bin for 4-bytes alignment

    - In eMMC download mode, the ROM checks if the size and address
      are aligned to 4 byte.  If not aligned, it will report
      SDMMC_ADDR_MISALIGN_ERROR.
    - This patch align the boot-image.bin size to 4 bytes.

    Change-Id: I97f390c78797ca403f0353bdd9c99625ab412eb3
    Signed-off-by: allen yan <yanwei@marvell.com>
    Reviewed-on: http://vgitil04.il.marvell.com:8080/40661
    Reviewed-by: Wilson Ding <dingwei@marvell.com>
    Tested-by: Wilson Ding <dingwei@marvell.com>

diff --git a/Makefile b/Makefile
index 6f87b6e..9322e01 100644
--- a/Makefile
+++ b/Makefile
@@ -785,6 +785,7 @@ ifeq ($(PLAT),a3700)
 fip: ${BUILD_PLAT}/${FIP_NAME} ${DOIMAGETOOL}
        $(shell truncate -s %128K ${BUILD_PLAT}/bl1.bin)
        $(shell cat ${BUILD_PLAT}/bl1.bin ${BUILD_PLAT}/${FIP_NAME} > ${BUILD_PLAT}/${BOOT_IMAGE})
+       $(shell truncate -s %4 ${BUILD_PLAT}/${BOOT_IMAGE})
        @echo
        @echo "Building uart images"
        $(TIMBUILD) $(TIMBLDUARTARGS)
k-o-s-m-o commented 6 years ago

Hi @kostapr.

The patch you presented corrects size of boot-image.bin. The problematic binary is wtmi.bin. Problem is still not resolved. Just check the size of all binaries listed in TIM:

Image ID:                       0x54494D48              ; TIMH
Next Image ID:                  0x57544d49              ; WTMI next
Flash Entry Address:            0x00000000              ; TIM flash addr
Load Address:                   0x20006000              ; TIM ISRAM addr
Image Size To CRC in bytes:     0xFFFFFFFF
Hash Algorithm ID:              32                      ; SHA-256
Partition Number:               1
Image Filename: TIM_ATF.bin <= This is OK.

Image ID:                       0x57544d49              ; WTMI
Next Image ID:                  0x4F424d49              ; OBMI next
Flash Entry Address:            0x00004000              ; WTMI flash addr
Load Address:                   0x1FFF0000              ; WTMI RAM addr
Image Size To CRC in bytes:     0xFFFFFFFF
Hash Algorithm ID:              32                      ; SHA-256
Partition Number:               1
Image Filename: $(WTP)/wtmi/build/wtmi.bin <= Here is the problem.

Image ID:                       0x4F424d49              ; OBMI
Next Image ID:                  0xFFFFFFFF              ; NONE
Flash Entry Address:            0x00015000              ; OBMI flash addr
Load Address:                   0x64100000              ; OBMI RAM addr
Image Size To CRC in bytes:     0xFFFFFFFF
Hash Algorithm ID:              32                      ; SHA-256
Partition Number:               1
Image Filename: ./build/a3700/release/boot-image.bin <= This is OK.
kostapr commented 6 years ago

Sorry for late response. I believe this is the patch you need. It's not yet published, but will be a part of the next release.

commit 59bfb58cff3d8433449ef05c0af66b4abf7ea11f
Author: jinghua <jinghua@marvell.com>
Date:   Thu Mar 22 19:49:08 2018 +0800

    fix: Makefile: a3700: align wtmi image with 4 bytes

    To boot from eMMC, there is a limitation that each firmware
    component size has to be aligned with 4 bytes.
    Since u-boot image has already been aligned, this patch does
    it for WTMI image.

    Change-Id: Ie8f4517d5f04baedc7bca2bd230c5ce2f73b3e3a
    Signed-off-by: jinghua <jinghua@marvell.com>
    Reviewed-on: http://vgitil04.il.marvell.com:8080/52417
    Reviewed-by: Kostya Porotchkin <kostap@marvell.com>
    Tested-by: iSoC Platform CI <ykjenk@marvell.com>
    (cherry picked from commit 1eed2fc33ab121f2792c8829f5dd96796a4a0a7e)
    Reviewed-on: http://vgitil04.il.marvell.com:8080/52685

diff --git a/Makefile b/Makefile
index 68e5003..30b818d 100644
--- a/Makefile
+++ b/Makefile
@@ -810,6 +810,7 @@ fip: ${BUILD_PLAT}/${FIP_NAME} ${DOIMAGETOOL}
        $(shell truncate -s %128K ${BUILD_PLAT}/bl1.bin)
        $(shell cat ${BUILD_PLAT}/bl1.bin ${BUILD_PLAT}/${FIP_NAME} > ${BUILD_PLAT}/${BOOT_IMAGE})
        $(shell truncate -s %4 ${BUILD_PLAT}/${BOOT_IMAGE})
+       $(shell truncate -s %4 $(WTMI_IMG))
        @echo
        @echo "Building uart images"
        $(TIMBUILD) $(TIMBLDUARTARGS)
k-o-s-m-o commented 6 years ago

Hi @kostapr

Yes, this one should fix the issue. Thank you.