NVIDIA Jetson Nano LED Linux driver experiment in Ada
Click to expand
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
).
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")
- 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
- Python 3.x on host machine.
- GNAT Pro 23 cross compilation toolchain on host machine.
(see https://github.com/ohenley/adacore_jetson/blob/main/jetson_nano_modules_cross.md for further details on how to setup)
- Jetson Ubuntu 18.04, GNAT 7.5.0.
(see https://github.com/ohenley/adacore_jetson/blob/main/jetson_nano_modules_native.md for further details on how to setup)
- Set the absolute path value for both
kernel_sources_abspath
andcross_toolchain_abspath
keys found in fileflash_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
- 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
Do not hesitate to fill a Github issue if you find any problem.
- 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
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.