wiki:GSoC/2013/UnifiedAPIs

Version 7 (modified by Vipulnayyar, on 09/24/13 at 20:40:34) (diff)

GSOC 2013 : Unified APIs

Mentors

Joel Sherrill, Chris Johns, Amar Takhar

Student

Vipul Nayyar

Introduction

The broad aim of Unified APIs project is to identify standard patterns of code implementation and file inclusion so that all BSPs follow the one true way in doing work and including proper components for it. To identify this one true way, a specific BSP needs to rise and be recognized as a model for other BSPs. Hence, the arm lpc24xx is a good reference to observe and write down rules for.

Contributed Work during GSOC 2013

  • Submitted patches to remove legacy code from RTEMS bsps which have been accepted & are currently a part of the official RTEMS repository. These patches were submitted for bsps : csb337, csb336, edb7312, gumstix, gba, rtl22xx, & pc386.
  • Since more than about 100 bsps are a part of RTEMS, so guided instructions & rules for continuing this work has been compiled & is present in my github repository.
  • Studied the PIC interrupt model based on the comments written in irq-generic.h & my own observations. Information about PIC Interrupt Model API is added to the current RTEMS documentation.
  • For bsps that do not use the generic interrupt framework , rules to initialize & use it are written and present in the code repository. These rules specify how bsp specific code & the generic code works together & handles Interrupt Service Routines before, during and after an interrupt has occurred.
  • Based on my observations from model bsp lpc24xx , rules were compiled based on an ongoing discussion in the community on how bsp support files are included & compiled. These rules specify which set of files are a must to be used by a bsp & in which directory they all must lie. These rules will in future help in maintaining a unified pattern for BSP file organization.
  • Since the above rules are very difficult to check manually for each bsp, so a bash script was written merging the functionality of check_submission from rtems-testing. This script is supposed to be a final test for any bsp developer before his code is accepted into RTEMS, so as to check whether that the bsp code submitted follows this unified pattern of file organization & formatting or not.

Automated Rule Checking with check_submission

The main objective of the Unified API project is to determine a unified pattern of file usage, directory structure & the methods that each file uses.The checking of above rules is automated with the check_submission script.

Based on the observations from lpc24xx, a list of critical files & methods that every BSP must include and use was compiled. These files & methods belonging to a component for a BSP can be deemed as critical or non-critical. The rule-checking is accomplished by the following way :

#Check if a file is being compiled by searching it's name in the Makefile.am for a BSP. #If file not found, then report it. #Check if the file being compiled is present in the correct directory as defined by the rules. #If location of file is not correct, report it. #Check if the corresponding functions for a file are defined in there or not. This takes place by searching for the definition of a method in that file with the help of a simple regex [a-z|A-Z|0-9|_]+[ ]*$i[ ]*\( #If the function is not located in it's specified file, then search whether it's defined in some other file maybe. Report it #Check whether a required header is being installed by searching it's name in the Makefile.am #Compile a list of all RTEMS internal functions(i.e starting with an '_' ) defined in cpukit & libcpu. #Compile another list of functions starting with an '_' being executed in BSP by searching for a ';' to ensure that function is actually being called.