Using PRU with PocketBeagle: remoteproc problems

I got a PocketBeagle and I want to try out the PRU on it. Everything seems different from the PRUSSDRV stuff I’m used to. I can’t get remoteproc to work, so I wanted to know which kernel and interfaces I should use.

Specifically, I’m running the 2017-10-10 Stretch IoT build from http://beagleboard.org/latest-images
I tried running the remoteproc “Hello world” from here.
First, I ran into problems with stdint.h not found; I eventually found it in /usr/share/ti/cgt-pru/include - is that the right include path to use?
When I ran the program, I got a bunch of warnings:

Note: remoteproc is still under development and considered experimental.
THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn’t yet guaranteed.

And then the program died with “Failed to open /dev/rpmsg_pru31”

So: is remoteproc what I should be using, or is it still “experimental”? Am I using the right kernel? And what is “resource_table.h”?

Thanks for any suggestions,
Ken

Which kernel version are you using? If it’s the 4.9 version (most likely as it is the Stretch image), some additional steps are required because the binary won’t start up automatically at boot as it does in kernel version 4.4.
This is a change that happened done going from 4.4-4.9.

To boot the binary, once you build and put it into /lib/firmware you would have to manually boot it.

  • Go to /sys/class/remoteproc in a root shell
  • There should be 3 directories, remoteproc0, remoteproc1, remoteproc2. To find which is the correct one for PRU0 for example, do: cat /sys/class/remoteproc/remoteproc1/device/of_node/label . It should say “pru0” (at least it does on my board)
  • Once you have found the correct remoteproc directory, cd into it. Let’s for example assume for PRU0 the directory is /sys/class/remoteproc/remoteproc1
  • Then you have to set the name for the firmware you have copied into /lib/firmware using: echo am335x-pru0-fw > firmware .
  • Then you have to start the device using: echo start > state . To stop the PRU, do: echo stop > state .
    I hope this should get the rpmsg driver to show up. Pastebin your kernel logs so that I can take a look.

Resource table is a way of signifying to the remoteproc driver:

  • the PRU interrupts it should configure on PRU boot,

  • virtqueues used for PRU<->Kernel communication

The resource table is placed in an ELF section that the remoteproc kernel driver reads before it loads the firmware into the PRUs.

Regards
Abhishek

Hi Ken,
Having recently also bought a pocket beagle(my first), I ran through these steps from Jason, as he suggested in another thread recently, successfully : https://gist.github.com/jadonk/2ecf864e1b3f250bad82c0eae12b7b64
I thought it would be instructive to work out how to run the example you tried also though. Basically taking the working gist and resolving issues with your example as they appear.
Resulting in:

Received 100 messages, closing /dev/rpmsg_pru31

ie. success. It did a thing.
Thanks,
Alex

Alex, thank you for such a detailed response. Your answer solved all my problems.

Ken

Hi Kumar,

I am also having some troubles with rpmsg, having migrated from 4.4 to 4.9.

Your instructions seem to work fine, at least when I run my program for the first time. If I want to change the firmware for the PRU, I have to remove the pru_rproc module, but when I load the module again I no longer have the 3 directories remoteproc0, remoteproc1 and remoteproc2, but instead I have remoteproc0, remoteproc3 and remoteproc4. If I ignore that and try to run my program again I get a bunch of messages from syslogd@beaglebone and everything ends with a segmentation fault.

If I try to use the new files, remoteproc3 and remoteproc4, I get the following errors (output of dmesg):

`
[ 1765.434025] remoteproc remoteproc3: 4a334000.pru0 is available
[ 1765.434147] pru-rproc 4a334000.pru0: PRU rproc node /ocp/pruss_soc_bus@4a326000/pruss@4a300000/pru@4a334000 probed successfully
[ 1765.441036] remoteproc remoteproc4: 4a338000.pru1 is available
[ 1765.441157] pru-rproc 4a338000.pru1: PRU rproc node /ocp/pruss_soc_bus@4a326000/pruss@4a300000/pru@4a338000 probed successfully
[ 1765.685583] remoteproc remoteproc3: powering up 4a334000.pru0
[ 1765.686156] remoteproc remoteproc3: Booting fw image am335x-pru0-fw, size 80748
[ 1765.686896] ti-pruss 4a300000.pruss: event 16 (req. channel 2) already assigned to channel 2
[ 1765.700540] pru-rproc 4a334000.pru0: failed to configure pruss intc -17
[ 1765.709720] remoteproc remoteproc3: Failed to process post-loading resources: -17
[ 1765.719518] remoteproc remoteproc3: Boot failed: -17
[ 1765.796012] remoteproc remoteproc4: powering up 4a338000.pru1
[ 1765.796519] remoteproc remoteproc4: Booting fw image am335x-pru1-fw, size 80748
[ 1765.801629] ti-pruss 4a300000.pruss: event 18 (req. channel 3) already assigned to channel 3
[ 1765.810696] pru-rproc 4a338000.pru1: failed to configure pruss intc -17
[ 1765.821230] remoteproc remoteproc4: Failed to process post-loading resources: -17
[ 1765.831046] remoteproc remoteproc4: Boot failed: -17

`

So the events are still assigned to the previous channels?
Can you please help me understand what’s happening? First of all, what are these remoteproc1,2,etc. files (are they somehow related to the channels used to communicate with the PRU?), why do remoteproc1/2 disappear from /sys/class/remoteproc but the events are still assigned to them? And finally, how can I reload the firmware in case of a change?

Best regards,
Laura

TI changed a few things, if you were using the v4.4.x-ti remoteproc
pru option, it's best to downgrade to v4.4.x..

It'll takes us a while to adapt to those changes.

Regards,

Hi Alex,
thank you for your recommendations, got an adaption of the project remoteproc “Hello World” working on Debian 2017/10/10.
If somebody is interested, here is a running version on Github.
https://github.com/RoSchmi/Beaglebone-PRU-RPMsg-HelloWorld
Kind regards
RoSchmi