This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] [参考译文] 【常见问题解答】Linux:如何检查 DM R5F 上运行的二进制文件

Guru**** 2418580 points
Other Parts Discussed in Thread: AM67A, AM67

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1545495/faq-linux-how-to-check-what-binary-is-running-on-the-dm-r5f

主题中讨论的其他器件:AM67、AM67A

Thread 中讨论的器件:AM62x、AM62Ax、AM62Dx、AM62Px、AM67、 AM67A

设备管理 (DM) R5F 内核的主要作用是运行 DM 任务。  但是、DM R5F 上可能还有其他非 DM 代码与 DM 任务一起运行。  在引导期间(SPL 引导或 SBL 引导期间)、DM R5F 内核上运行的固件将被初始化。

有关 SPL 引导和 SBL 引导的更多信息、请参阅 Processor 学院>多核>引导流程:SBL 与 SBL
AM62x ||  AM62Ax ||   AM62Px

我们建议使用以下方法之一来检查二进制文件:

  1. 查找 内置到 tispl.bin 中(对于 SPL 引导流程)由 SBL 加载(对于 SBL 引导流程)的 DM R5F 二进制文件
  2. 在 Linux 运行期间:测试 ipc_rpmsg_echo_linux 固件是否在 DM R5F 上运行
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    SPL 引导:检查内置于 tispl.bin 中的 DM R5F 二进制文件

    找到所使用的二进制文件

    请参阅 【常见问题解答】SPL 引导:如何查找内置于 tispl.bin 中  的 DM R5F 二进制文件以查找正在加载的二进制文件。 然后回到常见问题解答。

    检查二进制文件

    AM62x、AM62Dx、AM62Px、AM67、AM67A

    是否有名为“ipc_echo_testb_mcu1_0_release_strip.xer5f"的“的二进制文件? 这个预编译文件来自 ti-linux-firmware 存储库 (AM67 和 AM67A 使用 j722s 二进制文件)。 这是 ipc_rpmsg_echo_linux 工程。

    AM62Ax

    根据文件的来源、名为 “ipc_echo_testb_mcu1_0_release_strip.xer5f"的“的预编译二进制文件可能是 ipc_rpmsg_echo_linux 工程、也可能是 VPAC/ISP 二进制文件。

    检查二进制文件的大小。 ipc_rpmsg_echo_linux 将~160-200KB、而 VPAC/ISP 二进制文件将~600KB。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    SBL 引导:找到由 SBL 加载的 DM R5F 二进制文件

    请参阅  【常见问题解答】SBL 引导:如何查找由 SBL 加载的 DM R5F 固件  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    在 Linux 运行期间:测试 ipc_rpmsg_echo_linux 固件是否在 DM R5F 上运行

    检查固件的跟踪日志。 这也可用于检查使用哪个 SDK 版本来生成固件

    一些 DM R5F 固件项目会将打印输出发送到跟踪日志。 如果 Linux 成功连接到 DM R5F、则 Linux 可以读取跟踪日志。 ipc_rpmsg_echo_linux 工程将输出发送到跟踪日志。

    以下是如何检查跟踪日志的示例:

    // test is on AM62x Linux SDK 10.1
    root@am62xx-evm:~# uname -a
    Linux am62xx-evm 6.6.58-rt45-ti-rt-01780-gc79d7ef3a56f-dirty #1 SMP PREEMPT_RT Wed Nov 27 14:15:26 UTC 2024 aarch64 GNU/Linux
    
    // let's check which remoteprocX instance is associated with the DM R5F
    // note that remoteprocX <--> core association is NOT fixed. It can be different on different boots
    root@am62xx-evm:~# head /sys/class/remoteproc/remoteproc*/name
    ..
    ==> /sys/class/remoteproc/remoteproc1/name <==
    78000000.r5f
    ...
    
    // Is the DM R5F firmware also from SDK 10.1?
    // let's check the trace log for remoteproc1
    
    // note the "Sciserver Version" that tells us which SDK version was used to build the project
    // [IPC RPMSG ECHO] prints tell us that this is the ipc_rpmsg_echo_linux project
    // and we see the same version number listed in the IPC RPMSG ECHO output
    // these version numbers are generated at compile time, using files like this:
    // github.com/.../generate_ipc_fw_ver.sh
    root@am62xx-evm:~# cat /sys/kernel/debug/remoteproc/remoteproc1/trace0
    [r5f0-0]     0.000892s : Sciclient direct init..... SUCCESS
    [r5f0-0]     0.002004s : Sciserver Testapp Built On: Nov 14 2024 14:00:38
    [r5f0-0]     0.006603s : Sciserver Version: v2024.11.0.0-REL.MCUSDK.K3.10.01.00.10+
    [r5f0-0]     0.012100s : RM_PM_HAL Version: v10.01.08
    [r5f0-0]     0.014851s : Starting Sciserver..... PASSED
    [r5f0-0]     0.017786s : [IPC RPMSG ECHO] Version: REL.MCUSDK.K3.10.01.00.10+ (Nov 14 2024 14:02:25):
    [r5f0-0]    16.156413s : [IPC RPMSG ECHO] Message exchange started with RTOS cores !!!
    [r5f0-0]    16.162285s : [IPC RPMSG ECHO] Remote Core waiting for messages at end point 13 ... !!!
    [r5f0-0]    16.170094s : [IPC RPMSG ECHO] Remote Core waiting for messages at end point 14 ... !!!
    [r5f0-0]    21.920903s : [IPC RPMSG ECHO] All echoed messages received by main core from 1 remote cores !!!
    [r5f0-0]    21.928608s : [IPC RPMSG ECHO] Messages sent to each core = 100000
    [r5f0-0]    21.933649s : [IPC RPMSG ECHO] Number of remote cores = 1
    [r5f0-0]    21.937865s : [IPC RPMSG ECHO] Total execution time = 5758661 usecs
    [r5f0-0]    21.942910s : [IPC RPMSG ECHO] One way message latency = 28793 nsec

    尝试使用 rpmsg_char_simplet userspace 应用程序

    如果 Linux 连接到 DM R5F 并与 DM R5F 建立 RPMsg 通信、则可以使用 rpmsg_char_simplet userspace 应用程序来测试 ipc_rpmsg_echo_linux 工程是否在 DM R5F 上运行。

    案例 1:rpmsg_char_simpley 成功地与 DM R5F 通信。 ipc_rpmsg_echo_linux 工程在 DM R5F 上运行。

    案例 2:rpmsg_char_simplet 无法与 DM R5F 通信。 这可能是因为在 DM R5F 上运行不同的项目、但也可能是由 “ DM R5F 和 Linux 之间未初始化 RPMsg IPC 通信的典型场景是什么?“一节中描述的其他因素导致的。

    验证 Remoteproc & RPMsg 连接

    请参阅 【常见问题解答】如何检查 Linux 是否可以通过 RPMsg 与非 Linux 内核通信。  然后回到常见问题解答。

    运行 rpmsg_char_simplet userspace 应用程序

    如果文件系统中未包含 rpmsg_char_simplex、则可在此处下载该文件:

    rpmsg_char_simple

    下面列出了您可能会看到的不同输出。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    示例 1:通信成功、IPC 示例在 DM R5F 上运行

    root@am62xx-evm:~# ./rpmsg_char_simple -r 15 -n 1
    Created endpt device rpmsg-char-15-1317, fd = 4 port = 1025
    Exchanging 1 messages with rpmsg device rpmsg-char-15-1317 on rproc id 15 ...
    
    Sending message #0: hello there 0!
    Received message #0: round trip delay(usecs) = 100510
    hello there 0!
    
    Communicated 1 messages successfully on rpmsg-char-15-1317
    
    TEST STATUS: PASSED

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    示例 2:仅限 AM62Ax、在 DM R5F 上运行的 VPAC/ISP 固件

    AM62Ax VPAC/ISP 固件确实使用 RPMsg 进行通信、因此我们可以看到在 0xd 处创建了单个 RPMsg 端点:

    // I will cut out print statements that are unrelated to DM R5F
    root@am62axx-evm:~# dmesg | grep -e r5 -e remoteproc -e rproc -e rpmsg -e virtio
    ...
    [    7.443969] platform 78000000.r5f: R5F core may have been powered on by a different host, programmed state (0) != actual state (1)
    [    7.485132] platform 78000000.r5f: configured R5F for IPC-only mode
    [    7.491773] platform 78000000.r5f: assigned reserved memory node r5f-dma-memory@9c800000
    [    7.580786] remoteproc remoteproc2: 78000000.r5f is available
    [    7.606619] remoteproc remoteproc2: attaching to 78000000.r5f
    [    7.693146] rproc-virtio rproc-virtio.9.auto: assigned reserved memory node r5f-dma-memory@9c800000
    
    // The DM R5F firmware defines a single RPMsg endpoint at 0xd
    // so Linux can communicate with the DM R5F over RPMsg by talking to that endpoint
    [    7.724386] virtio_rpmsg_bus virtio2: creating channel rpmsg_chrdev addr 0xd
    [    7.727945] virtio_rpmsg_bus virtio2: rpmsg host is online
    [    7.739639] rproc-virtio rproc-virtio.9.auto: registered virtio2 (type 7)
    
    // Linux successfully attaches to the DM R5F
    [    7.746700] remoteproc remoteproc2: remote processor 78000000.r5f is now attached
    

    这意味着我们可以成功地将 RPMsg 消息发送到 DM R5F。 但是、由于 DM R5F 未运行 ipc_rpmsg_echo_linux 固件、因此它不会将同一条消息回传给 Linux。

    // let's check to see what RPMsg endpoint is used by default
    root@am62axx-evm:~# rpmsg_char_simple -help
    rpmsg_char_simple: invalid option -- 'h'
    Usage: rpmsg_char_simple [-r <rproc_id>] [-n <num_msgs>] [-d           <rpmsg_dev_name] [-p <remote_endpt] [-l <local_endpt]
                    Defaults: rproc_id: 0 num_msgs: 100 rpmsg_dev_name: NULL remote_endpt: 14
    
    // since remote endpoint 0xe (14) is used by default, we have to manually pass in 0xd (13)
    
    root@am62axx-evm:~# ./rpmsg_char_simple -r 15 -n 1 -p 13
    Created endpt device rpmsg-char-15-9222, fd = 4 port = 1025
    Exchanging 1 messages with rpmsg device rpmsg-char-15-9222 on rproc id 15 ...
    
    Sending message #0: hello there 0!
    
    // rpmsg_char_simple hangs here, waiting for the message to be echoed back
    // since the message is not echoed back, the test fails
    // we know for sure that ipc_rpmsg_echo_linux is not running on the DM R5F
    // it may take additional tests to verify exactly what firmware IS running on the DM R5F

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    示例 3:无通信、IPC 示例未在 DM R5F 上运行

    例如 3、我将不同的自定义固件加载到 DM R5F 中、该 R5F 未使用 RPMsg。 引导日志如下所示:

    [ 7.572006] platform 78000000.r5f: R5F core may have been powered on by a different host, programmed state (0) != actual state (1)
    [ 7.587962] platform 78000000.r5f: configured R5F for IPC-only mode
    [ 7.598472] platform 78000000.r5f: assigned reserved memory node r5f-dma-memory@9c800000
    [ 7.642301] remoteproc remoteproc1: 78000000.r5f is available
    [ 7.656028] remoteproc remoteproc1: attaching to 78000000.r5f
    [ 7.667068] remoteproc remoteproc1: remote processor 78000000.r5f is now attached
    
    // note that the RPMsg VIRTIO infrastructure was not successfully set up

    由于 DM R5F 没有提供任何 RPMsg 端点、因此 virtio 基础架构未完成设置。 Linux 无法使用 RPMsg IPC 与 DM R5F 通信。

    root@am62pxx-evm:~# ./rpmsg_char_simple -r 15 -n 1
    _rpmsg_char_find_rproc: 78000000.r5f does not have any virtio devices!
    Can't create an endpoint device: No such file or directory
    TEST STATUS: FAILED