BeagleBoard/GSoC/2022 Proposal/Adding features to simpPRU

< BeagleBoard‎ | GSoC
Revision as of 04:35, 27 June 2022 by Krishna Narayanan (talk | contribs) (Timeline)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Proposal for Adding Features to simpPRU


  • Pre-application phase


  • Completed all the prerequisites
  • Completed "Hello World" of cross-compilation mentioned in the requirements list.
  • Created a PR for the task #159

About You

  • IRC:Krishna Narayanan (
  • Github:
  • College: Veermata Jijabai Technological Institute (VJTI)
  • Country: India
  • Primary language: English, Hindi, Tamil
  • Typical work hours: 9 AM - 7 PM Indian Standard Time
  • Experience :
  • BluetoothJoystickis the project I had worked on which aimed to make a joystick with the help of ESP-32 microcontroller using the Bluetooth connectivity.This is where I got the experience and exposure to embedded environment.
  • Micromouseis the project which we had designed a bot from scratch,in which we had used a left hand algorithm for solving the maze in the shortest time.
  • I have been contributing and referring to open source actively,I have been contributing to gcc and have submitted patches for test cases and fixes#PR99209,#93432.
  • I got a special mention for this competition Micromouse Challenge, coming in the top 5 positions in the International Micromouse Challenge hosted by Techfest IIT,Bombay.
  • My areas of interest are compiler development,Robotics,Embedded Systems in specific.
  • I am familiar with working in Linux environment and git.
  • I am actively involved in the robotics club of my institute Society of Robotics and Automation SRA as a core member.
  • I am participating in GSoC for the first time.

About Your Project

  • Project name: simpPRU


simpPRU is a procedural programming language. It is a statically typed language. Variables and functions must be assigned data types during compilation. It is type safe, and data types of variables are decided during compilation.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.

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 it keeps many creative developers away. So, I propose to implement a easy to understand language for the PRU, hiding away all the low level stuff and providing a clean interface to program PRU.

This can be achieved by implementing a language on top of PRU C. It will directly compile down to PRU C. This could also be solved by implementing a bytecode engine on the PRU, but this will result in waste of already limited resources on PRU. With this approach, both PRU cores can be run independent of each other. simpPRU is a procedural programming language which simplifies this process to a great extent. Since it has a syntax quite similar to python, it is easier to code in simpPRU. It emits code in C, which is then compiled into binary using pru-gcc. So, it is as good as writing code in PRU C in terms of efficiency and functionality and far less in complexity.SimpPRU has already been given a programming level experience,adding more features to it will make it more user-friendly,compatible and programming for PRU's would'nt be such a complex task.

  • Goal: Adding features to simpPRU aims to provide more features and functionalities to make the programming for PRU's more vibrant and increase its usage across various domains.

Implementation Details

  • The will be added to the Github Actions..
  • I will be adding the ON/OFF button to indicate the state of PRU,as mentioned in an issue.I will be referring to the FTUXI by Arthur to accomplish this task.
 std::vector<std::string> toggle_entry = {
  • I am planning to add the compiler flags O2 ,O3 to the required gcc-pru compilation which would greatly impact the efficiency and usage.I would be making the required change in the main.c to add the compiler flags.The main motive here is to benchmark the results of the optimization flags added.
  • I will be adding the Bitwise operator
int a := 5;
int b := 2;
c := a^b;
/*This would yield 
  • I will be adding assignment operators +=,-= for enhancement of arithmetic operations.
int a := 5;
int b := 10;
/*This would yield 
int a := 5;
int b := 10;
/*This would yield 
  • I will be adding assignment operators *=,/=,%= for enhancement of arithmetic operations.
int a := 5;
int b := 10;
/*This would yield 
  • I will be making the required changes for which simpPRU will have the ability to directly call C functions.Foreign functions are to be used for this part.
int a := 5;
int b := 10;
int c;
c:= Add(a,b);
/*This would yield 
int a,b,c;
int Add(int a,int b)
return c;
int Add(int a,int b);
  • Documentation is a must to portray the work which has been done till now,there are some explanations yet to be covered in the docs which I will be completing.
  • I am planning for error handling in some test cases due to invalid input or erroneous outputs and changing grammar for validation of return statements to be called anywhere in the function.
  • Try to implement return anywhere inside function,apply changes in grammar.

def func: int: int a {

   if: a < 22 {
       return 1;
   } else {
       return 0;


Earlier, this had to be written as:

def func: int: int a {

   int b;
   if: a < 22 {
       b := 1;
   } else {
       b := 0;
   return b;


  • I will be writing a research paper under the guidance of my mentors Vedant Paranjape, Abhishek, Archisman to document the benchmark results of simpPRU.
  • I will try to port the code to librobotcontrol that performs balancing on a 2-wheel robot using a lag-lead controller and moving the control loop over to the PRUs using simpPRU in the given timeframe,yet if it exceeds the time limit I will complete it in post GSoC period and continue to solve issues in cooperation with the project mentors.


Date Status Details
Submission Of Proposal
  • Interaction with mentors
  • Getting accustomed to code base
  • Referring PRU Cookbook and related sources
  • Trying out the simpPRU console and its present features
May 20th - June 12th Community Bonding
  • There are university exams during this period followed by lab,vivas.
  • I would be catching up with the community,getting familiar with work culture
  • Discussion on resources and tools relevant to the project
  • Getting all doubts cleared regarding the project,get accustomed to the simpPRU console
June 13th Milestone #1
  • Introductory Video
  • Going through the documentation of simpPRU
  • Adding to Github actions
June 20th Milestone #2
  • Adding the ON/OFF feature for the simppru console
  • Testing the feature on console
June 27th Milestone #3
  • Add ^ operator for bitwise operation
  • Adding assignment operators +=,-=
  • Writing testcases and documentation for it
  • Testing the features and fix the bugs if any
July 4th Milestone #4
  • Adding bitwise assignment operators
  • Writing testcases and documentation for it
  • Additional operators for operations
  • Testing the features and fix the bugs if any
July 11th Milestone #5
  • Work on adding the compiler flags -O2,O3 for the generated C code
  • Would also try the -Wall,-Wextra for the required case
  • Document the outcomes
July 18th Milestone #6
  • Benchmarking the results of simpPRU and original PRU-C
  • Ring testing for the latency check
  • Suggestion by mentors regarding the features and addons
July 25th Milestone #7
  • Improve the error handling in bison parser
  • Including column number for syntax error
  • Improve diagnostic for the error messages in parser
  • Testcases for checking feature
August 1st Milestone #8
  • Support for return statements in function block
  • Testcases for the feature
  • Buffer time to fix bugs if any
August 8th Milestone #9
  • Writing the research paper on simpPRU
    • Abstract
    • Methodology used
    • Implementation done
    • Conclusions
  • Benchmarks of the tests and proficiency of simpPRU over others
August 15th Milestone #10
  • Calling C directly from simpPRU(foreign functions).
  • Testing this feature and fix bugs if any
August 22nd Milestone #11
  • Add additional testcases for the debugging
  • Documentation for work done till now
  • Suggestion from mentors and required changes
August 29th Milestone #12
  • Submit final work product and final mentor evaluation
  • Complete YouTube video
Sep. 5th Milestone #13
  • Completion of GSoC

Experience and approach

This project requires good knowledge and background of compiler development.

  • I have been exploring the compiler developer environment for quite some time,having good knowledge about the compilers.
  • I am familiar with regression testing,changing diagnostics messages,adding test cases and enabling compiler flags in the required condition with respect to the warning or error expected.
  • I have been contributing to open source actively in the compiler development adding test cases for bug fixes and regression testing that to avoid regressions or failure of any other passing test

  • I have had experience with an esp-32 microcontroller in my project and now I am into compiler development which is a perfect blend of hardware and software which is now the requirement of this project.
  • I already have the beaglebone(pocket beagle) and have tried using the simpPRU console and getting accustomed to it.
  • I am an open source enthusiast,passionate about technologies and have always dedicated myself to the work I do with utmost perfection.I have no major commitment other than GSoC during the summer break and would give the best of my potential to complete the project idea in the given timeframe.
  • I plan to keep working with simpPRU even after GSoC and also engage with the community often.


I have prepared a docs for all the links I have referred during my preparation phase and if I get stuck up anywhere I would be relying on these.Moreover the beagleboard community is extremely helpful and active in resolving doubts which makes it a great going for the project resources and clarification.


  • Adding these additional features to the project would make it more compatible and user-friendly.
  • The research paper which I would be writing would cover all the topics,the detailed concepts implemented in simpPRU.
  • This project will make simpPRU more complete and robust, which will help with beginners learning to use the PRU or experienced users prototyping something on the PRU.


"simpPRU will simplify programming the PRU, and probably make it easy even for a kid to program the PRU, which is a big plus point of this project."

- Vedant Paranjape (@vedant16)


Cross-compilation task,sent a PR to the upstream: #159