Skip to content
Switch branches/tags
This branch is up to date with master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

PRUSS Bindings - An API to control the BBB PRUs

Build Status

An API across multiple programming languages to use with the PRUs to load binaries, start/stop, and communicate with the PRUs from the ARM userspace.
An Introductory Video describing the project:
An example made using the API:


The cpp-bindings interact with the Python Daemon Service through a UNIX Domain Socket file at /tmp/pruss.sock of the Linux file system.
The cpp-bindings passes the appropriate request to the daemon through the socket file. The daemon performs the required PRU-related task with root permissions and sends back the return value.
The bindings for other scripting languages can then be built upon the cpp-bindings using SWIG, which takes C++ declarations and creates wrappers needed to access those declarations from other languages. Bindings have also been provided for 'C' language.



  • cpp-bindings/ :
    The API which contains the C++ bindings to control the PRUs using
  • prussd/ :
    The Directory which contains the files related to the daemon which will run as a system service and serve PRU requests. This code does the actual work of controlling the PRUs.
  • examples/ :
    The Directory which contains the example codes using the bindings. Contains firmware examples as well.
    • example1/: A simple LED Blinky example.
    • example2-rpmsg-pru1/: RPMsg Loopback - simplest RPMsg firmware for testing.
    • example3-pwm/: A PWM generator maximum frequency of about 1MHz.
    • example4-analog-wave-gen/: A PWM generator maximum frequency of about 1MHz.
    • example5-multichannel-pwm/: Multi-channel PWM based on the example given in PRU Cookbook - Accuracy needs to be improved.
    • example6-memory-debug/: To read/write to PRU SRAM/DRAM using /dev/mem and to demonstrate showRegs.
    • example7-stepper-control/: A library to accurately control stepper motors which are driven by the PRU.
    • example8-multiple-assembly-calls/: To demonstrate how to link together multiple .asm files and call them from the C-program. Control is passed back to the C-program by using R3.w2
    • example9-multichannel-waveform-gen/: Expanding example4 to upto 8-channels.
  • swig :
    The Directory which contains the swig config and interface files
  • Documentation :
    Contains the API Documentation/Specification
  • :
    The install script for the project
  • drivers :
    A dedicated rpmsg driver for the bindings called pruss_api
  • c-bindings/ :
    The Directory which contains the C bindings for the PRUs.
  • python :
    The Directory which contains the PyPRUSS project (Python Bindings for the PRUs)[Discontinued]

Installing and Using the API

There are two ways for installation:-

  1. Download the packaged .deb file from releases.
    Run dpkg -i pruapi_1.0-1_armhf.deb
    1. Clone this repository:
      git clone
    2. Run the install script
      cd PRUSS-Bindings/
    3. The API is now ready to use, run any specific example from PRUSS-Bindings/examples/firmware_examples/ by cd'ing into the directory and running make. The Makefile will compile the PRU-firmware, load them on to the PRU(using /lib/firmware), compile the userspace program and run it.

Make sure that RPMsg is working, here's a guide for it.

How to use the API?

After installation, this is how a simple userspace program looks like:

#include <iostream>
#include <pruss.h>

using namespace std;
int main()
	PRUSS& p = PRUSS::get();
	PRU p1 = p.pru1;
		cout << "Firmware loaded\n";
                return -1;
	string s;
	cout << "Enter a message   : ";
	getline(cin, s);
	cout << "Message from PRU  : "<< p1.getMsg();
	return 0;


If installation is done from the debian package, compile using:

g++ userspace.cpp -L/usr/lib -lpruss

If installed from source, the processor directive must be #include "path/to/cpp-bindings/pruss.h". Run this program by:

g++ userspace.cpp /path/to/cpp-bindings/pruss.cpp -o userspace.o


config-pin: requires changes in uEnv.txt

HDMI should be disabled. Otherwise this error is encountered:

P9_31 pinmux file not found!
bash: /sys/devices/platform/ocp/ocp*P9_31_pinmux/state: No such file or directory
Cannot write pinmux file: /sys/devices/platform/ocp/ocp*P9_31_pinmux/state


  1. sudo vim /boot/uEnv.txt.
  2. uncomment the line disable_uboot_overlay_video=1

Make sure that proper paths and symbolic links have been made for clpru and lnkpru.

The PRU compiler and linker are already installed on the standard images. They are called clpru and lnkpru.

  1. export PRU_CGT=/usr/share/ti/cgt-pru
  2. cd $PRU_CGT
  3. mkdir -p bin
  4. cd bin
  5. ln -s which clpru .
  6. ln -s which lnkpru .
    Refer and!topic/beagleboard/MBmIm0EnNfc

RPMsg Guide


Using SWIG to generate wrapper files.