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.

CCS/AM6548: Remoteproc resource table

Part Number: AM6548

Tool/software: Code Composer Studio

Hello,

Environment:

  • Hardware: AM65x IDK
  • Software: ti-processor-sdk-rtos-am65xx-evm-06_01_00_08

I am trying load <PDK>\pdk_am65xx_1_0_6\packages\ti\csl\test\dmTimerUt\ to R5F through Linux remoteproc. To do this it seems that a resource table is needed to be put into the program; otherwise the remoteproc driver will report error when I start R5F. I have read some documents including https://lwn.net/Articles/489009/ . Could someone provide any examples or PDFs?

The error messages:

[ 5164.436159] remoteproc remoteproc12: powering up 41000000.r5f
[ 5164.442848] remoteproc remoteproc12: Booting fw image am65x-mcu-r5f0-fw, size 415240
[ 5164.450699] remoteproc remoteproc12: Failed to find resource table
[ 5164.456949] remoteproc remoteproc12: Boot failed: -22
-sh: echo: write error: Invalid argument

  • Hi Hungwei,

    Can you please see if this helps? https://e2e.ti.com/support/processors/f/791/t/875604

    Regards,
    Frank

  • Hello Frank,

    Thanks for the reply!

    I have added a empty resource table which is accepted by remoteproc. However R5F hangs once I start it and I get the following error messages. Did you have any problem like this before? 

    root@am65xx-evm:~# echo start > /sys/class/remoteproc/remoteproc12/state
    [ 1647.192240] remoteproc remoteproc12: powering up 41000000.r5f
    [ 1647.198982] remoteproc remoteproc12: Booting fw image am65x-mcu-r5f0-fw, size 419536
    [ 1647.206913] Unable to handle kernel paging request at virtual address ffff00000f8a0000
    [ 1647.214854] Mem abort info:
    [ 1647.217678]   Exception class = DABT (current EL), IL = 32 bits
    [ 1647.223619]   SET = 0, FnV = 0
    [ 1647.226692]   EA = 0, S1PTW = 0
    [ 1647.229853] Data abort info:
    [ 1647.232753]   ISV = 0, ISS = 0x00000061
    [ 1647.236604]   CM = 0, WnR = 1
    [ 1647.239565] swapper pgtable: 64k pages, 48-bit VAs, pgd = ffff000008d60000
    [ 1647.246460] [ffff00000f8a0000] *pgd=00000008fffe0803, *pud=00000008fffe0803, *pmd=00000008fffd0803, *pte=00e8000041010f07
    [ 1647.257441] Internal error: Oops: 96000061 [#1] PREEMPT SMP
    [ 1647.263002] Modules linked in: xhci_plat_hcd xhci_hcd usbcore sha512_arm64 md5 des_generic cbc ti_am335x_adc phy_generic kfifo_buf dwc3 udc_core usb_common crc32_ce crct10dif_ce xfrm_user xfrm4_tunnel tunnel4 ipcomp xfrm_ipcomp esp4 ah4 af_key xfrm_algo ti_k3_r5_remoteproc ti_cal videobuf2_dma_contig pci_endpoint_test pvrsrvkm(O) videobuf2_memops ov490 videobuf2_v4l2 omap_rng videobuf2_core v4l2_fwnode pruss_soc_bus rng_core at24 ti_am335x_tscadc goodix dwc3_am65 icssg_prueth pru_rproc pruss pruss_intc remoteproc sch_fq_codel cryptodev(O) ipv6
    [ 1647.311180] CPU: 1 PID: 852 Comm: sh Tainted: G           O    4.14.67-gd315a9bb00 #1
    [ 1647.318993] Hardware name: Texas Instruments AM654 Base Board (DT)
    [ 1647.325158] task: ffff80084413b600 task.stack: ffff0000124a0000
    [ 1647.331073] PC is at __memset+0x1ac/0x1c8
    [ 1647.335100] LR is at rproc_elf_load_segments+0xf0/0x180 [remoteproc]
    [ 1647.341438] pc : [<ffff0000087f262c>] lr : [<ffff000000a23ad8>] pstate: 40000145
    [ 1647.348816] sp : ffff0000124afc70
    [ 1647.352119] x29: ffff0000124afc70 x28: 0000000041010000
    [ 1647.357421] x27: ffff00000f8a0000 x26: ffff800844f65100
    [ 1647.362723] x25: ffff800844cb5838 x24: ffff000012540000
    [ 1647.368025] x23: ffff800844cb5800 x22: 00000000000006c8
    [ 1647.373326] x21: 0000000000000000 x20: 0000000000000001
    [ 1647.378629] x19: ffff0000125a5ff8 x18: 0000000000000010
    [ 1647.383932] x17: 0000ffffae7c8510 x16: ffff00000820f5a0
    [ 1647.389234] x15: ffffffffffffffff x14: 0000000041010000
    [ 1647.394536] x13: 000059b000004dc8 x12: 000006c800000000
    [ 1647.399837] x11: 000000007000247c x10: 0000100041017000
    [ 1647.405139] x9 : 0000000000000000 x8 : ffff00000f8a0000
    [ 1647.410441] x7 : 0000000000000000 x6 : 000000000000003f
    [ 1647.415742] x5 : 0000000000000040 x4 : 0000000000000000
    [ 1647.421044] x3 : 0000000000000004 x2 : 0000000000000688
    [ 1647.426345] x1 : 0000000000000000 x0 : ffff00000f8a0000
    [ 1647.431649] Process sh (pid: 852, stack limit = 0xffff0000124a0000)
    [ 1647.437901] Call trace:
    [ 1647.440342] Exception stack(0xffff0000124afb30 to 0xffff0000124afc70)
    [ 1647.446768] fb20:                                   ffff00000f8a0000 0000000000000000
    [ 1647.454582] fb40: 0000000000000688 0000000000000004 0000000000000000 0000000000000040
    [ 1647.462397] fb60: 000000000000003f 0000000000000000 ffff00000f8a0000 0000000000000000
    [ 1647.470212] fb80: 0000100041017000 000000007000247c 000006c800000000 000059b000004dc8
    [ 1647.478026] fba0: 0000000041010000 ffffffffffffffff ffff00000820f5a0 0000ffffae7c8510
    [ 1647.485841] fbc0: 0000000000000010 ffff0000125a5ff8 0000000000000001 0000000000000000
    [ 1647.493655] fbe0: 00000000000006c8 ffff800844cb5800 ffff000012540000 ffff800844cb5838
    [ 1647.501470] fc00: ffff800844f65100 ffff00000f8a0000 0000000041010000 ffff0000124afc70
    [ 1647.509285] fc20: ffff000000a23ad8 ffff0000124afc70 ffff0000087f262c 0000000040000145
    [ 1647.517100] fc40: ffff0000124afc70 ffff000000a23a78 0000ffffffffffff 0000000000000001
    [ 1647.524913] fc60: ffff0000124afc70 ffff0000087f262c
    [ 1647.529783] [<ffff0000087f262c>] __memset+0x1ac/0x1c8
    [ 1647.534845] [<ffff000000a21f88>] rproc_boot+0x200/0x588 [remoteproc]
    [ 1647.541205] [<ffff000000a23134>] state_store+0x74/0x178 [remoteproc]
    [ 1647.547552] [<ffff000008548180>] dev_attr_store+0x18/0x28
    [ 1647.552944] [<ffff00000828c74c>] sysfs_kf_write+0x3c/0x50
    [ 1647.558331] [<ffff00000828ba38>] kernfs_fop_write+0x118/0x1e0
    [ 1647.564069] [<ffff00000820f040>] __vfs_write+0x18/0x110
    [ 1647.569283] [<ffff00000820f32c>] vfs_write+0xa4/0x1a8
    [ 1647.574323] [<ffff00000820f5e8>] SyS_write+0x48/0xb0
    [ 1647.579275] Exception stack(0xffff0000124afec0 to 0xffff0000124b0000)
    [ 1647.585701] fec0: 0000000000000001 000000001d60dcb0 0000000000000006 0000000000000001
    [ 1647.593516] fee0: 0000000000000000 0000000000015551 0000000072617473 0000000074726174
    [ 1647.601330] ff00: 0000000000000040 0000000000000000 0000ffffcd5cd3b0 0000000000000020
    [ 1647.609143] ff20: 0000000000000000 0000000000000000 0000ffffae770af0 0000ffffae763cc8
    [ 1647.616958] ff40: 0000000000000000 0000ffffae7c8510 0000000000000255 0000000000000006
    [ 1647.624772] ff60: 000000001d60dcb0 0000ffffae8a7488 0000000000000006 000000001d60dcb0
    [ 1647.632586] ff80: 0000000000000006 00000000004cfc60 0000000000000001 0000000000000000
    [ 1647.640401] ffa0: 000000001d62f3b0 0000ffffcd5cd3d0 0000ffffae7cb69c 0000ffffcd5cd3d0
    [ 1647.648216] ffc0: 0000ffffae81cb08 0000000020000000 0000000000000001 0000000000000040
    [ 1647.656030] ffe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    [ 1647.663847] [<ffff0000080832c0>] el0_svc_naked+0x34/0x38
    [ 1647.669150] Code: 91010108 54ffff4a 8b040108 cb050042 (d50b7428)
    [ 1647.675233] ---[ end trace 77762af3a87afe65 ]---

  • Hi Hungwei,

    I'm not sure about these errors. I've located the following additional documentation which might be of help:

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components_IPC.html#ipc-for-am65xx

    I've also looped in a colleague who has more experience with remoteproc.

    Regards,
    Frank 

  • Hello Hungwei,

    I'm not sure that using a PRU resource table would work for an R5F core. The template R5F resource table is in your RTOS SDK under ipc_xxx/packages/ti/ipc/remoteproc/rsc_table_am65xx_r5f.h . It is not an empty resource table, but if it is too complex hopefully you can cut it down.

    Frank's link above is the best starting point right now for loading / running code on the R5 (that I know of).

    Regards,

    Nick

  • Hello,

    Actually I used <PDK>\ipc_3_50_04_07\examples\AM65XX_linux_elf\ex02_messageq\r5f-0\rsc_table.h but I emptied the content of the resource table. I attached my resource table as below: 

    /*
     * Copyright (c) 2017-2018, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== rsc_table_am65xx_r5f.h ========
     *
     *  Define the resource table entries for all R5F cores. This will be
     *  incorporated into corresponding base images, and used by the remoteproc
     *  on the host-side to allocated/reserve resources.
     *
     */
    
    #ifndef _RSC_TABLE_AM65XX_R5F_H_
    #define _RSC_TABLE_AM65XX_R5F_H_
    
    //#include <ti/ipc/remoteproc/rsc_types.h>
    
    #define R5F_MEM_IPC_VRING       0x9C000000
    
    #define R5F_MEM_RPMSG_VRING0    (R5F_MEM_IPC_VRING)
    #define R5F_MEM_RPMSG_VRING1    (R5F_MEM_IPC_VRING+0x10000)
    #define R5F_MEM_VRING_BUFS0     (R5F_MEM_IPC_VRING+0x40000)
    #define R5F_MEM_VRING_BUFS1     (R5F_MEM_IPC_VRING+0x80000)
    
    #define R5F_MEM_IPC_VRING_SIZE  SZ_1M
    
    #define R5F_NUM_ENTRIES 1
    
    /*
     * Assign direct mapped RAM address to facilitate address translations in
     * AM65xx VirtQueue code. The PHYS_MEM_IPC_VRING address should be same as
     * R5F_MEM_IPC_VRING, and should match the starting base address of the
     * first reserved memory node assigned to this remoteproc.
     */
    #define PHYS_MEM_IPC_VRING      (R5F_MEM_IPC_VRING)
    
    /*
     * Sizes of the virtqueues (expressed in number of buffers supported,
     * and must be power of 2)
     */
    #define R5F_RPMSG_VQ0_SIZE      256
    #define R5F_RPMSG_VQ1_SIZE      256
    
    /* flip up bits whose indices represent features we support */
    #define RPMSG_R5F_C0_FEATURES   1
    
    struct resource_table {
        UInt32 ver;
        UInt32 num;
        UInt32 reserved[2];
    };
    
    struct fw_rsc_carveout {
        UInt32  type;
        UInt32  da;
        UInt32  pa;
        UInt32  len;
        UInt32  flags;
        UInt32  reserved;
        Char    name[32];
    };
    
    struct fw_rsc_intmem {
        UInt32  type;
        UInt32  version;
        UInt32  da;
        UInt32  pa;
        UInt32  len;
        UInt32  reserved;
        Char    name[32];
    };
    
    struct fw_rsc_devmem {
        UInt32  type;
        UInt32  da;
        UInt32  pa;
        UInt32  len;
        UInt32  flags;
        UInt32  reserved;
        Char    name[32];
    };
    
    struct fw_rsc_trace {
        UInt32  type;
        UInt32  da;
        UInt32  len;
        UInt32  reserved;
        Char    name[32];
    };
    
    struct fw_rsc_vdev_vring {
        UInt32  da; /* device address */
        UInt32  align;
        UInt32  num;
        UInt32  notifyid;
        UInt32  reserved;
    };
    
    struct fw_rsc_vdev {
        UInt32  type;
        UInt32  id;
        UInt32  notifyid;
        UInt32  dfeatures;
        UInt32  gfeatures;
        UInt32  config_len;
        UInt8   status;
        UInt8   num_of_vrings;
        UInt8   reserved[2];
    };
    
    struct my_resource_table {
        struct resource_table base;
    
        UInt32 offset[1];  /* Should match 'num' in actual definition */
    
        /* rpmsg vdev entry */
        struct fw_rsc_vdev rpmsg_vdev;
        struct fw_rsc_vdev_vring rpmsg_vring0;
        struct fw_rsc_vdev_vring rpmsg_vring1;
    
        /* trace entry */
        struct fw_rsc_trace trace;
    
        /* devmem entry */
        struct fw_rsc_devmem devmem0;
    };
    //extern char ti_trace_SysMin_Module_State_0_outbuf__A[];
    
    //#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
    //#define TRACEBUFSIZE 0x8000
    
    #pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
    #pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
    #pragma RETAIN(ti_ipc_remoteproc_ResourceTable)
    
    const struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
        1,      /* we're the first version that implements this */
        0,     /* number of entries in the table */
        0, 0,   /* reserved, must be zero */
        0,      // offset[0]
    };
    
    #endif /* _RSC_TABLE_AM65XX_R5F_H_ */
    

  • Hello,

    I modified the linker file to change the physical addresses of the segments and got a different error as below.

    [   11.335493] remoteproc remoteproc12: powering up 41000000.r5f
    [   11.341448] remoteproc remoteproc12: Booting fw image am65x-mcu-r5f0-fw, size 421008
    [   11.353707] remoteproc remoteproc12: bad phdr da 0xa0180000 mem 0xc0
    [   11.360160] remoteproc remoteproc12: Failed to load program segments: -22

    The new linker file:

    Program Headers:
      Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
      LOAD           0x000038 0x00000100 0x00000100 0x008a8 0x008a8 R E 0x8
      LOAD           0x001000 0xa0180000 0xa0180000 0x000c0 0x000c0 R   0x1000
      LOAD           0x0010c0 0xa0200000 0xa0200000 0x04db0 0x04db0 R E 0x8
      LOAD           0x005e80 0xa0300000 0xa0300000 0x03100 0x037c8 RWE 0x80
      LOAD           0x008f80 0xa03037c8 0xa03037c8 0x00350 0x00350 R   0x8
      LOAD           0x0092d0 0xa03fe600 0xa03fe600 0x00000 0x00a00 R   0x4
      LOAD           0x0092d0 0xa03ff000 0xa03ff000 0x00000 0x01000 RW  0x8
    
     Section to Segment mapping:
      Segment Sections...
       00     .rstvectors .bootCode .startupCode .startupData
       01     .resource_table
       02     .text
       03     .bss .data
       04     .const .cinit
       05     .irqStack .fiqStack .abortStack .undStack .svcStack
       06     .stack

    The old linker file:

    Program Headers:
      Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
      LOAD           0x000038 0x00000100 0x00000100 0x05948 0x05948 R E 0x8
      LOAD           0x005980 0x41010000 0x41010000 0x00000 0x006c8 RW  0x4
      LOAD           0x005980 0x41016600 0x41016600 0x00000 0x00a00 R   0x4
      LOAD           0x005980 0x41017000 0x41017000 0x00000 0x01000 RW  0x8
      LOAD           0x005980 0x41c00000 0x41c00000 0x00040 0x00040 R E 0x8
      LOAD           0x005a00 0x70000000 0x70000000 0x03100 0x03100 RWE 0x80
      LOAD           0x009000 0x9c100000 0x9c100000 0x000c0 0x000c0 R   0x1000
      
     Section to Segment mapping:
      Segment Sections...
       00     .bootCode .startupCode .startupData .text .const .cinit
       01     .bss
       02     .irqStack .fiqStack .abortStack .undStack .svcStack
       03     .stack
       04     .rstvectors
       05     .data
       06     .resource_table


    root@am65xx-evm:~# cat /proc/iomem
    0011c000-0011c2e3 : pinctrl-single
    0011c2e8-0011c30b : pinctrl-single
    00600000-006000ff : /soc0/main_gpio0@600000
    00601000-006010ff : /soc0/main_gpio1@601000
    00910000-00911fff : serdes
    02000000-020000ff : /soc0/i2c@2000000
    02010000-020100ff : /soc0/i2c@2010000
    02020000-020200ff : /soc0/i2c@2020000
    02800000-0280001f : serial
    03100000-0310005f : /soc0/pwm@3100000
    04030000-04037fff : /soc0/dwc3@4020000/usb@10000
      04030000-04037fff : /soc0/dwc3@4020000/usb@10000
    0403c100-0403ffff : /soc0/dwc3@4020000/usb@10000
    04a00000-04a00fff : common
    04a02000-04a02fff : vidl1
    04a06000-04a06fff : vid
    04a07000-04a07fff : ovr1
    04a08000-04a08fff : ovr2
    04a0a000-04a0afff : vp1
    04a0b000-04a0bfff : vp2
    04e10000-04e1007c : /soc0/trng@4e10000
    04f80000-04f80fff : /soc0/mmc@4f80000/sdhci@0
    04f90000-04f900ff : /soc0/mmc@4f80000/sdhci@0
    04f90100-04f90133 : /soc0/mmc@4f80000/mmc_phy@10100
    04fa0000-04fa0fff : /soc0/mmc@4fa0000/sdhci@0
    04fb0000-04fb00ff : /soc0/mmc@4fa0000/sdhci@0
    04fb0100-04fb0133 : /soc0/mmc@4fa0000/mmc_phy@10100
    05600000-05600fff : app
    05601000-05601fff : dbics
    05606000-05606fff : atu
    06f03000-06f033ff : cal_top
    06f03800-06f0383f : cal_rx_core0
    0b004000-0b005fff : iram
    0b006000-0b007fff : iram
    0b020000-0b021fff : intc
    0b022000-0b0220ff : control
    0b022400-0b0224ff : debug
    0b023000-0b0230ff : control
    0b023400-0b0234ff : debug
    0b023800-0b0238ff : control
    0b023c00-0b023cff : debug
    0b024000-0b0240ff : control
    0b024400-0b0244ff : debug
    0b034000-0b037fff : iram
    0b038000-0b03bfff : iram
    0b104000-0b105fff : iram
    0b106000-0b107fff : iram
    0b120000-0b121fff : intc
    0b122000-0b1220ff : control
    0b122400-0b1224ff : debug
    0b123000-0b1230ff : control
    0b123400-0b1234ff : debug
    0b123800-0b1238ff : control
    0b123c00-0b123cff : debug
    0b124000-0b1240ff : control
    0b124400-0b1244ff : debug
    0b134000-0b137fff : iram
    0b138000-0b13bfff : iram
    0b204000-0b205fff : iram
    0b206000-0b207fff : iram
    0b220000-0b221fff : intc
    0b222000-0b2220ff : control
    0b222400-0b2224ff : debug
    0b223000-0b2230ff : control
    0b223400-0b2234ff : debug
    0b223800-0b2238ff : control
    0b223c00-0b223cff : debug
    0b224000-0b2240ff : control
    0b224400-0b2244ff : debug
    0b234000-0b237fff : iram
    0b238000-0b23bfff : iram
    18000000-18001fff : config
    18030000-1fffffff : MEM
      18030000-1803ffff : 0000:00:00.0
    28590000-285900ff : proxy_gcfg
    285c0000-285c00ff : gcfg
    2a500000-2a53ffff : proxy_target
    2a800000-2a83ffff : rchanrt
    2aa00000-2aa3ffff : tchanrt
    2b000000-2b3fffff : fifos
    2b800000-2bbfffff : rt
    310d0000-310d03ff : cpts
    31120000-311200ff : proxy_gcfg
    31150000-311500ff : gcfg
    31f80000-31f801ff : /soc0/mailbox@31f80000
    31f81000-31f811ff : /soc0/mailbox@31f81000
    32400000-324fffff : rt
    32800000-328fffff : scfg
    32c00000-32cfffff : target_data
    33000000-3303ffff : proxy_target
    33d00000-33dfffff : /soc0/navss256/interrupt-controller@33d00000
    34000000-340fffff : rchanrt
    35000000-350fffff : tchanrt
    38000000-383fffff : fifos
    3c000000-3c3fffff : rt
    40200000-40200fff : /soc0/tscadc@40200000
    40210000-40210fff : /soc0/tscadc@40210000
    40f04040-40f04043 : gmii-sel
    41000000-41007fff : atcm
    41010000-41017fff : btcm
    41400000-41407fff : atcm
    41410000-41417fff : btcm
    41c00000-41c7ffff : 41c00000.mcu-ram
    42110000-421100ff : /soc0/@42110000
    42120000-421200ff : /soc0/i2c@42120000
    4301c000-4301c117 : pinctrl-single
    46000000-461fffff : cpsw_nuss
    47040000-470400ff : /soc0/fss@47000000/ospi@47040000
    70000000-701fffff : 70000000.sram
    80000000-9affffff : System RAM
      80080000-80b2ffff : Kernel code
      80bb0000-80d9ffff : Kernel data
    9c800000-9e7fffff : System RAM
    a0000000-ffffffff : System RAM
    400000000-4ffffffff : /soc0/fss@47000000/ospi@47040000
    880000000-8ffffffff : System RAM

  • Hi Hungwei,

    I've obtained an example from a colleague for loading R5F using remoteproc, and he says it's working. I just need to validate it before sharing it with you.

    Regards,
    Frank

  • Hello Hungwei,

    While Frank is looking at his example, can you run the unmodified, out of the box IPC example as per the instructions at our IPC for AM65x documentation? Once you have the unmodified example working, then it is easier to start modifying the example's resource table / device tree files / linker file.

    Regards,

    Nick

  • Hello Nick,

    I am trying these IPC examples under <PDK>\ipc_3_50_04_07\examples. But these examples seem to be with SYS/BIOS!? Actually we need pure bare-mental program which is why I use <PDK>\pdk_am65xx_1_0_6\packages\ti\csl\test\dmTimerUt\

  • For future readers, a discussion on running the out of the box ex02_messageq example is at post IPC examples load fails

  • Hello Hungwei,

    I apologize for the delayed response on this thread. The example .xer5f output that was mentioned above loads properly with Linux. However, I am still looking for the files that were used to generate the output. Will reply with more information soon.

    Regards,

    Nick

  • Hello Hungwei,

    Ok, here is a summary of what I've learned:

    At the moment, the Linux RemoteProc driver requires a TI version of IPC in the R5 resource table to load R5 firmware. IPC 3.x is only compatible with R5 RTOS, so you will need to use IPC LLD instead. IPC 3.x is in the RTOS SDK under ipc_x_x_x, while IPC LLD is under pdk/packages/ti/drv/ipc.

    Processor SDK 6.1 does NOT have a Linux loading baremetal R5 example. However, Processor SDK 6.3 will add  pdk/packages/ti/drv/ipc/examples/ex04_linux_baremetal_2core_echo_test . 

    When looking at ex04_linux_baremetal_2core_echo_test , important changed files include: pdk/packages/ti/drv/ipc/examples/common/am65xx/linker_r5f_mcu1_0.lds
    pdk/packages/ti/drv/ipc/examples/common/src/ipc_am65xx_rsctable.h

    You can find IPC LLD documentation and build instructions here.  

    Regards,

    Nick

  • Hello Hungwei & future readers,

    I realized some of the steps in the IPC LLD documentation might be unclear. Here are my exact steps:

    Initial Setup
    In Processor SDK 6.3, I made sure that pdk/packages/ti/drv/ipc/examples/ex04_linux_baremetal_2core_echo_test existed

    Build examples (commands assume RTOS SDK is installed on Linux instead of windows)
    cd pdk/packages/
    source ./pdksetupenv.sh
    // check the "Environment Configuration" output. If needed, update values with "export VALUE_NAME=value"
    cd ti/build/
    make -s -j BUILD_PROFILE=debug BOARD=am65xx_evm CORE=mcu1_0 ex04_linux_baremetal_2core_echo_test_clean
    make -s -j BUILD_PROFILE=debug BOARD=am65xx_evm CORE=mcu1_0 ex04_linux_baremetal_2core_echo_test
    cp ../binary/ex04_linux_baremetal_2core_echo_test/bin/am65xx/ex04_linux_baremetal_2core_echo_test_mcu1_0_release.xer5f /nfs/home/root/

    Notes:
    mcu1_0 is R5F0, mcu1_1 is R5F1
    built examples are stored at pdk/packages/ti/binary
    See the IPC LLD documentation for instructions to build examples in windows.

    Run Example 
    // update the nfs filesystem
    reboot
    // log in as root
    // update am65x-mcu-r5f0_0-fw to point to ex04
    cd /lib/firmware
    ln -sf /home/root/ex04_linux_baremetal_2core_echo_test_mcu1_0_release.xer5f am65x-mcu-r5f0_0-fw
    // IPC LLD currently has a bug where echo > stop and echo > start cannot be used with it
    // so we have to reboot the board again
    reboot
    // log in as root
    // run the linux side of the test
    modprobe rpmsg_client_sample count=5

    Notes:
    I tested this with Linux SDK 6.1. Typically, you should make sure the RTOS and Linux SDKs are the same version.

    If IPC LLD worked with echo > stop and echo > start, then I could have used the following commands instead of rebooting after I updated am65x-mcu-r5f0_0-fw:
    // figure out which remoteproc* is r5f0
    grep -Isr r5f /sys/kernel/debug/remoteproc/
    // now stop that core, and restart it to load the updated firmware
    echo stop > /sys/class/remoteproc/remoteproc0/state
    echo start > /sys/class/remoteproc/remoteproc0/state

    This was the output that I saw to verify that the example was working:

    [   12.205073] k3_r5_rproc interconnect@100000:interconnect@28380000:r5fss@41000000: creating child devices for R5F cores
    [   12.326716] platform 41000000.r5f: configured R5F for remoteproc mode
    [   12.337179] platform 41000000.r5f: assigned reserved memory node r5f-dma-memory@a0000000
    [   12.399768] remoteproc remoteproc0: 41000000.r5f is available
    [   12.447396] remoteproc remoteproc0: powering up 41000000.r5f
    [   12.453755] remoteproc remoteproc0: Booting fw image am65x-mcu-r5f0_0-fw, size 461556
    [   12.468340] platform 41000000.r5f: booting R5F core using boot addr = 0x0
    [   12.510273] virtio_rpmsg_bus virtio0: rpmsg host is online
    [   12.511694] virtio_rpmsg_bus virtio0: creating channel ti.ipc4.ping-pong addr 0xd
    [   12.531564] remoteproc remoteproc0: registered virtio0 (type 7)
    [   12.538747] remoteproc remoteproc0: remote processor 41000000.r5f is now up
    ...
    ...
    ...
    root@am65xx-evm:~# modprobe rpmsg_client_sample count=5
    [ 1326.772386] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: new channel: 0x400 -> 0xd!
    [ 1326.780977] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 1 (src: 0xd)
    [ 1326.791147] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 2 (src: 0xd)
    [ 1326.801340] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 3 (src: 0xd)
    [ 1326.809735] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 4 (src: 0xd)
    [ 1326.818132] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 5 (src: 0xd)
    [ 1326.826403] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: goodbye!
    

    Regards,

    Nick

  • Hello Nick,

    Thanks for the update! I will give it a try when SDK 6.3 is released.

  • FYI, I had some typos in my Feb 25 post. The post has been updated.

    -Nick

  • The Feb 25 post shows how I expect building ex04 should work in RTOS SDK 6.3 when it is released.

    Below are detailed steps for building ex04 in RTOS SDK 6.1. NOTE that we did not test any other SDK 6.1 functionality (top-level make files, etc) after making these changes.

    Building on Linux PC, using the terminal.

    1. Download RTOS Processor SDK 06.01. Link to install on Linux PC is here: http://software-dl.ti.com/processor-sdk-rtos/esd/AM65X/latest/exports/ti-processor-sdk-rtos-am65xx-evm-06.01.00.08-Linux-x86-Install.bin

    2. Install SDK
      1. NOTE: install to its own directory to avoid confusion with tool version, etc.
        e.g., I installed to ~/ti/ti-processor-sdk-rtos-am65xx-evm-06.01.00.08-r5-bare-metal-load instead of ~/ti

        $ ./ti-processor-sdk-rtos-am65xx-evm-06.01.00.08-Linux-x86-Install.bin
        (select Yes to all components)

    3. Download the PDK repo master branch. Use the Commit that adds ex04. 
      1. NOTE!!! The following steps are NOT guaranteed to work if you use a different PDK commit. As of March 10 2020, it is possible to use the current PDK commit. However, if you are using the current PDK commit as of March 10 2020, then you must perform these additional steps: 1) copy all drv/ipc/ files over, and 2) uncomment "ipc_EXAMPLE_LIST += ex04_linux_baremetal_2core_echo_test" in drv/ipc/ipc_component.mk

      2. Steps to clone master branch:
        1. $ cd ~/git
          $ git clone https://git.ti.com/git/processor-sdk/pdk.git processor-sdk-pdk
          // checkout commit 2978d3dbde0d48229ecd2aa162c25ba1c4684eec
          $ cd processor-sdk-pdk
          $ git checkout 2978d3dbde0d48229ecd2aa162c25ba1c4684eec

      3. Steps to download zip file:
        1. go to https://git.ti.com/cgit/processor-sdk/pdk/commit/?id=2978d3dbde0d48229ecd2aa162c25ba1c4684eec
        2. in the "Download" area, select pdk-2978d3dbde0d48229ecd2aa162c25ba1c4684eec.zip
        3. unzip to ~/git/processor-sdk-pdk

    4. Copy the PDK files into the SDK
      1. $ cd ~/ti/ti-processor-sdk-rtos-am65xx-evm-06.01.00.08-r5-bare-metal-load/pdk_am65xx_1_0_6/packages/ti/drv/ipc
        $ cp -r ~/git/processor-sdk-pdk/packages/ti/drv/ipc/ipc_component.mk .
        $ cp -r ~/git/processor-sdk-pdk/packages/ti/drv/ipc/examples/common examples/
        $ cp -r ~/git/processor-sdk-pdk/packages/ti/drv/ipc/examples/ex04_linux_baremetal_2core_echo_test examples/
        NOTE: the period tells Linux to copy the files into the current directory

    5. Build the IPC examples
    1. $ cd ~/ti/ti-processor-sdk-rtos-am65xx-evm-06.01.00.08-r5-bare-metal-load/pdk_am65xx_1_0_6/packages
      $ source ./pdksetupenv.sh
      // check that all paths looks correct with printenv. If needed, update values with "export VALUE_NAME=value"
      $ cd ti/build/
      $ make -j BOARD=am65xx_evm SOC=am65xx CORE=mcu1_0 ex04_linux_baremetal_2core_echo_test_clean
      $ make -j BOARD=am65xx_evm SOC=am65xx CORE=mcu1_0 ex04_linux_baremetal_2core_echo_test

      NOTES:mcu1_0 is R5F0, mcu1_1 is R5F1
      built examples are stored at pdk/packages/ti/binary

  • Building on Windows

    1. Download RTOS Processor SDK 06.01.00.08. Link to install on windows PC is here: http://software-dl.ti.com/processor-sdk-rtos/esd/AM65X/latest/exports/ti-processor-sdk-rtos-am65xx-evm-06.01.00.08-Windows-x86-Install.exe

    2. Install SDK
      1. Double-click on installer executable, install all components
      2. Install to its own directory (referred to below as <custom_dir>) to avoid confusion with component & tool versions. For example, install to C:\ti\ti_am65xx_06_01_00_08-r5-bare-metal-load (NOT C:\ti)

    3. Download the whole pdk tarball or zip using https://git.ti.com/cgit/processor-sdk/pdk/snapshot/pdk-2978d3dbde0d48229ecd2aa162c25ba1c4684eec.tar.gz. Extract content to temporary directory (referred to below as <PDK_TB>).


    4. Merge content from pdk tarball to PRSDK 6.1.0.8 / PDK 1.0.6
      1. <PDK_TB>/packages/ti/drv/ipc/ipc_component.mk : copy/paste section for IPC ex04_linux_baremetal_2core_echo_test. This is enough to ensure the example will build. 
      2. <PDK_TB>/packages/ti/drv/ipc/examples/common : rename existing PRSDK 6.1.0.8 / PDK 1.0.6 "common" folder (e.g. to "common_org"). Copy entire "common" folder from tarball content.
      3. <PDK_TB>/packages/ti/drv/ipc/examples/ex04_linux_baremetal_2core_echo_test : copy entire folder from tarball content.

    5. To build, open DOS prompt and follow these steps:
      > cd <custom_dir>\pdk_am65xx_1_0_6\packages
      > pdksetupenv.bat
      > cd ti\build
      > gmake -j BOARD=am65xx_evm SOC=am65xx CORE=mcu1_0 ex04_linux_baremetal_2core_echo_test

    6. Build output located in <custom_dir>\pdk_am65xx_1_0_6\packages\ti\binary\ex04_linux_baremetal_2core_echo_test\bin\am65xx
      • Executable: ex04_linux_baremetal_2core_echo_test_mcu1_0_release.xer5f
      • Map file: ex04_linux_baremetal_2core_echo_test_mcu1_0_release.xer5f.map

    7. Copy the binary into your Linux filesystem

    Running example (using a serial port connection)

    1. If your board is not set up to use an SD card, then: 
      1. set the AM65xx EVM boot switches for MMC/SD boot according to: http://software-dl.ti.com/processor-sdk-rtos/esd/docs/06_01_00_08/rtos/index_how_to_guides.html#recommended-boot-mode

    2. Reboot the board if using an NFS filesystem. This updates the files.
      1. $ reboot

    3. Log in as root
      1. $ root

    4. Update am65x-mcu-r5f0_0-fw to point to ex04
      1. $ cd /lib/firmware

        $ ln -sf /home/root/ex04_linux_baremetal_2core_echo_test_mcu1_0_release.xer5f am65x-mcu-r5f0_0-fw

    5. Reboot the board

      1. As of Processor SDK 6.1 & 6.3, IPC LLD has a bug that prevents echo > stop and echo > start from working with IPC LLD.
      2. So the best way to use Linux to load a new IPC LLD firmware into R5 is to reboot the board.
      3. $ reboot

    6. Log in as root
      1. $ root

    7. Run the Linux sample driver that works with this test. ex04 was already loaded into the R5 during boot.
      1. $ modprobe rpmsg_client_sample count=5

    8. This was the output I saw that verified that the example was working:
      1. // output during boot shows R5 getting initialized
        ...
        [ 12.205073] k3_r5_rproc interconnect@100000:interconnect@28380000:r5fss@41000000: creating child devices for R5F cores
        [ 12.326716] platform 41000000.r5f: configured R5F for remoteproc mode
        [ 12.337179] platform 41000000.r5f: assigned reserved memory node r5f-dma-memory@a0000000
        [ 12.399768] remoteproc remoteproc0: 41000000.r5f is available
        [ 12.447396] remoteproc remoteproc0: powering up 41000000.r5f
        [ 12.453755] remoteproc remoteproc0: Booting fw image am65x-mcu-r5f0_0-fw, size 461556
        [ 12.468340] platform 41000000.r5f: booting R5F core using boot addr = 0x0
        [ 12.510273] virtio_rpmsg_bus virtio0: rpmsg host is online
        [ 12.511694] virtio_rpmsg_bus virtio0: creating channel ti.ipc4.ping-pong addr 0xd
        [ 12.531564] remoteproc remoteproc0: registered virtio0 (type 7)
        [ 12.538747] remoteproc remoteproc0: remote processor 41000000.r5f is now up
        ...
        //log in as root
        ...
        root@am65xx-evm:~# modprobe rpmsg_client_sample count=5
        [ 1326.772386] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: new channel: 0x400 -> 0xd!
        [ 1326.780977] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 1 (src: 0xd)
        [ 1326.791147] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 2 (src: 0xd)
        [ 1326.801340] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 3 (src: 0xd)
        [ 1326.809735] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 4 (src: 0xd)
        [ 1326.818132] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: incoming msg 5 (src: 0xd)
        [ 1326.826403] rpmsg_client_sample virtio0.ti.ipc4.ping-pong.-1.13: goodbye!

      2. Notes:

        I tested this with Linux SDK 6.1. Typically, you should make sure the RTOS and Linux SDKs are the same version.

        If IPC LLD worked with echo > stop and echo > start, then I could have used the following commands instead of rebooting after I updated am65x-mcu-r5f0_0-fw:
        // figure out which remoteproc* is r5f0
        grep -Isr r5f /sys/kernel/debug/remoteproc/
        // now stop that core, and restart it to load the updated firmware
        echo stop > /sys/class/remoteproc/remoteproc0/state
        echo start > /sys/class/remoteproc/remoteproc0/state

  • Hello Nick,

    Thanks for your great help. The example ex04_linux_baremetal_2core_echo_test works on my side. I have merged the resource table into another example <PDK>\packages\ti\csl\test\dmTimerUt\ and it also works.