Make with Ada

Programming Competition   June 20 - September 30, 2016

IoT Networking Stack for the NXP FRDM-K64F board

This project is about developing an IoT networking stack in Ada 2012 for the NXP FRDM-K64F board. Software for the following connectivity peripherals of this board will be developed: - Wired Ethernet port - RF (wireless) transceiver (add-on board)

For Ethernet connectivity, a zero-copy UDP/IP stack will be developed, from the Ethernet device driver to the UDP application interface. The UDP/IP stack will enable a FRDM-K64F to communicate with any host in the Internet. On top of this networking stack the "Constrained Application Protocol" (CoAP) will be implemented.

For RF connectivity, an RF communication stack will be developed. The RF stack will enable two FRDM-K64F boards communicate wirelessly over RF.

The IoT networking stack will be architected in three layers: - Layer 3: Device-independent layer. This layer will contain the platform- independent components of the UDP/IP/CoAP stack. Layer 3 sits on top of Layer 2 and Layer 1. - Layer 2: Embedded software building blocks layer for the NXP FRDM-K64F. This is an infrastructure layer of reusable software abstractions for embedded software development, that provide a board-independent interface or HAL (hardware abstraction layer). It is meant to be application independent, and thus reusable for any bare-metal software project in Ada 2012 targeted for the FRDM-K64F board. Even further, this layer is designed to be easily portable to different boards that have a Cortex-M-based microcontroller and similar peripherals. Layer 2 sits on top of Layer 1. - Layer 1: Port of the "Small Foot Print Ravenscar" gnat runtime library for the NXP Kinetis K64F microcontroller.

Project Lead German Rivera     Location Austin, United States
Log Updates 4

Project Log

Finished porting the GNAT Ravenscar-SFP runtime library to the Kinetis K64F

I posted the code of the Kinetis K64F port of the GNAT Ravenscar-SFP runtime library in GitHub at [https://github.com/jgrivera67/gnat-runtime-libs-for-kinetis-microcontrollers(]https://github.com/jgrivera67/gnat-runtime-libs-for-kinetis-microcontrollers).

I also posted a test program for the Kinetis K64F port of the GNAT Ravenscar-SFP runtime library in the https://github.com/jgrivera67/make-with-ada GitHub repository, in the frdm_k64f_gnat_runtime_test folder.

Posted Jul 31, 2016 at 10:53

Code Repositories in GitHub

My Make-With-Ada Projects

https://github.com/jgrivera67/make-with-ada

GNAT Ravenscar-SFP Runtime Library Ports for Kinetis MCUs

https://github.com/jgrivera67/gnat-runtime-libs-for-kinetis-microcontrollers

Posted Jul 31, 2016 at 10:58

Project Achievements

Summary of Accomplishments to Date

  • Ported GNAT Ravenscar SFP Runtime library to the FRDM-K64F board.
  • Ported GNAT Ravenscar SFP Runtime library to the Hexiwear board.
  • Written System reset counter facility integrated into the GNAT Runtime library
  • Written a stack trace capture facility to help debug code that use the small foot print or zero foot print flavors of the GNAT Ravenscar Runtime library (which does not provide the GNAT.Traceback package).
  • Written in-memory runtime tracing log facility that is persisten across system resets.
  • Written Ethernet PHY-MDIO and MAC drivers for the Kinetis K64F
  • Written Driver for the Ethernet PHY of the FRDM-K64F board
  • Written Pin Muxer, GPIO and UART drivers for the Kinetis K64F MCU
  • Written full-screen (VT100) serial console and command-line facilities on top of the UART driver.
  • Architected a portable Ada zero-copy dual UDP/IP networking stack for microcontrollers. (See code architecture diagram 1 and diagram 2, and project overview slides).
    Although I ran out of time to complete the implementation before the deadline for Make-with-Ada, I will continue working as outlined in the short-term and long-term future plans sections below.

  • Approximate amount of code written to date:
    Line metrics summed over 79 units
    all lines : 12852
    code lines : 6895
    comment lines : 4254
    end-of-line comments : 42
    comment percentage : 38.53
    blank lines : 1703

    These numbers were gathered with the GNAT metrics tool on the frdmk64fiot_stack project. Around 3000 lines need to be subtracted as they correspond to code generated by the svd2ada tool. However, these numbers do not include code written to port The GNAT Ravenscar SFP runtime library to the target platform.

Short-Term Future Plans

  • Finish implementing layer 2-4 of the UDP/IP networking stack
  • Finish implementing the IoT demo application components
  • Write SPI driver for the Kinetis K64F MCU and RF driver for the RF2400 nordic radio add-on board

Long-Term Future Plans

  • Replace the cellphone as the bluetooth master in the IoT stack dem with the Hexiwear device. To do this, I need to develop the following components:
    1. I2C and accelerometer drivers for the Kinetis K64F MCU
    2. Accelerometer driver on top of the I2C driver
    3. Bluetooth (BLE) software interface from the K64F MCU to the KW40 MCU in the Hexiwear board, using the FSCI message protocol
    4. Hexiwear LCD driver
    5. Hexiwear touch screen driver

Achievement Highlights Related to The Submission Criteria

Open

  • My Project is under the BSD license
  • It's hosted on Github. The project is divided in two repositories:

    1. gnat-runtime-libs-for-kinetis-microcontrollers
      This repository contains ports of the GNAT Ravenscar-SFP Runtime
      Library for the two NXP Kinetis micrcontrollers I used for my two
      *Make with Ada" projects.

    2. make-with-ada
      This repository contains therest of the code I wrote for my two
      Make with Ada projects, on top of the GNAT Ravenscar-SFP Runtime
      Library.

  • I used the GNAT GPL 2016 toolchain - ARM ELF format (hosted on Windows),
    including the GPS IDE. I also used the svd2ada tool to generate Ada code
    from SVD XML files for the Kinetis micrcontrollers I used.

Collaborative

  • I submitted a pull request to the GNAT Embedded Runtimes Project
    (embedded-runtimes GitHub
    repository) to contribute the three ports of the GNAT Ravenscar SFP runtime
    that I made as part of my "Make-with-Ada" project work (see pull request).
  • I helped improve the svd2ada tool by submitted two bugs I found when using
    it.
  • I developed several device drivers for several peripherals for the target boards I used, that can be easily reused. I plan to submit them to the Ada Drivers Library GitHub project.
  • I have structured the Ada code of my project in a way that decouples the
    platform independent portions from the MCU specific and board-specific
    portions (see Source Code Architecture diagrams). This will enable
    others to reuse portions of this code and port it to other platforms.

Dependable

  • Disciplined use of information hiding principles to architect the code to ensure high levels of maintainability and portability, and to avoid code duplication across projects and across platforms. Indeed, there is a lot of code sharing with my other project (see Autonomous Car Framework project).
  • Leveraged extensively the data encapsulation and modularity features of the Ada language such as private types and child units including private child units, and in some cases subunits and nested subprograms.
  • Used gnatdoc comments to document key data structures and subprograms
  • Used Ada 2012 contract-based programming features and assertions extensively
  • Used range-based types extensively to leverage the Ada power to detect
    invalid integer values.
  • Used Ada 2012 aspect constructs wherever possible
  • Used GNAT coding style. I use the -gnaty3abcdefhiklmnoOprstux
    GNAT compiler option to chekc compliance with this standard.
    (I ran out of time to clean style warnings in some files, but
    I intend to have all the code compliant)
  • Used GNAT flags to enable rigorous compile-time checks, such as
    -gnato13 -gnatf -gnatwa -gnatVa -Wall.

Inventive

  • I developed an extension to the GNAT runtime library to provide a
    mechanism to count system resets (see reset_counter.ads and linker script changes). On top of this, I built a facility to provide in-memory runtime logs whose contents persist across resets (see runtime_logs.ads).

  • I developed a stack trace capture facility for non-full flavors
    for the Ravenscar runtime. This facility does not depend on traceback tables (see [stacktracecapture.ads] (https://github.com/jgrivera67/make-with-ada/blob/master/buildingblocks/portable/stacktracecapture.ads)). I used this facility to enhance the diagnostics information captured in the LastChanceHandler routine, by capturing a raw stack trace for the exception that trigger the LastChance_Handler call.
    This combined with reset-persistent runtime logs can be a
    very valuable first-failure-data-capture aid for production code.

Posted Sep 30, 2016 at 08:38

Project Achievements (version 2)

Summary of Accomplishments to Date

  • Ported GNAT Ravenscar SFP Runtime library to the FRDM-K64F board.
  • Ported GNAT Ravenscar SFP Runtime library to the Hexiwear board.
  • Written System reset counter facility integrated into the GNAT Runtime library
  • Written a stack trace capture facility to help debug code that use the small foot print or zero foot print flavors of the GNAT Ravenscar Runtime library (which does not provide the GNAT.Traceback package).
  • Written in-memory runtime tracing log facility that is persisten across system resets.
  • Written Ethernet PHY-MDIO and MAC drivers for the Kinetis K64F
  • Written Driver for the Ethernet PHY of the FRDM-K64F board
  • Written Pin Muxer, GPIO and UART drivers for the Kinetis K64F MCU
  • Written full-screen (VT100) serial console and command-line facilities on top of the UART driver.
  • Architected a portable Ada zero-copy dual UDP/IP networking stack for microcontrollers. (See code architecture diagram 1 and diagram 2, and project overview slides).
    Although I ran out of time to complete the implementation before the deadline for Make-with-Ada, I will continue working as outlined in the short-term and long-term future plans sections below.

  • Approximate amount of code written to date:
    Line metrics summed over 79 units
    all lines : 12852
    code lines : 6895
    comment lines : 4254
    end-of-line comments : 42
    comment percentage : 38.53
    blank lines : 1703

    These numbers were gathered with the GNAT metrics tool on the frdmk64fiot_stack project. Around 3000 lines need to be subtracted as they correspond to code generated by the svd2ada tool. However, these numbers do not include code written to port The GNAT Ravenscar SFP runtime library to the target platform.

Short-Term Future Plans

  • Finish implementing layer 2-4 of the UDP/IP networking stack
  • Finish implementing the IoT demo application components
  • Write SPI driver for the Kinetis K64F MCU and RF driver for the RF2400 nordic radio add-on board
  • Write Memory Protection Unit (MPU) support for the K64F ports of the GNAT Ravenscar Runtime. so, that the the MPU-baed protection can be used to provide memory isolation for the different layers of the networking stack. This can be especially relevant for safety-critical applications

Long-Term Future Plans

  • Replace the cellphone as the bluetooth master in the IoT stack demo with the Hexiwear hand-held device. To do this, I need to develop the following components:
    1. I2C and accelerometer drivers for the Kinetis K64F MCU
    2. Accelerometer driver on top of the I2C driver
    3. Bluetooth (BLE) software interface from the K64F MCU to the KW40 MCU in the Hexiwear board, using the FSCI message protocol
    4. Hexiwear LCD driver
    5. Hexiwear touch screen driver

Achievement Highlights Related to The Submission Criteria

Open

  • My Project is under the BSD license
  • It's hosted on Github. The project is divided in two repositories:

    1. gnat-runtime-libs-for-kinetis-microcontrollers
      This repository contains ports of the GNAT Ravenscar-SFP Runtime
      Library for the two NXP Kinetis micrcontrollers I used for my two
      *Make with Ada" projects.

    2. make-with-ada
      This repository contains therest of the code I wrote for my two
      Make with Ada projects, on top of the GNAT Ravenscar-SFP Runtime
      Library.

  • I used the GNAT GPL 2016 toolchain - ARM ELF format (hosted on Windows),
    including the GPS IDE. I also used the svd2ada tool to generate Ada code
    from SVD XML files for the Kinetis micrcontrollers I used.

Collaborative

  • I submitted a pull request to the GNAT Embedded Runtimes Project
    (embedded-runtimes GitHub
    repository) to contribute the FRDM-K64F and Hexiwear ports of the GNAT Ravenscar SFP runtime that I made (see pull request).
  • I helped improve the svd2ada tool by submitted two bugs I found when using
    it.
  • I developed several device drivers for several peripherals for the target boards I used, that can be easily reused. I plan to submit them to the Ada Drivers Library GitHub project.
  • I have structured the Ada code of my project in a way that decouples the
    platform independent portions from the MCU specific and board-specific
    portions (see Source Code Architecture diagrams: 1, 2, 3).

    This will enable others to reuse portions of this code and port it to other platforms.

Dependable

  • Disciplined use of information hiding principles to architect the code to ensure high levels of maintainability and portability, and to avoid code duplication across projects and across platforms Indeed, there is a lot of code sharing with my other project (see Autonomous Car Framework project).
  • Leveraged extensively the data encapsulation and modularity features of the Ada language such as private types and child units including private child units, and in some cases subunits and nested subprograms.
  • Used gnatdoc comments to document key data structures and subprograms
  • Used Ada 2012 contract-based programming features and assertions extensively
  • Used range-based types extensively to leverage the Ada power to detect
    invalid integer values.
  • Used Ada 2012 aspect constructs wherever possible
  • Used GNAT coding style. I use the -gnaty3abcdefhiklmnoOprstux
    GNAT compiler option to chekc compliance with this standard.
    (I ran out of time to clean style warnings in some files, but
    I intend to have all the code compliant)
  • Used GNAT flags to enable rigorous compile-time checks, such as
    -gnato13 -gnatf -gnatwa -gnatVa -Wall.

Inventive

  • I developed an extension to the GNAT runtime library to provide a
    mechanism to count system resets (see reset_counter.ads and linker script changes). On top of this, I built a facility to provide in-memory runtime logs whose contents persist across resets (see runtime_logs.ads).

  • I developed a stack trace capture facility for non-full flavors
    for the Ravenscar runtime. This facility does not depend on traceback tables (see [stacktracecapture.ads] (https://github.com/jgrivera67/make-with-ada/blob/master/buildingblocks/portable/stacktracecapture.ads)). It uses an innovative stack unwinding algorithm that traverses the call chain backwards, locating the "links" in the call chain by scanning backwards the machine instructions of a subprogram, looking for its prolog code sequence. I used this facility to enhance the diagnostics information captured in the LastChanceHandler routine, by capturing a raw stack trace for the exception that trigger the LastChance_Handler call.
    This combined with reset-persistent runtime logs can be a
    very valuable first-failure-data-capture aid for production code.

Posted Sep 30, 2016 at 10:01

IoT Networking Stack for the NXP FRDM-K64F board

This project is about developing an IoT networking stack in Ada 2012 for the NXP FRDM-K64F board. Software for the following connectivity peripherals of this board will be developed: - Wired Ethernet port - RF (wireless) transceiver (add-on board)

For Ethernet connectivity, a zero-copy UDP/IP stack will be developed, from the Ethernet device driver to the UDP application interface. The UDP/IP stack will enable a FRDM-K64F to communicate with any host in the Internet. On top of this networking stack the "Constrained Application Protocol" (CoAP) will be implemented.

For RF connectivity, an RF communication stack will be developed. The RF stack will enable two FRDM-K64F boards communicate wirelessly over RF.

The IoT networking stack will be architected in three layers: - Layer 3: Device-independent layer. This layer will contain the platform- independent components of the UDP/IP/CoAP stack. Layer 3 sits on top of Layer 2 and Layer 1. - Layer 2: Embedded software building blocks layer for the NXP FRDM-K64F. This is an infrastructure layer of reusable software abstractions for embedded software development, that provide a board-independent interface or HAL (hardware abstraction layer). It is meant to be application independent, and thus reusable for any bare-metal software project in Ada 2012 targeted for the FRDM-K64F board. Even further, this layer is designed to be easily portable to different boards that have a Cortex-M-based microcontroller and similar peripherals. Layer 2 sits on top of Layer 1. - Layer 1: Port of the "Small Foot Print Ravenscar" gnat runtime library for the NXP Kinetis K64F microcontroller.

Project Lead German Rivera     Location Austin, United States
Log Updates 4

Project Log

Finished porting the GNAT Ravenscar-SFP runtime library to the Kinetis K64F

I posted the code of the Kinetis K64F port of the GNAT Ravenscar-SFP runtime library in GitHub at [https://github.com/jgrivera67/gnat-runtime-libs-for-kinetis-microcontrollers(]https://github.com/jgrivera67/gnat-runtime-libs-for-kinetis-microcontrollers).

I also posted a test program for the Kinetis K64F port of the GNAT Ravenscar-SFP runtime library in the https://github.com/jgrivera67/make-with-ada GitHub repository, in the frdm_k64f_gnat_runtime_test folder.

Posted Jul 31, 2016 at 10:53

Code Repositories in GitHub

My Make-With-Ada Projects

https://github.com/jgrivera67/make-with-ada

GNAT Ravenscar-SFP Runtime Library Ports for Kinetis MCUs

https://github.com/jgrivera67/gnat-runtime-libs-for-kinetis-microcontrollers

Posted Jul 31, 2016 at 10:58

Project Achievements

Summary of Accomplishments to Date

  • Ported GNAT Ravenscar SFP Runtime library to the FRDM-K64F board.
  • Ported GNAT Ravenscar SFP Runtime library to the Hexiwear board.
  • Written System reset counter facility integrated into the GNAT Runtime library
  • Written a stack trace capture facility to help debug code that use the small foot print or zero foot print flavors of the GNAT Ravenscar Runtime library (which does not provide the GNAT.Traceback package).
  • Written in-memory runtime tracing log facility that is persisten across system resets.
  • Written Ethernet PHY-MDIO and MAC drivers for the Kinetis K64F
  • Written Driver for the Ethernet PHY of the FRDM-K64F board
  • Written Pin Muxer, GPIO and UART drivers for the Kinetis K64F MCU
  • Written full-screen (VT100) serial console and command-line facilities on top of the UART driver.
  • Architected a portable Ada zero-copy dual UDP/IP networking stack for microcontrollers. (See code architecture diagram 1 and diagram 2, and project overview slides).
    Although I ran out of time to complete the implementation before the deadline for Make-with-Ada, I will continue working as outlined in the short-term and long-term future plans sections below.

  • Approximate amount of code written to date:
    Line metrics summed over 79 units
    all lines : 12852
    code lines : 6895
    comment lines : 4254
    end-of-line comments : 42
    comment percentage : 38.53
    blank lines : 1703

    These numbers were gathered with the GNAT metrics tool on the frdmk64fiot_stack project. Around 3000 lines need to be subtracted as they correspond to code generated by the svd2ada tool. However, these numbers do not include code written to port The GNAT Ravenscar SFP runtime library to the target platform.

Short-Term Future Plans

  • Finish implementing layer 2-4 of the UDP/IP networking stack
  • Finish implementing the IoT demo application components
  • Write SPI driver for the Kinetis K64F MCU and RF driver for the RF2400 nordic radio add-on board

Long-Term Future Plans

  • Replace the cellphone as the bluetooth master in the IoT stack dem with the Hexiwear device. To do this, I need to develop the following components:
    1. I2C and accelerometer drivers for the Kinetis K64F MCU
    2. Accelerometer driver on top of the I2C driver
    3. Bluetooth (BLE) software interface from the K64F MCU to the KW40 MCU in the Hexiwear board, using the FSCI message protocol
    4. Hexiwear LCD driver
    5. Hexiwear touch screen driver

Achievement Highlights Related to The Submission Criteria

Open

  • My Project is under the BSD license
  • It's hosted on Github. The project is divided in two repositories:

    1. gnat-runtime-libs-for-kinetis-microcontrollers
      This repository contains ports of the GNAT Ravenscar-SFP Runtime
      Library for the two NXP Kinetis micrcontrollers I used for my two
      *Make with Ada" projects.

    2. make-with-ada
      This repository contains therest of the code I wrote for my two
      Make with Ada projects, on top of the GNAT Ravenscar-SFP Runtime
      Library.

  • I used the GNAT GPL 2016 toolchain - ARM ELF format (hosted on Windows),
    including the GPS IDE. I also used the svd2ada tool to generate Ada code
    from SVD XML files for the Kinetis micrcontrollers I used.

Collaborative

  • I submitted a pull request to the GNAT Embedded Runtimes Project
    (embedded-runtimes GitHub
    repository) to contribute the three ports of the GNAT Ravenscar SFP runtime
    that I made as part of my "Make-with-Ada" project work (see pull request).
  • I helped improve the svd2ada tool by submitted two bugs I found when using
    it.
  • I developed several device drivers for several peripherals for the target boards I used, that can be easily reused. I plan to submit them to the Ada Drivers Library GitHub project.
  • I have structured the Ada code of my project in a way that decouples the
    platform independent portions from the MCU specific and board-specific
    portions (see Source Code Architecture diagrams). This will enable
    others to reuse portions of this code and port it to other platforms.

Dependable

  • Disciplined use of information hiding principles to architect the code to ensure high levels of maintainability and portability, and to avoid code duplication across projects and across platforms. Indeed, there is a lot of code sharing with my other project (see Autonomous Car Framework project).
  • Leveraged extensively the data encapsulation and modularity features of the Ada language such as private types and child units including private child units, and in some cases subunits and nested subprograms.
  • Used gnatdoc comments to document key data structures and subprograms
  • Used Ada 2012 contract-based programming features and assertions extensively
  • Used range-based types extensively to leverage the Ada power to detect
    invalid integer values.
  • Used Ada 2012 aspect constructs wherever possible
  • Used GNAT coding style. I use the -gnaty3abcdefhiklmnoOprstux
    GNAT compiler option to chekc compliance with this standard.
    (I ran out of time to clean style warnings in some files, but
    I intend to have all the code compliant)
  • Used GNAT flags to enable rigorous compile-time checks, such as
    -gnato13 -gnatf -gnatwa -gnatVa -Wall.

Inventive

  • I developed an extension to the GNAT runtime library to provide a
    mechanism to count system resets (see reset_counter.ads and linker script changes). On top of this, I built a facility to provide in-memory runtime logs whose contents persist across resets (see runtime_logs.ads).

  • I developed a stack trace capture facility for non-full flavors
    for the Ravenscar runtime. This facility does not depend on traceback tables (see [stacktracecapture.ads] (https://github.com/jgrivera67/make-with-ada/blob/master/buildingblocks/portable/stacktracecapture.ads)). I used this facility to enhance the diagnostics information captured in the LastChanceHandler routine, by capturing a raw stack trace for the exception that trigger the LastChance_Handler call.
    This combined with reset-persistent runtime logs can be a
    very valuable first-failure-data-capture aid for production code.

Posted Sep 30, 2016 at 08:38

Project Achievements (version 2)

Summary of Accomplishments to Date

  • Ported GNAT Ravenscar SFP Runtime library to the FRDM-K64F board.
  • Ported GNAT Ravenscar SFP Runtime library to the Hexiwear board.
  • Written System reset counter facility integrated into the GNAT Runtime library
  • Written a stack trace capture facility to help debug code that use the small foot print or zero foot print flavors of the GNAT Ravenscar Runtime library (which does not provide the GNAT.Traceback package).
  • Written in-memory runtime tracing log facility that is persisten across system resets.
  • Written Ethernet PHY-MDIO and MAC drivers for the Kinetis K64F
  • Written Driver for the Ethernet PHY of the FRDM-K64F board
  • Written Pin Muxer, GPIO and UART drivers for the Kinetis K64F MCU
  • Written full-screen (VT100) serial console and command-line facilities on top of the UART driver.
  • Architected a portable Ada zero-copy dual UDP/IP networking stack for microcontrollers. (See code architecture diagram 1 and diagram 2, and project overview slides).
    Although I ran out of time to complete the implementation before the deadline for Make-with-Ada, I will continue working as outlined in the short-term and long-term future plans sections below.

  • Approximate amount of code written to date:
    Line metrics summed over 79 units
    all lines : 12852
    code lines : 6895
    comment lines : 4254
    end-of-line comments : 42
    comment percentage : 38.53
    blank lines : 1703

    These numbers were gathered with the GNAT metrics tool on the frdmk64fiot_stack project. Around 3000 lines need to be subtracted as they correspond to code generated by the svd2ada tool. However, these numbers do not include code written to port The GNAT Ravenscar SFP runtime library to the target platform.

Short-Term Future Plans

  • Finish implementing layer 2-4 of the UDP/IP networking stack
  • Finish implementing the IoT demo application components
  • Write SPI driver for the Kinetis K64F MCU and RF driver for the RF2400 nordic radio add-on board
  • Write Memory Protection Unit (MPU) support for the K64F ports of the GNAT Ravenscar Runtime. so, that the the MPU-baed protection can be used to provide memory isolation for the different layers of the networking stack. This can be especially relevant for safety-critical applications

Long-Term Future Plans

  • Replace the cellphone as the bluetooth master in the IoT stack demo with the Hexiwear hand-held device. To do this, I need to develop the following components:
    1. I2C and accelerometer drivers for the Kinetis K64F MCU
    2. Accelerometer driver on top of the I2C driver
    3. Bluetooth (BLE) software interface from the K64F MCU to the KW40 MCU in the Hexiwear board, using the FSCI message protocol
    4. Hexiwear LCD driver
    5. Hexiwear touch screen driver

Achievement Highlights Related to The Submission Criteria

Open

  • My Project is under the BSD license
  • It's hosted on Github. The project is divided in two repositories:

    1. gnat-runtime-libs-for-kinetis-microcontrollers
      This repository contains ports of the GNAT Ravenscar-SFP Runtime
      Library for the two NXP Kinetis micrcontrollers I used for my two
      *Make with Ada" projects.

    2. make-with-ada
      This repository contains therest of the code I wrote for my two
      Make with Ada projects, on top of the GNAT Ravenscar-SFP Runtime
      Library.

  • I used the GNAT GPL 2016 toolchain - ARM ELF format (hosted on Windows),
    including the GPS IDE. I also used the svd2ada tool to generate Ada code
    from SVD XML files for the Kinetis micrcontrollers I used.

Collaborative

  • I submitted a pull request to the GNAT Embedded Runtimes Project
    (embedded-runtimes GitHub
    repository) to contribute the FRDM-K64F and Hexiwear ports of the GNAT Ravenscar SFP runtime that I made (see pull request).
  • I helped improve the svd2ada tool by submitted two bugs I found when using
    it.
  • I developed several device drivers for several peripherals for the target boards I used, that can be easily reused. I plan to submit them to the Ada Drivers Library GitHub project.
  • I have structured the Ada code of my project in a way that decouples the
    platform independent portions from the MCU specific and board-specific
    portions (see Source Code Architecture diagrams: 1, 2, 3).

    This will enable others to reuse portions of this code and port it to other platforms.

Dependable

  • Disciplined use of information hiding principles to architect the code to ensure high levels of maintainability and portability, and to avoid code duplication across projects and across platforms Indeed, there is a lot of code sharing with my other project (see Autonomous Car Framework project).
  • Leveraged extensively the data encapsulation and modularity features of the Ada language such as private types and child units including private child units, and in some cases subunits and nested subprograms.
  • Used gnatdoc comments to document key data structures and subprograms
  • Used Ada 2012 contract-based programming features and assertions extensively
  • Used range-based types extensively to leverage the Ada power to detect
    invalid integer values.
  • Used Ada 2012 aspect constructs wherever possible
  • Used GNAT coding style. I use the -gnaty3abcdefhiklmnoOprstux
    GNAT compiler option to chekc compliance with this standard.
    (I ran out of time to clean style warnings in some files, but
    I intend to have all the code compliant)
  • Used GNAT flags to enable rigorous compile-time checks, such as
    -gnato13 -gnatf -gnatwa -gnatVa -Wall.

Inventive

  • I developed an extension to the GNAT runtime library to provide a
    mechanism to count system resets (see reset_counter.ads and linker script changes). On top of this, I built a facility to provide in-memory runtime logs whose contents persist across resets (see runtime_logs.ads).

  • I developed a stack trace capture facility for non-full flavors
    for the Ravenscar runtime. This facility does not depend on traceback tables (see [stacktracecapture.ads] (https://github.com/jgrivera67/make-with-ada/blob/master/buildingblocks/portable/stacktracecapture.ads)). It uses an innovative stack unwinding algorithm that traverses the call chain backwards, locating the "links" in the call chain by scanning backwards the machine instructions of a subprogram, looking for its prolog code sequence. I used this facility to enhance the diagnostics information captured in the LastChanceHandler routine, by capturing a raw stack trace for the exception that trigger the LastChance_Handler call.
    This combined with reset-persistent runtime logs can be a
    very valuable first-failure-data-capture aid for production code.

Posted Sep 30, 2016 at 10:01