Weekly Progress Report Thread: PRU Improvements

Hello,

This is Week 0 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Fixed issue #44 on am335x_pru_package repository
  • Completed Exploring BeagleBone book
  • Completed this short course on flex+bison
  • Completed reading PRU Assembly reference guide
  • Completed reading TI C/C++ reference guide
  • Implemented a lexer for a toy language using flex

Resolutions to blockers:
N/A

On-going blockers:

  • Currently, Bison is not clear to me, currently going through books and youtube videos.

Plans for the next week:
Hopefully I will receive the hardware by tonight (2nd June 2020). If that will be the case, I am sticking to my original timeline. According to that I will try to accomplish these things June 8th (#Milestone 1):

  • Introductory YouTube video
  • Setting up BeagleBone Black Wireless i.e flashing up to date Linux image and Testing user-led blink code :smiley:
  • Running existing example codes from this repository
  • Implementing int, bool data types
  • Implementing Arithmetic operators
  • Implementing Relational operators

If somehow I didn’t get the hardware in time I will try to accomplish these things by June 8th (#Milestone 1):

  • Introductory YouTube video.
  • Implementing int, bool data types
  • Implementing Arithmetic operators
  • Implementing Relational operators

Hello,

This is Week 1 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Implemented lexer using flex, parses variable assignment, and arithmetic and comparison expressions.

  • Implemented parser using Bison for variable assignment and arithmetic expression evaluation.

  • Completed implementation of relational operators.

  • Completed implementation of relational expressions.

  • Completed implementation of logical operators.

  • Completed implementation of logical expressions.

  • Fixed issue with handling of multi term arithmetic, boolean, relational and logical expressions with support for brackets.

  • Completed introductory youtube video.

Resolutions to blockers:
N/A

On-going blockers:

  • Currently, How to use a LLVM Backend is not clear me.
  • Unable to find a context free grammer for If elseif else blocks.

Plans for the next week:

I am ahead of my schedule and could complete week 2 tasks in week 1 itself. I will try to accomplish these things June 15th (#Milestone 2), even though they are tasks for week 3:

  • Implementing if else elif
  • Implementing for loop
  • Implementing functions
  • Implementing Register access

Hello,

This is Week 2 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Added For loop.
  • Added While loop.
  • Added support for blank statements.
  • Implemented Symbol table, and tested it.
  • Integrated Symbol table with lexer.
  • Completely integrated Symbol Table with parser, stores and retrieves stored variables.

Resolutions to blockers:

N/A

On-going blockers:

  • None

Plans for the next week:

I am ahead of my schedule and could complete week 3 tasks in week 2 itself. I will try to accomplish these things June 22nd (#Milestone 3), even though they are tasks for week 4:

  • Implementing functions
  • Implementing register access
  • Implementing LLVM Backend for PRU

Hello,

This is Week 3 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Fixed issue of scope management, symbol table works flawlessly hides variables according to scope.
  • Added functions declaration in parser
  • Added function calls
  • Completed function calls, can be used in expressions also.
  • Added break and continue statements
  • Implemented Abstract syntax tree structure for this language
  • Added functionality to use expression in ranges used in for loop

Resolutions to blockers:

N/A

On-going blockers:

  • None

Plans for the next week:

I will try to accomplish these things June 29th (#Milestone 4):

  • Implement code converter to generate PRU C code from AST
  • Implement wrapper functions to access registers
  • Implement helper functions to ease usage of IO on PRU pins, and timers

Hello,

This is Week 4 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Integrated AST with the parser.
  • Completed and integrated semantic checker on paramters for function calls
  • Added semantic checker for return statements and return types in functions
  • Compiled GCC toolchain for PRU to run on arm and x86 arch.
  • Added code printer for declarations and assignment statement.
  • Added code printer for expression eval and function calls, Compiler now generates PRU binary

Resolutions to blockers:

N/A

On-going blockers:

  • None

Plans for the next week:

I will try to accomplish these things July 7th (#Milestone 5):

  • Implementing Language backend for for loop and if elif else
  • Implementing Language backend for functions and register access
  • Testing the language, and implementing example codes.

Hello,

This is Week 5 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Added digital_write, digital_read and delay in frontend, and implemented code generation for the same.

  • Implemented code generation for compound statements and while statement.

  • Implemented code generation for for-loop

  • Implemented code generation for function definition, register access and if-elif-else loop

  • Added pwm, read_counter, start_counter, stop_counter functions, to generate PWM, and read hardware counter.

  • Implemented LED blink example using hardware counter.

  • Implemented LED blink example using for loop.

  • Implemented hcsr04 example, and tested it on PRU.

  • Added functionality such that PRU pins are autoset to their appropriate during compilation using config-pin

  • Added header pin names as constants in symbol table, so now header pin names can be directly used.

Resolutions to blockers:

N/A

On-going blockers:

  • None

Plans for the next week:

I will try to accomplish these things July 10th (#Milestone 5):

  • Documenting code syntax

  • Restructuring code

  • Adding PRU pin mappings to Header pin mappings, for BBB and BBB wireless.

  • Implementing RPMSG functionality, on the lines of something like serial_read and serial_write.

  • Writing a loader program to load firmware onto PRU using remoteproc.

Hello,

This is Week 6 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Tested RPMSG codes to implement it on simpPRU

  • Added mkdocs documentation generator.

  • Setup docs on readthedocs.io, automated docs generation using github hooks. https://simppru.readthedocs.io/en/latest/

  • Fixed bugs in simpPRU through testing, check commit log for details.

  • Added language reference in docs.

  • Added circuit schematics to be used in Example codes.

  • Generated pin mappings for Beaglebone black and Beaglebone black wireless.

Resolutions to blockers:

N/A

On-going blockers:

  • Implementing RPMSG functionality
  • Unable to find a way to use PWMSS subsystem from PRU code.

Plans for the next week:

I will try to accomplish these things July 10th (#Milestone 5):

  • Completing docs with examples tested on both hardwares.

  • Add functionality to check beagleboard variant and accordingly load PRU->header pin mappings.

  • Writing a loader program to load firmware onto PRU using remoteproc.

Hi,

Since you are defining a new language, you may consider creating a small automated regression test. I’m not a mentor, so treat this as a suggestion for a “nice to have” feature.

I see you are generating C code, which you compile with pru-gcc. In such case you could either:

  1. Write stub host function, and build your generated C code using the host C compiler.
    Or:
  2. Simulate your PRU ELF executable with pru-sim. For project example see https://github.com/dinuxbg/pru-gcc-examples/tree/master/sim-hello

Typically you would have a test case for each feature of your language. Example for multiplication and if statement:

int A := 5;
int B := 10;
if ((A * B) != 50) {
abort();
}
return 0;

Then you build, simulate or run, and ensure the program finishes with exit status SUCCESS (zero).

Regards,
Dimitar

Hi,
I am not much experienced in writing unit tests. Could you elaborate on what you mean by stub function. From how much I could understand, I have to write basic codes for every subset which will verify that the given feature works correctly.
How would i simulate the binary generated by pru-gcc ?

Regards,
Vedant

Hello,

This is Week 7 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Wrote rpmsg wrapper functions and tested the same on PRU
  • Added headers necessary to use rpmsg and ecap pwm
  • Added rpmsg support to language, completed code printer for the same.
  • Wrote pru_ecap.h with complete bit fields referring to the TRM, wrote code for running PWM using eCap, it worked.
  • Wrote docs for rpmsg, and implemented examples for the same.

Resolutions to blockers:

  • Solved RPMSG blocker, read examples and pru_rpmsg.h source code to clear my doubts.

On-going blockers:

  • Unable to find a way to use ECAP subsystem to generate PWM signals, I worked once, after that I am unable to make it work again.

Plans for the next week:

I will try to accomplish these things July 26th (#Milestone 7):

  • Completing docs with examples tested on both hardwares.

  • Add functionality to check beagleboard variant and accordingly load PRU->header pin mappings.

  • Writing a loader program to load firmware onto PRU using remoteproc.

  • Writing a console app to communicate with PRU through rpmsg, much like a wrapper functions around /dev/rpmsg_pru3x interface

  • Package the app into a debian package (.deb) for distribution

If you choose to compile your code using the host toolchain then you will need to take care of the PRU-specific functions. Your generated code would attempt to call write_30. In such case you could provide a “stub function” to satisfy the linker:

static int verbose;
void write_r30(uint32_t val)
{
if (verbose)
printf(“Writing R30: %08x\n”, val);
}

I already pointed you to the sim-hello example for compiling PRU C code and simulating it using pru-sim.

Hey,
Okay, it is clear. I will surely add this functionaliy.

Regards,
Vedant Paranjape

Hello,

This is Week 8 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Added functionality such that compiler autodetects board version and uses appropriate header-PRU pin mappings
  • Implemented commandline options using argp and created Makefile to compile the project
  • Initially used autotools as a build system, due to steep learning curve shifted to CMake
  • Setup CI pipeline on Github, published docker images used to build releases for amd64 and arm32v7
  • Released simppru-1.0, added github releases.
  • Tested it on Beaglebone black wireless

Resolutions to blockers:

  • Will post on e2e forum to seek help for eCAP PWM issue.

On-going blockers:

  • Unable to find a way to use ECAP subsystem to generate PWM signals, I worked once, after that I am unable to make it work again.

Plans for the next week:

I will try to accomplish these things August 3rd:

  • Completing docs with examples tested on both hardwares.
  • Writing a loader program to load firmware onto PRU using remoteproc.
  • Writing a console app to communicate with PRU through rpmsg, much like a wrapper functions around /dev/rpmsg_pru3x interface.
  • Creating pru-gcc debian packages for amd64 arch, and setting up ppa for simppru

Hello,

This is Week 9 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Added --load argument to copy firmware into /lib/firmware.

  • Fixed issue with arm32 debian package, it was packaged with amd64 binary.

  • Separated package build action, such that arm32 and amd64 build steps run in separate environments.

  • Completed UI skeleton design of simppru-console.

  • Added support for BBB to load firmware.

Resolutions to blockers:

  • Will post on e2e forum to seek help for eCAP PWM issue.

On-going blockers:

  • Unable to find a way to use ECAP subsystem to generate PWM signals, I worked once, after that I am unable to make it work again.

Plans for the next week:

I will try to accomplish these things August 10th:

  • Completing docs with examples tested on both hardwares.
  • Writing a console app to communicate with PRU through rpmsg, much like a wrapper functions around /dev/rpmsg_pru3x interface.

Hello,

This is Week 10 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Completed simppru-console code.
  • Fixed issues due to which hot-reloading of PRU cores was not possible in simppru-console.
  • Fixed issues created by Dr. Mark.
  • Tested simppru-console, and released v1.2 with simppru-console.

Resolutions to blockers:

  • Will post on e2e forum to seek help for eCAP PWM issue.

On-going blockers:

  • Unable to find a way to use ECAP subsystem to generate PWM signals, I worked once, after that I am unable to make it work again.

Plans for the next week:

I will try to accomplish these things August 10th:

  • Completing docs with examples tested on both hardwares.
  • Adding support for BBAI

Hello,

This is Week 11 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Completed docs for simppru and simppru-console.
  • Added build and install instructions in readthedocs.
  • Added pin mappings for BB AI.
  • Released v1.2 of simppru

Resolutions to blockers:

  • Will post on e2e forum to seek help for eCAP PWM issue.

On-going blockers:

  • Unable to find a way to use ECAP subsystem to generate PWM signals, I worked once, after that I am unable to make it work again.

Plans for the next week:

I will try to accomplish these things August 24th:

  • Adding support for BB AI.
  • Adding unit tests for simppru.
  • Releasing pru-gcc for amd64.

Hello,

This is Week 12 report for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments:

  • Added support for BeagleBone AI
  • Updated RPMSG headers so as to support BBAI’s 4 PRU’s.
  • Added support for BB AI in simppru-console.
  • Fixed several bugs
  • Released v1.3, with BBAI support.

Resolutions to blockers:

  • N/A

On-going blockers:

  • Unable to find a way to use ECAP subsystem to generate PWM signals, I worked once, after that I am unable to make it work again.

Plans for the next week:
I will try to get simppru debian packages into RCN-EE’s repository.

Hello,

This is final update for my GSoC2020 project PRU Improvements, my mentors are Kumar Abhishek, Pratim Ugale and Andrew Henderson. I will report my weekly progress through this thread,

I have also created a github page for tracking my daily progress and to document sources used to learn about tools used, you can check my blog at this link: https://ve0x10.me/gsoc2020/

Accomplishments throughout the project:
The following major features have been implemented by me:

  • 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
  • simpPRU compiler supports statically typed variables.
  • It supports integer and Boolean variables.
  • It has ability to assign variables during declaration.
  • Variables can be re-declared 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 auto set pin-mux using config-pin, by extracting the pins used in the code.
  • It auto detects 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.
  • It has native support for PRU-ICSS peripherals, namely GPO and GPI control using R30/R31 registers, Delay function, IEP’s hardware counter, and RPMSG API to communicate with ARM core.
    simpPRU-console
  • 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 auto detects Beagle Board model and accordingly updates the number of PRU’s.
    CI/CD for simppru debian package
  • 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.
    Other than that, I also contributed to two open source tools that made this project possible

pru-gcc

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

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

It has been a really amazing experience for me. I have learned so much in these 15 weeks, which will surely help me achieve my future goals in life. I would like to thank beagleboard.org and Google for giving me such an amazing opportunity. I would also like to thanks my mentors Abhishek, Pratim and Andrew for helping me out and supporting me through out the project, also all the other mentors and organization admin, namely Cathleen, Jason and Saketh who supported me throughout the period, and making sure that I received all the required hardware on time.

Last but not the least, I would like to thank all my peers, namely Deepankar, Deepak and Niklas for helping me out with issues.

Final Video: https://www.youtube.com/watch?v=MeRsCG6O_vw

Project wiki: https://github.com/VedantParanjape/simpPRU/wiki