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

From eLinux.org
Jump to: navigation, search
(About Your Project)
(Timeline)
 
(47 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
* Student: [https://elinux.org/User:Krishna_Narayanan Krishna Narayanan]
 
* Student: [https://elinux.org/User:Krishna_Narayanan Krishna Narayanan]
* Mentors: Vedant Paranjape, Abhishek, Archisman
+
* Mentors: Vedant Paranjape,Archisman Dey,Pratim Ugale
 
* Code: https://github.com/VedantParanjape/simpPRU/
 
* Code: https://github.com/VedantParanjape/simpPRU/
 
* Proposal : https://elinux.org/index.php?title=BeagleBoard/GSoC/2022_Proposal/Adding_features_to_simpPRU
 
* Proposal : https://elinux.org/index.php?title=BeagleBoard/GSoC/2022_Proposal/Adding_features_to_simpPRU
Line 23: Line 23:
 
* Country: India
 
* Country: India
 
* Primary language: English, Hindi, Tamil
 
* Primary language: English, Hindi, Tamil
* Typical work hours: 10 AM - 7 PM Indian Standard Time
+
* Typical work hours: 9 AM - 7 PM Indian Standard Time
 
* Experience :  
 
* Experience :  
 
* [https://github.com/Krishna-13-cyber/BluetoothJoystick BluetoothJoystick]is 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.
 
* [https://github.com/Krishna-13-cyber/BluetoothJoystick BluetoothJoystick]is 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.
Line 30: Line 30:
 
* I got a special mention for this competition [https://techfest.org/competitions/micromouse Micromouse Challenge], coming in the top 5 positions in the International Micromouse Challenge hosted by Techfest IIT,Bombay.
 
* I got a special mention for this competition [https://techfest.org/competitions/micromouse 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.
 
* 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 [https://www.sravjti.in/ Society of Robotics and Automation SRA] as a core member.  
 
* I am actively involved in the robotics club of my institute [https://www.sravjti.in/ Society of Robotics and Automation SRA] as a core member.  
 
* I am participating in GSoC for the first time.
 
* I am participating in GSoC for the first time.
Line 51: Line 52:
 
* The test.py will be added to the Github Actions..
 
* 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.
 
* 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.
* 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.
+
  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 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;
 +
println(c);
 +
/*This would yield
 +
7
 +
*/
 +
 
 
* I will be adding assignment operators +=,-= for enhancement of arithmetic operations.
 
* I will be adding assignment operators +=,-= for enhancement of arithmetic operations.
* I will be adding support for PWM using the eCAP Module for analog_write() and analog_read() functions.
+
int a := 5;
 +
int b := 10;
 +
a+=b;
 +
b+=a;
 +
println(a);
 +
print(b);
 +
/*This would yield
 +
15
 +
25
 +
*/
 +
 
 +
int a := 5;
 +
int b := 10;
 +
b-=a;
 +
println(a);
 +
/*This would yield
 +
5
 +
*/
 +
* I will be adding assignment operators *=,/=,%= for enhancement of arithmetic operations.
 +
int a := 5;
 +
int b := 10;
 +
a*=b;
 +
a/=b;
 +
println(a);
 +
print(b);
 +
/*This would yield
 +
50
 +
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.
 
* 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.
 
* 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.
 
* 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 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.
 
* 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.
Line 68: Line 154:
 
|-
 
|-
 
| Submission Of Proposal || ||
 
| 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
 
|
 
|
 
|-
 
|-
Line 85: Line 174:
 
| June 20th || Milestone #2 ||  
 
| June 20th || Milestone #2 ||  
 
* Adding the ON/OFF feature for the simppru console
 
* Adding the ON/OFF feature for the simppru console
* Writing testcases for bitwise operator and the above feature
+
* Testing the feature on console
* Testing the features and fix the bugs if any
 
 
|-
 
|-
 
| June 27th || Milestone #3 ||  
 
| June 27th || Milestone #3 ||  
 +
* Add ^ operator for bitwise operation
 
* Adding assignment operators +=,-=
 
* Adding assignment operators +=,-=
 
* Writing testcases and documentation for it
 
* Writing testcases and documentation for it
 +
* Testing the features and fix the bugs if any
 
|-
 
|-
 
| July 4th || Milestone #4 ||  
 
| July 4th || Milestone #4 ||  
* support for using PWM using eCAP module:analog_write() and analog_read() functions
+
* Adding bitwise assignment operators
* Improve the error handling in bison parser
+
* Writing testcases and documentation for it
* Improve diagnostic for the error messages in parser
+
* Additional operators for operations
 +
* Testing the features and fix the bugs if any
 
|-
 
|-
 
| July 11th || Milestone #5 ||
 
| July 11th || Milestone #5 ||
* Work on adding the compiler flags -O2,O3 for the generated C code.
+
* Work on adding the compiler flags -O2,O3 for the generated C code
 
* Would also try the -Wall,-Wextra for the required case
 
* Would also try the -Wall,-Wextra for the required case
* Syntax error improvisation in parser.
+
* Document the outcomes
 
|-
 
|-
 
| July 18th || Milestone #6 ||  
 
| July 18th || Milestone #6 ||  
* Support for return statements in function block
+
* Benchmarking the results of simpPRU and original PRU-C
* Buffer time to fix bugs if any
+
* Ring testing for the latency check
 +
* Suggestion by mentors regarding the features and addons
 
|-
 
|-
 
| July 25th || Milestone #7 ||  
 
| July 25th || Milestone #7 ||  
* Calling C directly from simpPRU(foreign functions).
+
* Improve the error handling in bison parser
* Testing this feature and fix bugs if any
+
* Including column number for syntax error
 +
* Improve diagnostic for the error messages in parser
 +
* Testcases for checking feature
 
|-
 
|-
 
| August 1st || Milestone #8 ||  
 
| 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
 
* Writing the research paper on simpPRU
 +
** Abstract
 +
** Methodology used
 +
** Implementation done
 +
** Conclusions
 
* Benchmarks of the tests and proficiency of simpPRU over others
 
* Benchmarks of the tests and proficiency of simpPRU over others
 
|-
 
|-
 
| August 15th || Milestone #10 ||  
 
| August 15th || Milestone #10 ||  
* Benchmarking the results of simpPRU and original PRU-C
+
* Calling C directly from simpPRU(foreign functions).
* Suggestion by mentors regarding the features and addons
+
* Testing this feature and fix bugs if any
 
|-
 
|-
| August 22nd || Milestone #10 ||  
+
| August 22nd || Milestone #11 ||
 
* Add additional testcases for the debugging
 
* Add additional testcases for the debugging
 
* Documentation for work done till now
 
* Documentation for work done till now
 
* Suggestion from mentors and required changes
 
* Suggestion from mentors and required changes
 
|-
 
|-
| August 29th || Milestone #11 ||  
+
| August 29th || Milestone #12 ||  
 
* Submit final work product and final mentor evaluation
 
* Submit final work product and final mentor evaluation
 
* Complete YouTube video
 
* Complete YouTube video
 
|-
 
|-
| Sep. 5th || Milestone #12 ||  
+
| Sep. 5th || Milestone #13 ||  
 
* Completion of GSoC
 
* Completion of GSoC
 
|}
 
|}
Line 142: Line 245:
 
*I already have the beaglebone(pocket beagle) and have tried using the simpPRU console and getting accustomed to it.
 
*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 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===
 
===Contingency===
Line 149: Line 253:
 
===Benefit===
 
===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.
+
*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==
 
==Quotes==
Line 159: Line 265:
  
 
Cross-compilation task,sent a PR to the upstream: [https://github.com/jadonk/gsoc-application/pull/159 #159]
 
Cross-compilation task,sent a PR to the upstream: [https://github.com/jadonk/gsoc-application/pull/159 #159]
 +
 +
[[Category: GSoCProposal2022]]

Latest revision as of 05:35, 27 June 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: 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

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 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;
println(c);
/*This would yield 
7
*/
  • I will be adding assignment operators +=,-= for enhancement of arithmetic operations.
int a := 5;
int b := 10;
a+=b;
b+=a;
println(a);
print(b);
/*This would yield 
15
25
*/
int a := 5;
int b := 10;
b-=a;
println(a);
/*This would yield 
5
*/
  • I will be adding assignment operators *=,/=,%= for enhancement of arithmetic operations.
int a := 5;
int b := 10;
a*=b;
a/=b;
println(a);
print(b);
/*This would yield 
50
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
  • 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 test.py 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

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