-
Notifications
You must be signed in to change notification settings - Fork 11
Home
This is Google Summer of Code 2020 project under beagleboard.org aimed at achieving:
- Provide a simple to use language to write code for the PRU
- Provide a simple to use way to start/stop PRU and send/receive messages through RPMSG framework, without the need to write to various sysfs interfaces
- Name: Vedant Paranjape
- Mentors: Abhishek Kumar, Pratim Ugale, Andrew Henderson
- Organisation: BeagleBoard.org
- Code: https://github.com/VedantParanjape/simpPRU
- Project Page: https://summerofcode.withgoogle.com/projects/#4764906932404224
- Progress log: https://ve0x10.me/gsoc2020/
- Introductory Video: https://youtu.be/AXacKDdxSdY
- Final Video: TBA
- Detailed Documentation: https://simppru.readthedocs.io/en/latest/
- Brief overview of PRU-ICSS
- What was the need for simpPRU ?
- How does simpPRU simplify things ?
- Implementation details of simpPRU
- Language reference
- Building from source
- Installation from compiler binaries
- Work Summary
- Things to be implemented in Future
- Conclusion
- Known Issues
- Notes
The PRU is a dual core micro-controller system present on the AM335x SoC which powers the BeagleBone. It is meant to be used for high speed jitter free IO control. Being independent from the linux scheduler and having direct access to the IO pins of the BeagleBone Black, the PRU is ideal for offloading IO intensive tasks.
It is a low-latency microcontroller subsystem, which provides real-time processing capability lacking in Linux. PRUs are part of the PRU-ICSS, “Industrial Communications SubSystem”. They are free from running on an operating system, and thus can be dedicated to a single function.

The PRU cores were created to be non-pipelined, single-cycle execution engines. This means that all instructions (except for memory reads and writes) complete in a single cycle. Since there is no pipeline, the PRU cores are completely deterministic: the PRU cores will not rearrange instructions during execution.
The PRU-ICSS can also read from or write to external pins in a single cycle using a PRU core register (R30/R31). With a PRU core running at 200 MHz, this means that an external signal change can be detected in as little as 5 nanoseconds. This also means that the PRU can toggle external pins with as fast as 5 nanoseconds.
The PRU-ICSS also has an interrupt controller, it does not support asynchronous interrupts as they introduce jitter in execution time and reduce determinism. Instead it supports an efficient polling system.
Programming the PRU is a uphill task for a beginner, since it involves several steps, writing the firmware for the PRU, writing a loader program. This can be a easy task for a experienced developer, but intimidating for a beginner.
This problem was solved earlier by pruspeaks project, but it inflicts serious restrictions on PRU, as PRU0 runs a bot speaks interpreter and PRU1 takes care of generating PWM signals. Already PRU has meagre resources, so emulating a VM on top of PRU leaves very less room to use PRU for what it is meant, deterministic control and fast read writes.
- flex
- bison
- gcc
- gcc-pru
- cmake
git clone https://github.com/VedantParanjape/simpPRU.git
cd simpPRU
mkdir build
cd build
cmake ..
make sudo make install
sudo make package
Download the latest debian package from: https://github.com/VedantParanjape/simpPRU/releases/latest Download amd64 package for x86_64 systems and armhf package for arm32v7 systems
sudo dpkg -i simppru-<version_number>-amd64.deb
replace <version_number> with the appropriate version of the downloaded package
- Commit logs for simppru: https://github.com/VedantParanjape/simpPRU/commits?author=VedantParanjape
- Commit logs for docker files: https://github.com/VedantParanjape/simppru-build-dockerfiles/commits?author=VedantParanjape
- Docker image for amd64 on dockerhub: https://hub.docker.com/repository/docker/simppru/amd64-build-image
- Docker image for arm32 on dockerhub: https://hub.docker.com/repository/docker/simppru/arm32-build-image
- simpPRU compiler supports statically typed variables.
- It supports integer and boolean variables.
- It has ability to assign variables during declaration.
- Variables can be redeclared after declaration.
- It supports if-else-elseif loop.
- It supports while loop.
- It supports range based for loop.
- It supports arithmetic operators.
- It supports comparison operators.
- It supports logical operators.
- It supports unary operators.
- It supports functions, with return types int, bool and void.
- It supports control statements like break and continue.
- It fully supports expressions (arithmetic and logical).
- It can load binary into /lib/firmware according to selected PRU.
- It can autoset pin-mux using config-pin, by extracting the pins used in the code.
- It autodetects Beagle Board model and manages the pin-mux settings, this doesn't work in BB AI.
- Provides pin numbers as constant variables, like if P1_31 points to PRU R30 register bit 12, then one can use P1_31 and 12 interchangeably.
- simpPRU-console is a console GUI application, it can start/stop the PRU's, and also send/receive integers to the PRU using RPMSG, It displays the received messages in a serial monitor like fashion.
- It autodetects Beagle Board model and accordingly updates the number of PRU's.
- Created docker files for building simppru for armhf and amd64 systems.
- Setup CI/CD using Github actions, on every push/pull request simpPRU is built for arm32 and amd64 arch on github actions using docker images.
- New debian packages are released upon sending a POST request to a web-hook. Clean docker images are pulled and generated debian package is pushed to github artifacts, after which a github action releases those packages.
Commit logs: https://github.com/dinuxbg/gnuprumcu/commits?author=VedantParanjape
- Added PRU I/O register definitions for AM572x processors.
- Updated Register definitions of AM335x according to the Technical Reference Manual Revision 3.
- Fixed minor mistakes in AM335x Register definitions.
Commit logs: https://github.com/ArthurSonzogni/FTXUI/commits?author=VedantParanjape
- Added on_enter method to toggle component.
- Added tests for OnEnter event in toggle component.
-
For detailed docs, visit: https://simppru.readthedocs.io/en/latest/
-
For progress log, visit: https://ve0x10.in/gsoc2020/