PRU remoteproc Tutorial

It looks like the new way to talk to the PRUs is via remoteproc and RPMsg.

Does anyone have pointers to some good tutorials? Or some good debuggers?

ZeekHuge has a Google Summer of Code project (2016) that has some nice remoteproc examples, and he
built some nice tools.

I’m putting together a wiki that shows how to setup your Bone to run his examples. (http://elinux.org/EBC_Exercise_30_PRU_via_remoteproc_and_RPMsg).
I’m open for additions/corrections so we can have a one stop place for those using the PRUs with remoteproc.

–Mark

Hi Mark,

Are you using CCS or GCC tools ?

clpru. It’s already installed on the Bone.

–Mark

Hi Mark,

Yes, that’s a given. But host, or ARM( Linux ) side ?

gcc. My students are running Linux on their host and gcc is already there.

–Mark

Mark,

To put it simply. I’m still waiting for someone to write up decent examples, and maybe even documentation for writing host side code using gcc toolchains. All I’ve seen so far is CCS examples, which won’t work for me. See I guess I don’t understand how the two halves work together . . . yet.

Mark,

Excellent ! I look forward to looking over your course material. Do you plan on giving a deep dive into communications between both sides. Host, and PRU ? Not sure if that fits into your course plans or not but I know I would to learn this myself. Also the PRU config files, hex files . . . not sure I’m remembering that correctly or not. But it’s the config files that seem to layout stuff like .bss .data, etc . . . No idea if you plan on covering that either. But someone needs to.

For the ARM or PRU? I don’t think gcc for PRU ships in the image, though it should.

Hi Jason.

Well no that’s not what I was getting at. I have a number of concerns. The below with GCC( not CCS ) in mind, as well as remoteproc in place of uio_pruss.

  • I have not found any example code that demonstrates communications between PRU and ARM
  • I have not found any example code that demonstrates loading PRU code from the ARM binary
  • I have not found any example code that demonstrates how to manipulate peripherals from the PRU via remoteproc.

Also I have not seen any coherent documentation explaining this PRU config file that lays out .bss, .data, and code data segments. I think it actually does more than this too, but . . . I’m going from memory here, and I’ve found no documentation on the subject. So. . . I do not really know what else to say about it.

Maybe there is too much assumption happening here ? The assumption that someone should already know what is going on ? But I do not operate that way. If something is not spelled out, I do not necessarily assume anything.

The TI training site is a bit confusing, and I’m still not sure this is the latest:

http://software-dl.ti.com/public/hpmp/sitara/building_blocks_for_pru_dev_summary/index.html

The above is a good starting point. Homework 1?

Greg

One note on the compiler set-up:

Hi William-

Regarding the .bss .data etc., this may be helpful:

https://training.ti.com/pru-compiler-tips-tricks

Topic 21 and 22? Not sure if this is what you are looking for.
Less specific to the PRU, more like TI general style:

http://processors.wiki.ti.com/index.php/Linker_Command_File_Primer

Regards,
Greg

A “future” remote-proc project, last commit 2015, probably not active:

Note the system flow diagram on the above page.
I really like the way to diagram is split into three domains.
Nicely done!

Regards,
Greg

Hi William-

Regarding the .bss .data etc., this may be helpful:

https://training.ti.com/pru-compiler-tips-tricks

Yes, and no. The talker talks about the different sections, but doesn’t really say anything that matters. However he did mention something about the compiler manual. I’ve read part of this, maybe I missed it in the manual.

Topic 21 and 22? Not sure if this is what you are looking for.
Less specific to the PRU, more like TI general style:

http://processors.wiki.ti.com/index.php/Linker_Command_File_Primer

Again. . . yes and no. This explains some of what I’m asking, but it’s no where near complete.

Thanks for the reply Greg, I do appreciate the effort. However, as usual, I’m finding TI’s documentation lacking, as well as spread out all over the place. However, with the last iteration of remoteproc I got the sense that the cmd file( hex file whatever it is ) is less important. I did recognize the MSP430 sections, as I’ve seen the file before in the wild, and in fact I’m working on an MSP430 project right now . . .

Jason:
I’m using gcc on the ARM and clpru on the PRU. Both are installed.

What would you gain by using gcc on the PRU?

–Mark

William:
I’m not sure how far I will get. It depends on how easy it is to find the information I need.

I’d like to build a framework for simple devices. For example make it easy to add another eQEP, PWM, or I2C device via the PRU.

What sort of examples would make good starting points?

–Mark

Greg:
I tried removing the symbolic links and I get the following error when running make on a BeagleScope example.

Invoking: PRU Compiler
/usr/share/ti/cgt-pru/bin/clpru --include_path=/usr/share/ti/cgt-pru/include --include_path=…/…/…/include --include_path=…/…/…/include/am335x -v3 -O2 --display_error_number --endian=little --hardware_mac=on --obj_directory=gen --pp_directory=gen -ppd -ppa -fe gen/PRU_gpioToggle.object PRU_gpioToggle.c
make: /usr/share/ti/cgt-pru/bin/clpru: Command not found
Makefile:63: recipe for target ‘gen/PRU_gpioToggle.object’ failed

The error goes away when I put the link back. Maybe the BeagleScope makefiles aren’t set up right.

–Mark

Hi Mark,

Well I do not know, what would be the simplest example that is close enough to the traditional hello world app ? I was thinking perhaps blinking a USR LED, since one would not have to add any additional hardware. But I looked into that a while back, and doing this would not be a trivial matter I think. Well actually . . . it depends on how remoteproc is implemented. If remoteproc can gain direct access to CPU memory addressing as can be done using uio_pruss. Then it should not be too much trouble.

So maybe an external LED example? Which would work out very close to how one would toggle a GPIO( LED ) on a bare metal platform. So anyone having background experience with something like a TI Launchpad or Arduino should be able to understand this very easily.

Passed that . . some kind of communication example. I was thinking perhaps usrspace to PRU core 1, to PRU core 2, then back to userspace. As a way for people to get their feet wet, with something easily verifiable. Then perhaps a shared memory example.

Jason:
I’m using gcc on the ARM and clpru on the PRU. Both are installed.

What would you gain by using gcc on the PRU?

–Mark

Let me answer this for you Mark. You would gain nothing. The contributor of the pru gcc implementation hints that it’s nothign more than a toy, and that code generated with it should be thought of nothign more than experimental. It says this right on the github project page readme.md.

heh I forgot that “readme dot md’s” actually link to some random github project heh. So . .

The release is ready for cautious usage. A simulator is used to execute the GCC C regression test suite. Results for this release are:

# of expected passes           81497
# of unexpected failures       31
# of unexpected successes      1
# of expected failures         97
# of unsupported tests         1974

This message has changed some since the last time I read it but pretty much the same result. In my mind - Don’t use it.