Difference between revisions of "BeagleBoard/GSoC/2022 Proposal/Adding features to simpPRU"

From eLinux.org
Jump to: navigation, search
(Timeline)
(Implementation Details)
Line 93: Line 93:
 
  5
 
  5
 
  */
 
  */
* I will be adding support for PWM using the eCAP Module for analog_write() and analog_read() functions.
 
 
* 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.
 
* 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.
  

Revision as of 03:38, 6 April 2022

Proposal for Adding Features to simpPRU

Status

  • Pre-application phase

Proposal

  • 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 (@krishna_13:matrix.org)
  • Github:https://github.com/Krishna-13-cyber
  • College: Veermata Jijabai Technological Institute (VJTI)
  • Country: India
  • Primary language: English, Hindi, Tamil
  • Typical work hours: 10 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 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.

I plan to keep working with SimpPRU even after GSoC and also engage with the community often

About Your Project

  • Project name: simpPRU

Description

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 test.py 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 = {
     "ON",
     "OFF",
 };
  • 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 Makefile to add the compiler flags.
  • I will be adding the exponential operator
int a := 5;
int b := 2;
c := a^b;
println(c);
/*This would yield 
25
*/
  • I will be adding float data type.All the arithmetic operations(+,-,*,/) can be performed on these float variables.
float a := 5.8;
float b := 2.4;
float c;
c := a+b;
println(c);
/*This would yield 
8.2
*/
  • I will be adding assignment operators +=,-= for enhancement of arithmetic operations.
int a := 5;
int b := 10;
a+=b;
b+=a;
println(a);
println(b);
/*This would yield 
15
25
*/
int a := 5;
int b := 10;
b-=a;
println(a);
/*This would yield 
5
*/
  • 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.
#include<sum.h>
int a := 5;
int b := 10;
int c;
c:= Add(a,b);
println(c);
/*This would yield 
15
*/
/*sum.c*/
#include<stdio.h>
#include<stdlib.h>
int a,b,c;
int Add(int a,int b)
{
c=a+b;
return c;
}
/*sum.h*/
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.

Timeline

Date Status Details
Submission Of Proposal
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 test.py to Github actions
June 20th Milestone #2
  • Adding the ON/OFF feature for the simppru console
  • Writing testcases for bitwise operator and the above feature
  • Testing the features and fix the bugs if any
June 27th Milestone #3
  • Adding Float data type
  • Adding testcases for testing feature
  • Update Documentation
July 4th Milestone #4
  • Adding assignment operators +=,-=
  • Writing testcases and documentation for it
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
  • Add ^ operator for squaring operation
July 18th Milestone #6
  • Support for return statements in function block
  • Testcases for the feature
  • Buffer time to fix bugs if any
July 25th Milestone #7
  • Calling C directly from simpPRU(foreign functions).
  • Testing this feature and fix bugs if any
August 1st Milestone #8
  • Benchmarking the results of simpPRU and original PRU-C
  • Ring testing for the latency check
  • Suggestion by mentors regarding the features and addons
August 8th Milestone #9
  • support for using PWM using eCAP module:analog_write() and analog_read() functions
  • 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 15th Milestone #10
  • Writing the research paper on simpPRU
  • Benchmarks of the tests and proficiency of simpPRU over others
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

https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591595.html https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590817.html.

  • 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.

Contingency

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.

Benefit

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.

Quotes

"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)

Misc

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