Skip to content

GNAT-Academic-Program/pico_tasks_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pico_tasks_demo

Minimal RP2040 (Raspberry Pi Pico) Ada demo showing concurrent tasking with a protected object.

Overview

This project demonstrates:

  • 2 Ada tasks (TA, TB) running concurrently
  • 1 main thread (Pico_Tasks_Demo) driving the onboard LED
  • 1 protected object (Tasks.Pobj) used for thread-safe shared state

Behavior:

  • TA increments Counter_A every 30 ms
  • TB increments Counter_B every 70 ms
  • Main loop calls Get_Led_Period on the protected object
  • Get_Led_Period returns Milliseconds (Counter_A + Counter_B)

Because Get_Led_Period is a protected operation, it is safe to call from the main thread while both tasks are updating counters concurrently.

Tooling prerequisites

You must have the following tools installed and available on your PATH:

  • alr — Alire (Ada package manager / build orchestrator)
  • elf2uf2 — needed when generating .uf2 for drag-and-drop flashing via the Pico mass-storage interface

Dependencies (from alire.toml)

Managed by Alire:

  • rp2040_hal = ^2.6.0
  • pico_bsp = ^2.2.0
  • light_tasking_rp2040 = *

Build

From the repository root:

alr build

Expected output from alr build:

  • bin/pico_tasks_demo (ELF)

To create a UF2 image for drag-and-drop flashing, run elf2uf2 explicitly:

elf2uf2 bin/pico_tasks_demo bin/pico_tasks_demo.uf2

Deploy (Raspberry Pi Pico)

  1. Hold BOOTSEL while plugging in the Pico.
  2. The board mounts as a USB mass-storage device (typically RPI-RP2).
  3. Copy bin/pico_tasks_demo.uf2 to that mounted volume.
  4. The board reboots automatically and starts the demo.

Runtime behavior summary

The LED starts blinking fast, then slows down over time. Each loop uses a bigger delay than the last one.

About

Minimal RP2040 (Raspberry Pi Pico) Ada demo showing concurrent tasking with a protected object.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages