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.

Linux/AM5728: Example PRU Boot Failure

Part Number: AM5728

Tool/software: Linux

I am using the PRU Software Support Package Release 3.0. Using Linux kernel version 4.9 based on Ti's SDK.

I have configured the PRU in a manner that they are able to operate without RPMsg, but I intend on using RPMsg for communication with the A15's.  remoteproc3 (pru1_0) is being loaded with code that waits for an interrupt from remoteproc4 (pru1_1), without any configuration for rpmsg. pru1_1 is copied from the software support package (pru\examples\am572x\PRU_RPMsg_Echo_Interrupt1_1), meaning I copied main.c and resource_table_1.h.  I am using the default AM57xx_PRU.cmd created when creating a new PRU Project:

/****************************************************************************/
/*  AM57xx_PRU.cmd                                                          */
/*  Copyright (c) 2015  Texas Instruments Incorporated                      */
/*                                                                          */
/*    Description: This file is a linker command file that can be used for  */
/*                 linking PRU programs built with the C compiler and       */
/*                 the resulting .out file on an AM57xx device.             */
/****************************************************************************/

-cr    /* Link using C conventions */

/* Specify the System Memory Map */
MEMORY
{
    PAGE 0:
    PRU_IMEM        : org = 0x00000000 len = 0x00003000  /* 12kB PRU Instruction RAM */

    PAGE 1:

    /* RAM */

    PRU_DMEM_0_1    : org = 0x00000000 len = 0x00002000  CREGISTER=24  /* 8kB PRU Data RAM 0_1 */
    PRU_DMEM_1_0    : org = 0x00002000 len = 0x00002000  CREGISTER=25  /* 8kB PRU Data RAM 1_0 */
                                                        
    PAGE 2:                                             
    PRU_SHAREDMEM   : org = 0x00010000 len = 0x00008000  CREGISTER=28  /* 32kB Shared RAM */
                                                        
    DDR             : org = 0x80000000 len = 0x00000100  CREGISTER=31
    L3OCMC          : org = 0x40000000 len = 0x00010000  CREGISTER=30


    /* Peripherals */

    PRU_CFG         : org = 0x00026000 len = 0x00000120  CREGISTER=4
    PRU_ECAP        : org = 0x00030000 len = 0x00000060  CREGISTER=3
    PRU_IEP         : org = 0x0002E000 len = 0x0000031C  CREGISTER=26
    PRU_INTC        : org = 0x00020000 len = 0x00001504  CREGISTER=0
    PRU_UART        : org = 0x00028000 len = 0x00000038  CREGISTER=7    
    
    MCASP3_DMA      : org = 0x46000000 len = 0x00000100  CREGISTER=8
    I2C3            : org = 0x48060000 len = 0x00000300  CREGISTER=5
    
    RSVD1           : org = 0x48040000 len = 0x0000005C  CREGISTER=1
    RSVD2           : org = 0x4802A000 len = 0x000000D8  CREGISTER=2
    RSVD6           : org = 0x48030000 len = 0x000001A4  CREGISTER=6
    RSVD9           : org = 0x4A100000 len = 0x0000128C  CREGISTER=9
    RSVD10          : org = 0x48318000 len = 0x00000100  CREGISTER=10
    RSVD11          : org = 0x48022000 len = 0x00000088  CREGISTER=11
    RSVD12          : org = 0x48024000 len = 0x00000088  CREGISTER=12
    RSVD13          : org = 0x48310000 len = 0x00000100  CREGISTER=13
    RSVD14          : org = 0x481CC000 len = 0x000001E8  CREGISTER=14
    RSVD15          : org = 0x481D0000 len = 0x000001E8  CREGISTER=15
    RSVD16          : org = 0x481A0000 len = 0x000001A4  CREGISTER=16
    RSVD17          : org = 0x4819C000 len = 0x000000D8  CREGISTER=17
    RSVD18          : org = 0x48300000 len = 0x000002C4  CREGISTER=18
    RSVD19          : org = 0x48302000 len = 0x000002C4  CREGISTER=19
    RSVD20          : org = 0x48304000 len = 0x000002C4  CREGISTER=20
    RSVD21          : org = 0x00032400 len = 0x00000100  CREGISTER=21
    RSVD22          : org = 0x480C8000 len = 0x00000140  CREGISTER=22
    RSVD23          : org = 0x480CA000 len = 0x00000880  CREGISTER=23
    RSVD27          : org = 0x00032000 len = 0x00000100  CREGISTER=27
    RSVD29          : org = 0x49000000 len = 0x00001098  CREGISTER=29
}

/* Specify the sections allocation into memory */
SECTIONS {

/* Forces _c_int00 to the start of PRU IRAM. Not necessary when */
/* loading an ELF file, but useful when loading a binary        */

    .text:_c_int00*    >  0x0, PAGE 0
    .text              >  PRU_IMEM, PAGE 0
    .stack             >  PRU_DMEM_0_1, PAGE 1
    .bss               >  PRU_DMEM_0_1, PAGE 1
    .cio               >  PRU_DMEM_0_1, PAGE 1
    .data              >  PRU_DMEM_0_1, PAGE 1
    .switch            >  PRU_DMEM_0_1, PAGE 1
    .sysmem            >  PRU_DMEM_0_1, PAGE 1
    .cinit             >  PRU_DMEM_0_1, PAGE 1
    .rodata            >  PRU_DMEM_0_1, PAGE 1
    .rofardata         >  PRU_DMEM_0_1, PAGE 1
    .farbss            >  PRU_DMEM_0_1, PAGE 1
    .fardata           >  PRU_DMEM_0_1, PAGE 1
    .resource_table    >  PRU_DMEM_0_1, PAGE 1
}

I've noticed that it is either reads or writes to the MBX3 causes this failure to occur. In my device tree, I have the following:

#include "dra74x.dtsi"
&mailbox3 {
    status = "okay";
    mbox_pru1_0: mbox_pru1_0 {
        status = "okay";
    };
    mbox_pru1_1: mbox_pru1_1 {
        status = "okay";
    };
};

&mailbox4 {
    status = "okay";
    mbox_pru2_0: mbox_pru2_0 {
        status = "okay";
    };
    mbox_pru2_1: mbox_pru2_1 {
        status = "okay";
    };
};

In my menu config, I have the following items configured for remoteproc/rpmsg:

#
# Remoteproc drivers
#
CONFIG_REMOTEPROC=m
CONFIG_OMAP_REMOTEPROC=m
CONFIG_OMAP_REMOTEPROC_WATCHDOG=y
CONFIG_PRUSS_REMOTEPROC=m

#
# Rpmsg drivers
#
CONFIG_RPMSG=m
CONFIG_RPMSG_VIRTIO=m
CONFIG_RPMSG_RPC=m
CONFIG_RPMSG_PRU=m

CONFIG_SAMPLES=y
# CONFIG_SAMPLE_KOBJECT is not set
# CONFIG_SAMPLE_HW_BREAKPOINT is not set
# CONFIG_SAMPLE_KFIFO is not set
CONFIG_SAMPLE_RPMSG_CLIENT=m
# CONFIG_SAMPLE_CONFIGFS is not set
# CONFIG_SAMPLE_SECCOMP is not set

Below is the log I get when booting up both of the remoteproc pru's. Specifically, I was able to isolate the issue to interfacing with MBX3 (spefically:

MBX3.IRQ[MB_USER].ENABLE_SET |= 1 << (MB_FROM_ARM_HOST * 2);

is the first instance I find where the code fails.

[ 7582.349432] ti-pruss 4b200000.pruss: unconfigured system_events = 0xffffffffffffffff host_intr = 0x00000001
[ 7582.359310] remoteproc remoteproc3: stopped remote processor 4b234000.pru0
[ 7582.371433] ti-pruss 4b200000.pruss: unconfigured system_events = 0x0800000000000000 host_intr = 0x00000002
[ 7582.385001] remoteproc remoteproc4: stopped remote processor 4b238000.pru1
*****************************
[ 7582.401328] remoteproc remoteproc3: powering up 4b234000.pru0
[ 7582.407303] remoteproc remoteproc3: Booting fw image am57xx-pru1_0-fw, size 51980
[ 7582.414844] remoteproc remoteproc3: remote processor 4b234000.pru0 is now up
[ 7582.425614] remoteproc remoteproc4: powering up 4b238000.pru1
[ 7582.431538] remoteproc remoteproc4: Booting fw image am57xx-pru1_1-fw, size 82716
[ 7582.441580] ti-pruss 4b200000.pruss: configured system_events = 0x0800000000000000 intr_channels = 0x00000002 host_intr = 0x00000002
[ 7582.455249] ------------[ cut here ]------------
[ 7582.459897] WARNING: CPU: 0 PID: 961 at /opt/PHYTEC_BSP/yocto_ti/build/arago-tmp-external-linaro-toolchain/work-shared/am57xx-phycore-rdk/kernel-source/drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x25c/0x36c
[ 7582.479014] 44000000.ocp:L3 Custom Error: MASTER PRUSS1 PRU2 TARGET L4_PER2_P3 (Read): Data Access in User mode during Functional access
[ 7582.491323] Modules linked in: cbc xfrm_user xfrm4_tunnel ipcomp xfrm_ipcomp esp4 ah4 af_key xfrm_algo pvrsrvkm(O) xhci_plat_hcd xhci_hcd pru_rproc pruss_intc usbcore pruss rpmsg_proto dwc3 udc_core usb_common rpmsg_rpc ecb sha512_generic sha512_arm bluetooth sha256_generic hmac snd_soc_simple_card snd_soc_simple_card_utils ahci_platform libahci_platform libahci md5 libata omap_aes_driver sha1_generic sha1_arm_neon sha1_arm omap_wdt pruss_soc_bus omap_sham scsi_mod ti_vpe ti_sc ti_csc ti_vpdma dwc3_omap rtc_omap c_can_platform c_can can_dev omap_des des_generic rtc_palmas crypto_engine extcon_palmas snd_soc_tlv320aic3x omap_rng extcon_core rng_core omap_remoteproc virtio_rpmsg_bus rpmsg_core remoteproc virtio virtio_ring sch_fq_codel uio_module_drv(O) uio gdbserverproxy(O) cryptodev(O) cmemk(O)
[ 7582.562630] CPU: 0 PID: 961 Comm: bash Tainted: G        W  O    4.9.41-g61a65e1-BSP-Yocto-TISDK-AM57xx-PD18.2.0 #1
[ 7582.573109] Hardware name: Generic DRA72X (Flattened Device Tree)
[ 7582.579225] Backtrace:
[ 7582.581703] [<c020b208>] (dump_backtrace) from [<c020b4c4>] (show_stack+0x18/0x1c)
[ 7582.589307]  r7:00000009 r6:60050193 r5:00000000 r4:c102f8d0
[ 7582.595000] [<c020b4ac>] (show_stack) from [<c04f4940>] (dump_stack+0x8c/0xa0)
[ 7582.602261] [<c04f48b4>] (dump_stack) from [<c022d030>] (__warn+0xec/0x104)
[ 7582.609254]  r7:00000009 r6:c0bd99e0 r5:00000000 r4:ed17fb60
[ 7582.614943] [<c022cf44>] (__warn) from [<c022d088>] (warn_slowpath_fmt+0x40/0x48)
[ 7582.622459]  r9:0000001a r8:ef1dd6d0 r7:c0bd9dbc r6:00000002 r5:c0bd990c r4:c0bd99b0
[ 7582.630241] [<c022d04c>] (warn_slowpath_fmt) from [<c0524510>] (l3_interrupt_handler+0x25c/0x36c)
[ 7582.639150]  r3:ef1dd540 r2:c0bd99b0
[ 7582.642739]  r4:80080003
[ 7582.645285] [<c05242b4>] (l3_interrupt_handler) from [<c027de80>] (__handle_irq_event_percpu+0xb4/0x138)
[ 7582.654808]  r10:c101a36f r9:ef1e0000 r8:00000017 r7:ed17fc84 r6:00000000 r5:ef1e0000
[ 7582.662668]  r4:ef1dda40
[ 7582.665214] [<c027ddcc>] (__handle_irq_event_percpu) from [<c027df28>] (handle_irq_event_percpu+0x24/0x60)
[ 7582.674910]  r10:ed0a421c r9:ed17e000 r8:ef006000 r7:00000000 r6:c1008b74 r5:ef1e0000
[ 7582.682771]  r4:ef1e0000
[ 7582.685317] [<c027df04>] (handle_irq_event_percpu) from [<c027dfa4>] (handle_irq_event+0x40/0x64)
[ 7582.694225]  r5:ef1e0060 r4:ef1e0000
[ 7582.697818] [<c027df64>] (handle_irq_event) from [<c0281650>] (handle_fasteoi_irq+0xc0/0x190)
[ 7582.706379]  r7:00000000 r6:c1008b74 r5:ef1e0060 r4:ef1e0000
[ 7582.712068] [<c0281590>] (handle_fasteoi_irq) from [<c027d0a8>] (generic_handle_irq+0x2c/0x3c)
[ 7582.720716]  r7:00000000 r6:00000000 r5:00000017 r4:c0e55da0
[ 7582.726402] [<c027d07c>] (generic_handle_irq) from [<c027d630>] (__handle_domain_irq+0x64/0xbc)
[ 7582.735140] [<c027d5cc>] (__handle_domain_irq) from [<c02014a0>] (gic_handle_irq+0x40/0x7c)
[ 7582.743528]  r9:ed17e000 r8:fa213000 r7:fa212000 r6:ed17fd40 r5:fa21200c r4:c1003420
[ 7582.751306] [<c0201460>] (gic_handle_irq) from [<c020c078>] (__irq_svc+0x58/0x8c)
[ 7582.758819] Exception stack(0xed17fd40 to 0xed17fd88)
[ 7582.763894] fd40: ed0a4028 00000000 00000004 ed0a4044 ed0a4028 ed0a4020 00000007 ed20c828
[ 7582.772107] fd60: ed0a4020 ed20c804 ed0a421c ed17fdac ed17fdb0 ed17fd90 c061fcd8 c04f6ed8
[ 7582.780318] fd80: 60050013 ffffffff
[ 7582.783822]  r9:ed17e000 r8:ed0a4020 r7:ed17fd74 r6:ffffffff r5:60050013 r4:c04f6ed8
[ 7582.791602] [<c04f6e94>] (kobject_get) from [<c061fcd8>] (get_device+0x1c/0x24)
[ 7582.798940]  r4:ed20c800
[ 7582.801504] [<c061fcbc>] (get_device) from [<bf045f10>] (rproc_add_virtio_dev+0x48/0xfc [remoteproc])
[ 7582.810787] [<bf045ec8>] (rproc_add_virtio_dev [remoteproc]) from [<bf0432f4>] (rproc_vdev_do_probe+0x18/0x1c [remoteproc])
[ 7582.821965]  r7:00000000 r6:ed0a41cc r5:ed0a41c4 r4:ed0a4000
[ 7582.827670] [<bf0432dc>] (rproc_vdev_do_probe [remoteproc]) from [<bf044fa4>] (__rproc_boot+0x4bc/0x5bc [remoteproc])
[ 7582.838348] [<bf044ae8>] (__rproc_boot [remoteproc]) from [<bf0450b4>] (rproc_boot+0x10/0x14 [remoteproc])
[ 7582.848044]  r10:00000000 r9:00000000 r8:00000000 r7:00000006 r6:ed0a4000 r5:ede63b00
[ 7582.855905]  r4:ed0a4020
[ 7582.858471] [<bf0450a4>] (rproc_boot [remoteproc]) from [<bf045830>] (state_store+0x78/0x140 [remoteproc])
[ 7582.868180] [<bf0457b8>] (state_store [remoteproc]) from [<c061f5f8>] (dev_attr_store+0x20/0x2c)
[ 7582.877003]  r7:ede63b00 r6:ed17ff78 r5:00000006 r4:bf0457b8
[ 7582.882694] [<c061f5d8>] (dev_attr_store) from [<c03958e4>] (sysfs_kf_write+0x48/0x4c)
[ 7582.890642]  r5:00000006 r4:c061f5d8
[ 7582.894238] [<c039589c>] (sysfs_kf_write) from [<c0395090>] (kernfs_fop_write+0xdc/0x1dc)
[ 7582.902449]  r5:00000006 r4:ed1b4c00
[ 7582.906044] [<c0394fb4>] (kernfs_fop_write) from [<c032cd60>] (__vfs_write+0x34/0x120)
[ 7582.913997]  r10:00000000 r9:00000006 r8:00000000 r7:00000006 r6:ed17ff78 r5:c0394fb4
[ 7582.921858]  r4:ee4383c0
[ 7582.924402] [<c032cd2c>] (__vfs_write) from [<c032dba8>] (vfs_write+0xac/0x170)
[ 7582.931745]  r9:00000006 r8:00000000 r7:ed17ff78 r6:000c9450 r5:ee4383c0 r4:00000006
[ 7582.939523] [<c032dafc>] (vfs_write) from [<c032e96c>] (SyS_write+0x44/0x98)
[ 7582.946603]  r9:00000006 r8:000c9450 r7:00000000 r6:00000000 r5:ee4383c0 r4:ee4383c0
[ 7582.954383] [<c032e928>] (SyS_write) from [<c0207b60>] (ret_fast_syscall+0x0/0x34)
[ 7582.961986]  r9:ed17e000 r8:c0207d04 r7:00000004 r6:b6eb7d58 r5:000c9450 r4:00000006
[ 7582.969761] ---[ end trace 217676a793821aa8 ]---
[ 7582.984274] virtio_rpmsg_bus virtio3: rpmsg host is online
[ 7582.999935] remoteproc remoteproc4: registered virtio3 (type 7)
[ 7583.021781] remoteproc remoteproc4: remote processor 4b238000.pru1 is now up

I have not been able to find why the rpmsg has not been able to load, is there anything obvious in my configuration that would prevent rpmsg not being loaded?

  • Hello Lucas,

    1) It looks like PRU Software Support Package 5.1.0 was bundled with TI's Linux Processor SDK 4.1 (you can find the Software Support Package included in the sdk at ti-processor-sdk-linux-am57xx-evm-04.01.00.06/example-applications/pru-icss-5.1.0). I would not expect PRU Software Support Package 3.0 to work with Linux 4.9.

    2) Are you looking at the resource table file? It includes interrupt mapping information (mailboxes got replaced by interrupts in either SW Support Package 4.x or 5.0)

    Regards,
    Nick
  • Hi Nick,

    Thanks for the input and it has helped quite a bit! I checked into a more modern software support package, and I am able to build and load the new code and resource files without catastrophic failure.

    However, I am not seeing a device enumerate under /dev/rpmsg_31. I did double check that lsmod returns "rpmsg_pru" prior to booting the PRU.  Below is the boot log from powering up the new system:

    [86232.085712] remoteproc remoteproc3: powering up 4b234000.pru0
    [86232.091738] remoteproc remoteproc3: Booting fw image am57xx-pru1_0-fw, size 51980
    [86232.101686] remoteproc remoteproc3: remote processor 4b234000.pru0 is now up
    [86232.110171] remoteproc remoteproc4: powering up 4b238000.pru1
    [86232.116099] remoteproc remoteproc4: Booting fw image am57xx-pru1_1-fw, size 83488
    [86232.126121] ti-pruss 4b200000.pruss: configured system_events = 0x00000000000c0000 intr_channels = 0x0000000a host_intr = 0x0000000a
    [86232.140695] virtio_rpmsg_bus virtio3: rpmsg host is online
    [86232.150317] remoteproc remoteproc4: registered virtio3 (type 7)
    [86232.156269] remoteproc remoteproc4: remote processor 4b238000.pru1 is now up

    I do see however that the following devices are enumerated on the filesystem:

    /sys/bus/virtio/devices/virtio3
    /sys/bus/virtio/drivers/virtio_rpmsg_bus/virtio3

    Is this new enumerated device what I should be interfacing with instead of /dev/rpmsg_xx?

  • Hello Lucas,

    If you copy-pasted the resource table and the main.c function from the RPMsg example in the newer version of the PRU SW Support package, I would expect you to see /dev/rmpsg_xx to show up. For a known good state, try simply running the RPMsg example in the RPMsg Quick Start Guide before doing anything more complex.

    This is the line where /dev/rpmsg_xx is actually created in the RPMsg example main.c code:

           /* Create the RPMsg channel between the PRU and ARM user space using the transport structure. */

           while (pru_rpmsg_channel(RPMSG_NS_CREATE, &transport, CHAN_NAME, CHAN_DESC, CHAN_PORT) != PRU_RPMSG_SUCCESS);

    Regards,

    Nick

  • Hi Nick,

    Not entirely sure what I changed, but I selectively re-added code, and changed my boot script and things appear to be booting correctly. Now /dev/rpmsg_pru31 boots up without any issues and I can read/write to it as well as described in the link you provided.