goldvip1.9.0下BL2: Failed to load image id 3 ( -5 )

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

goldvip1.9.0下BL2: Failed to load image id 3 ( -5 )

Jump to solution
718 Views
wmx
Contributor III

 

我们将烧录了goldvip1.9.0的sd卡插入到自己设计的电路板,系统启动停止在以下日志

a39a7aa5665b10c0e33d1cc1ae0cab7.png

但是使用goldvip 1.10.0 系统一切正常,这是为什么?

0 Kudos
Reply
1 Solution
648 Views
wmx
Contributor III

我通过将bsp38.0有关atf mmc相关的源码合并到goldvip1.9.0下解决了这个问题,

git checkout tags/bsp38.0-2.5 -- drivers/mmc/mmc.c drivers/nxp/s32/mmc/s32_mmc.c include/drivers/mmc.h include/plat/common/common_def.h

View solution in original post

0 Kudos
Reply
6 Replies
649 Views
wmx
Contributor III

我通过将bsp38.0有关atf mmc相关的源码合并到goldvip1.9.0下解决了这个问题,

git checkout tags/bsp38.0-2.5 -- drivers/mmc/mmc.c drivers/nxp/s32/mmc/s32_mmc.c include/drivers/mmc.h include/plat/common/common_def.h
0 Kudos
Reply
696 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Can you let us know which S32G product are you using? Also, how are you using flashing the images to your SD card?

Are you using the prebuilt binaries for GoldVIP? Or are you building your own?

Overall, this error seems to be related to the flashing process of the image itself. More information is provided under the following community thread:

"BL2: Failed to load image id 3 (3)" with BSP35 binaries - NXP Community

Please, let us know.

0 Kudos
Reply
685 Views
wmx
Contributor III

使用的是s32g2,具体型号如下

wmx_4-1719968838192.jpeg

使用的均是从官方网站上下载的预先编译好的镜像文件,sd卡烧入方式windows使用win32diskimager、rufus和linux dd命令均有尝试过,包括你发的链接的里的方式也尝试过,还是一样的现象

 

0 Kudos
Reply
678 Views
wmx
Contributor III

还有一个现象就是,所有做好的goldvip1.9.0、1.10.0的sd卡,在官方rdb2板是可以正常启动的。

 

查看源码视乎是在atf源码出的问题,我添加了一些打印内容(附件是我添加的内容),并将atf修改为debug版本,可以看到以下日志

wmx_0-1719969790973.png

根据WARING: Failed to load image id=3 (-5),我又增加了一些调试信息,

定位到问题是arm-trusted-firmware/drivers/mmc/mmc.c文件内的
mmc_send_cmd函数
 
该函数会调用
ret = ops->send_cmd(&cmd);
执行完会检查其返回值
    if (ret != 0) {
        VERBOSE("Send command %u error: %d\n", idx, ret);
    }
我发现
日志输出以下内容
Send command 17 error: -5

 

所以我深入ret = ops->send_cmd(&cmd);发现最终调用的是arm-trusted-firmware/drivers/nxp/s32/mmc/s32_mmc.c  里的s32_mmc_send_cmd函数

并且在

    do {
        regdata = mmio_read_32(USDHC_INT_STATUS);
        if (regdata & INT_STATUS_CMD_ERROR)
            goto cmd_error;
    } while (!(regdata & INT_STATUS_CC));   中发现INT_STATUS_CMD_ERROR某个对应位被置1导致跳转cmd_error,进而导致产生-EIO(-5)错误
 
所以我将regdata内容打印出,对应INT_STATUS_CMD_ERROR发现是CEBE被置1
 
综上所述,发送CMD17时,CEBE位被置1,导致产生了-EIO错误码(对应上图“BL2: Failed to load image id 3 ( -5 )”中的-5错误码)
0 Kudos
Reply
676 Views
wmx
Contributor III

对比了bsp38.0-2.5的atf源码,发现在drivers/mmc/mmc.c中的第555行有一段注释

/* On USB-SD-MUX setups, depending on some SD-Card types
* experimentally it was observed that a first switch to
* 20 Mhz frequency was necessary in order to use
* CMD6 func check/switch.
*/

随后我们将goldvip1.9.0烧入到不同的卡,测试有的卡是可以成功启动系统,有的不行

请问能否提供有关这段注释提到的现象的代码补丁文件来应用goldvip1.9的atf上?

0 Kudos
Reply
670 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Thanks for your feedback. Overall, we understand that at the end you were able to run successfully GoldVIP v1.9.0 on NXP reference boards, which is the behavior we are seeing from our side. At the end, we understand that the problem is happening under your custom board, which might be related to hardware itself.

As for patches, under this channel it is not common for us to share this kind of information. For that we can recommend contacting your local NXP FAE/DFAE/representative or opening a ticket under the NXP online services. We do apologize.

Please, let us know.

0 Kudos
Reply