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] AM62x, AM64x: How to allow Linux to load M4F / R5F firmware by adding a resource table

Part Number: AM6442
Other Parts Discussed in Thread: SYSCONFIG

UPDATE: This FAQ has been replaced by the Multicore academy module, section "Application Development on Remote cores". Please refer to the associated processor academy. This FAQ will not be updated in the future.

AM62x academy

AM62Ax academy

AM62Px academy

AM64x academy

The MCU+ "Hello World" example can be loaded by CCS. However, the project will fail to be loaded if the remote core is initialized by Linux. Why is that?

The Linux RemoteProc driver checks the remote core firmware for a resource table before it loads the firmware into a remote core. If the firmware does not have a resource table, then Linux will not load the firmware. That means that if we want to use Linux to load the "Hello World" example (or any example), then we need to make sure the project has a resource table in it.

How to add a resource table to an MCU+ project?

.

Note1: "remote core" means any core in the processor that is not the Linux cores. So from a Linux perspective, M4F and R5F are both "remote cores".

Note2: The same information applies to both M4F and R5F. For now, this FAQ will use M4F to demonstrate how to add a resource table.

  • Approach #1: Add Linux IPC to the MCU+ Project 

    This is the simplest option.

    The MCU+ drivers will generate a resource table when Linux IPC is selected in the sysconfig file for the MCU+ core project. Just open the sysconfig settings for the project, and enable "Linux A53 IPC RP Message". Reference https://software-dl.ti.com/mcu-plus-sdk/esd/AM62X/08_05_00_14/exports/docs/api_guide_am62x/IPC_GUIDE.html > "Enable IPC in SysConfig".

    The downside of this approach is that the RPMsg libraries take up a lot of space. When I checked on AM62x M4F map files, it looks like adding IPC to a release build adds about 0x1000 of code to M4F IRAM and 0x2200 of code to M4F DRAM.

    The linker.cmd file must also be updated to place the resource table in DDR at the beginning of the "external code/data mem" section that is passed to the remoteproc driver in the Linux devicetree file. Reference the MCU+ file examples/drivers/ipc/ipc_rpmsg_echo_linux/am62x-sk/m4fss0-0_freertos/ti-arm-clang/linker.cmd.

  • Approach #2: Manually add an empty resource table to the MCU+ Project 

    Version A: Do NOT include Linux IPC. Allow Linux to see the remote core trace logs 

    This version of approach #2 also requires a change to the project's SysConfig settings. In order to allow Debug prints to write to the trace log where Linux can see them, Debug Log > Enable Memory Log must be selected.

    A patch to add a modified project to the MCU+ SDK is below.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_Enable_2D00_Linux_2D00_load_2D00_no_2D00_IPC._2D00_debug_2D00_logs_2D00_enabled.patch

  • Approach #2: Manually add an empty resource table to the MCU+ Project 

    Version B: Minimize the footprint of adding a resource table. No Linux IPC, no remote core trace logs for Linux 

    If the project absolutely cannot spare 0x1000 of space for the trace log, then the project can be created without a trace log.

    This version of approach #2 does NOT require changing the project's SysConfig settings.

    A patch to add a modified project to the MCU+ SDK is below.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_Enable_2D00_Linux_2D00_load_2D00_no_2D00_IPC_2D00_no_2D00_debug_2D00_logs.patch

  • How to apply these patches on MCU SDK and what files will it be generated that needs to be replaced AM64B

  • Hello ,

    First, get the code

    Case 1: you are using git version control for your software development

    Those patches should work with any git version control software. If you are on a Windows computer, the commands to apply a patch will depend on whatever graphical user interface you are using for git.

    From a Linux terminal, this is how I apply the patches:

    $ cd /path/to/mcu_plus_sdk_am62x_08_05_00_14
    // create a git repo in the MCU+ SDK
    $ git init
    // copy the patch file into the current directory (MCU+ SDK)
    $ cp ~/Downloads/patch_file_name.patch .
    // apply the patch
    $ git apply patch_file_name.patch

    Alternatively, reference TDA guidelines for PDK / TI_RTOS (different than MCU+ SDK / FreeRTOS): https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1133505/faq-tda4vm-best-practices-for-version-tracking-for-ti-s-sdk 

    Potentially useful CCS docs: https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_project-management.html#working-with-source-control 

    Case 2: you are not using version control for your code 

    here are the two projects in a zip file:

    hello_world_no_ipc.zip

    hello_world_no_ipc_no_logs.zip

    Copy them into your MCU+ SDK. I put them under examples/

    Next, build the code 

    Follow https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/08_05_00_24/exports/docs/api_guide_am64x/GETTING_STARTED_BUILD.html

    If using the Linux terminal, I do something like this:
    make -s -C examples/hello_world_no_ipc_no_logs/am62x-sk/m4fss0-0_freertos/ti-arm-clang/ clean
    make -s -C examples/hello_world_no_ipc_no_logs/am62x-sk/m4fss0-0_freertos/ti-arm-clang/

    Finally, run the code 

    Copy the binary you want to run to the AM64x Linux filesystem /lib/firmware folder. Update the link and reboot the board.

    Full steps are here: https://dev.ti.com/tirex/explore/node?a=7qm9DIS__LATEST&node=A__ANKEb6LZY6VAX.9xvGwQ-g__linux_academy_am64x__7qm9DIS__LATEST 

  • To clarify the question about "what files", use the .out file that is generated in the projects.

  • Hi Nick,

    We have AM64B hardware, and don't have AM62X board. Can you please send the project for AM64x.

  • Hello Venkata,

    This is an example, so the idea is that you learn, and then apply what you learned to your code (instead of me writing the code for you). Please read the documentation provided in the example's .patch files (any text editor will do), and the comments in the added resource_table_xxx.h file, the main.c file, and the linker.cmd file.

    If you have a specific question, feel free to ask that specific question and we can assist.

    Regards,

    Nick

  • Our problem is simple, when the RPMsg is enabled along with SPI+DMA then debug logs were not coming on the console.

    For that you are asking us to test all the hello_world_no_ipc.zip, hello_world_no_ipc_no_logs.zip combinations.

    We are not here to test. Tell us the final solution which is working then we can take from that. And we are using the simple hellowrold program to test RPMsg and SPI+DMA that you can test from your side instead.

  • Hello Venkata,

    Please find the AM64x R5F0_0 hello world project patched to use a resource table, with no Linux IPC, while enabling debug logs from the Linux side. This is the R5F version of approach 2A: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1193620/faq-am62x-am64x-how-to-allow-linux-to-load-m4f-r5f-firmware-by-adding-a-resource-table/4498750#4498750

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_Sysconfig_2D00_enable_2D00_memory_2D00_log.patch

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0002_2D00_Add_2D00_an_2D00_empty_2D00_resource_2D00_table.patch

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0003_2D00_linker.cmd_2D00_allocate_2D00_space_2D00_for_2D00_resource_2D00_table.patch

    These patches are different, in that they should be applied directly onto the hello_world project (instead of creating a new project). That also means that if you look at the .patch file in any text editor, you will see EXACTLY what has changed from the hello_world project. Hopefully that makes this more clear.

    Try enabling SPI in the project and seeing if the project will load.

    Regards,

    Nick

  • Hi Nick.

    I have applied the 3 patches on helloworld project and compiled and loaded the out file. Core file is not loaded due to bad address. I have added MCSPI, with that also the same error.

    I have attached the project for reference.

    hello_world_am64x-sk_r5fss0-0_freertos_ti-arm-clang-Mod.zip

    Bootup logs:

    Explicit core starting log:

  • Hello Venkata,

    It looks like I made a copy error with the previous linker.cmd file. I meant to copy over the linker.cmd file from the RPMsg Linux example project.

    I checked that this R5F project will successfully load from Linux. There is a possibility that the Linux log is not working properly, I did not have time to debug. I did not have time today to try to connect to the core with CCS (it's already past bedtime here), but Anil and I did spend some time discussing his tests and asking some followup questions to the developers. We'll let you know if any updates on the other thread.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/1440.0001_2D00_Sysconfig_2D00_enable_2D00_memory_2D00_log.patch

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/3806.0002_2D00_Add_2D00_an_2D00_empty_2D00_resource_2D00_table.patch

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_linker.cmd_2D00_allocate_2D00_space_2D00_for_2D00_resource_2D00_table.patch

    Regards,

    Nick