Skip to content

NVIDIA Jetson Nano LED Linux driver experiment in Ada

Notifications You must be signed in to change notification settings

ohenley/adacore_jetson

Repository files navigation

AdaCore Jetson

NVIDIA Jetson Nano LED Linux driver experiment in Ada

Table of Contents

Click to expand
  1. About
  2. Status
  3. Prerequisites
  4. Dependencies
  5. Building
    1. Linux
  6. Installation
  7. Limitations
  8. Usage
  9. Acknowledgments

About

Linux module experiment written in the Ada programming language.
Targeted at the NVIDIA Jetson-Nano board running Ubuntu 18.04 (aarch64, kernel-based v4.294).
It shows two implementations of a flashing LED interface:

  • First leverages the Linux GPIO interface (include/linux/gpio.h).
  • Second controls by direct read/write to the GPIO memory registers using kernel mapped memory IO interface (include/asm-generic/io.h).

Status

Both flavors of the LED interface implementation are working. Both cross and native build are working.

  • Working : GNAT Pro 23.0w cross toolchain ("toolchain_type" : "cross")
  • Working : Jetson Ubuntu 18.04, GNAT 7.5.0 ("toolchain_type" : "native")

Prerequisites

  • NVIDIA Jetson Nano Developer Kit.
  • Complete led circuit. Bill of Material, eg. https://www.sparkfun.com/
    • 1x resistor kit: COM-10969
    • 1x LED: COM-11372
    • 1x BC337 transistor: COM-13689
    • 1x breadboard: PRT-12615
    • 1x jumper wires kit: PRT-09140
+5V o----------jumper wire-----------o
                                     |
                                    .-.
                                    | | 560
                                    '-'
                                     |
                                     |
                               LED  \ /         
                                     V -->
                                    ---
                                     |
                                     |
                                   |/
Pin 18 o-------jumper wire---------|  BC337
                                   |>
                                     |
                                     |
                                     |
GND o----------jumper wire-----------o 



Awesome



Dependencies

  • Python 3.x on host machine.

Cross

Native

Building

Linux

  • Set the absolute path value for both kernel_sources_abspath and cross_toolchain_abspath keys found in file flash_led_jetson_nano.json
  • Issue the following at host cmd:
$ python3 make.py generate config:flash_led_jetson_nano.json
$ python3 make.py build config:flash_led_jetson_nano.json rts:true

Installation

  • Replace xyz.xyz.xyz.xyz by your jetson ip address and issue the following at host cmd:
$ scp flash_led/flash_led.ko your_jetson_username@xyz.xyz.xyz.xyz:~ ; ssh your_jetson_username@xyz.xyz.xyz.xyz

Limitations

Do not hesitate to fill a Github issue if you find any problem.

Usage

  • Issue the following at target cmd to insert kernel module:
jetson:~$ sudo insmod flash_led.ko
  • Your led should now flash at ~1Hz. now to remove kernel module:
jetson:~$ sudo rmmod flash_led.ko

Acknowledgments

I want to thank Quentin Ochem, Nicolas Setton, Fabien Chouteau, Jerome Lambourg, Michael Frank, Derek Schacht, Arnaud Charlet, Pat Bernardi, Leo Germond, and Artium Nihamkin for their different insights and feedback to nail this experiment.

About

NVIDIA Jetson Nano LED Linux driver experiment in Ada

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages