munts_rp2040_firmware_embedded release 2.24840.1 Tue Apr 14 01:12:29 PM PDT 2026 (#1859)
Phil's RP2040 Microcontroller Embedded Profile Firmware Template Added web site link. Added long description. Refined postbuild.sh to make search for implicit mount point much more robust.
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
name = "munts_rp2040_firmware_embedded"
|
||||||
|
description = "Phil's RP2040 Microcontroller Embedded Profile Firmware"
|
||||||
|
version = "2.24820.1"
|
||||||
|
authors = ["Philip Munts"]
|
||||||
|
maintainers = ["Philip Munts <phil@munts.net>"]
|
||||||
|
maintainers-logins = ["pmunts"]
|
||||||
|
licenses = "BSD-1-Clause"
|
||||||
|
|
||||||
|
executables = ["munts_rp2040_firmware_embedded"]
|
||||||
|
|
||||||
|
[[depends-on]]
|
||||||
|
embedded_rp2040 = "^15"
|
||||||
|
rp2040_hal = "^2"
|
||||||
|
|
||||||
|
[configuration.values]
|
||||||
|
embedded_rp2040.Board = "generic_board"
|
||||||
|
embedded_rp2040.Max_CPUs = 2
|
||||||
|
rp2040_hal.Interrupts = "bb_runtimes"
|
||||||
|
rp2040_hal.Use_Startup = false
|
||||||
|
|
||||||
|
[[actions]]
|
||||||
|
type = "post-build"
|
||||||
|
command = ["sh", "-c", "./postbuild.sh"]
|
||||||
|
|
||||||
|
[origin]
|
||||||
|
hashes = [
|
||||||
|
"sha256:45796fc84bc61b310ad3239fa85a7ea0c30d4f36ddf9283d7d295381b5cfd424",
|
||||||
|
"sha512:12572c2990e5a6fc898a880965e36f9c55d8b400eaf0d90d461c191d19a62aa028fd15383d176ebc6eb4eca7d0dae8c135fee2e0a52c21f2b3ddd4b745278f1d",
|
||||||
|
]
|
||||||
|
url = "https://raw.githubusercontent.com/pmunts/alire-crates/898a3bcbf0abab303d6bc1a5e8d03729d4ba49e6/munts_rp2040_firmware_embedded/munts_rp2040_firmware_embedded-2.24820.1.tbz2"
|
||||||
|
|
||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
name = "munts_rp2040_firmware_embedded"
|
||||||
|
description = "Phil's RP2040 Microcontroller Embedded Profile Firmware Template"
|
||||||
|
version = "2.24840.1"
|
||||||
|
authors = ["Philip Munts"]
|
||||||
|
maintainers = ["Philip Munts <phil@munts.net>"]
|
||||||
|
maintainers-logins = ["pmunts"]
|
||||||
|
licenses = "BSD-1-Clause"
|
||||||
|
website = "https://github.com/pmunts/arm-mcu"
|
||||||
|
executables = ["munts_rp2040_firmware_embedded"]
|
||||||
|
|
||||||
|
long-description = """
|
||||||
|
# Introduction
|
||||||
|
|
||||||
|
This crate provides a comprehensive template for developing Ada firmware
|
||||||
|
for the [RP2040 ARM 32-bit
|
||||||
|
microcontroller](https://www.raspberrypi.com/products/rp2040), using the
|
||||||
|
[GNAT Predefined Embedded
|
||||||
|
Runtime](https://docs.adacore.com/gnat_ugx-docs/html/gnat_ugx/gnat_ugx/gnat_runtimes.html#embedded-run-time)
|
||||||
|
implemented by the
|
||||||
|
[`embedded_rp2040`](https://alire.ada.dev/crates/embedded_rp2040.html)
|
||||||
|
and [`rp2040_hal`](https://alire.ada.dev/crates/rp2040_hal.html) crates
|
||||||
|
and their dependencies.
|
||||||
|
|
||||||
|
Ada firmware for a microcontroller is realized as a main program
|
||||||
|
procedure that is called by otherwise invisible runtime startup code,
|
||||||
|
exactly as C firmware is realized by a function `main()` that is called
|
||||||
|
by otherwise invisible runtime startup code.
|
||||||
|
|
||||||
|
# Post-Build Script
|
||||||
|
|
||||||
|
An Alire project directory created by
|
||||||
|
`alr get munts_rp2040_firmware_embedded` will include a post-build
|
||||||
|
script named `postbuild.sh`. This script will install the newly built
|
||||||
|
firmware to a mounted RP2040 ROM boot USB file system. The RP2040 ROM
|
||||||
|
boot code implements USB mass storage emulation, in a fashion first
|
||||||
|
popularized by the late and lamented [Mbed
|
||||||
|
OS](https://os.mbed.com/mbed-os). To flash RP2040 firmware, you just
|
||||||
|
assert `BOOTSEL` and `RESET` hardware signals to force the RP2040 into
|
||||||
|
ROM boot mode, mount the USB mass storage device (usually done
|
||||||
|
automatically by the development machine operating system), and then
|
||||||
|
copy a [UF2](https://github.com/microsoft/uf2) firmware image file it.
|
||||||
|
`postbuild.sh` uses the [`elf2uf2`](https://github.com/rej696/elf2uf2)
|
||||||
|
utility program to copy the firmware image to the RP2040.
|
||||||
|
|
||||||
|
You can explicitly specify the RP2040 mount point *aka* destination
|
||||||
|
directory with the `RP2040_DESTDIR` environment variable before running
|
||||||
|
`alr build`. Otherwise `postbuild.sh` will search for the RP2040 mount
|
||||||
|
point at expected locations for ChromeOS, Linux, macOS, and Microsoft
|
||||||
|
Windows.
|
||||||
|
|
||||||
|
If an RP2040 mount point cannot be found, `postbuild.sh` does nothing.
|
||||||
|
|
||||||
|
# Makefile
|
||||||
|
|
||||||
|
An Alire project directory created by
|
||||||
|
`alr get munts_rp2040_firmware_embedded` will include an optional but
|
||||||
|
useful GNU `Makefile` (also available at
|
||||||
|
<https://github.com/pmunts/alire-goodies>) containing the following
|
||||||
|
*goals* or *targets*:
|
||||||
|
|
||||||
|
- `build` -- Accomplished by the command `gmake build`. Runs `alr build`
|
||||||
|
to build the firmware image. Result (upon success) is a 32-bit ARM ELF
|
||||||
|
executable file in the `bin/` subdirectory.
|
||||||
|
- `clean` -- Accomplished by the command `gmake clean`. Removes all
|
||||||
|
generated working files. What is left will be suitable for checking
|
||||||
|
into a source control system.
|
||||||
|
- `distclean` -- Accomplished by the command `gmake distclean`. Removes
|
||||||
|
all generated working files *and* removes Alire's crate download and
|
||||||
|
build caches.
|
||||||
|
|
||||||
|
*Note: `make` is often a synonym (symbolic link, shell alias, etc.) for
|
||||||
|
`gmake` on Linux machines, meaning that `make build` behaves exactly the
|
||||||
|
same as `gmake build`.*
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
|
||||||
|
An Alire project directory created by
|
||||||
|
`alr get munts_rp2040_firmware_embedded` will include an optional but
|
||||||
|
useful `.vscode/tasks.json` (also available at
|
||||||
|
<https://github.com/pmunts/alire-goodies>) which provides some build
|
||||||
|
tasks for [Visual Studio Code](https://code.visualstudio.com).
|
||||||
|
|
||||||
|
You can invoke a Visual Studio build task from the application menu
|
||||||
|
`Terminal => Run Task...` or `Terminal => Run Build Task...`
|
||||||
|
|
||||||
|
The most straightforward way to build *and* install RP2040 firmware from
|
||||||
|
within Visual Studio Code is to simply press **CONTROL + SHIFT + B**.
|
||||||
|
This key code invokes the default build task which executes the command
|
||||||
|
`make clean build` which executes the command `alr build` which executes
|
||||||
|
script `postbuild.sh`.
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
|
||||||
|
## Command line
|
||||||
|
|
||||||
|
alr -n get munts_rp2040_firmware_embedded
|
||||||
|
alire-rename munts_rp2040_firmware_embedded_2.24820.1_45796fc8 myfirmware # optional
|
||||||
|
cd myfirmware
|
||||||
|
alr -n with munts_rp2040_lib_embedded # optional
|
||||||
|
alr build
|
||||||
|
|
||||||
|
## Visual Studio Code
|
||||||
|
|
||||||
|
alr -n get munts_rp2040_firmware_embedded
|
||||||
|
alire-rename munts_rp2040_firmware_embedded_2.24820.1_45796fc8 myfirmware # optional
|
||||||
|
cd myfirmware
|
||||||
|
alr -n with munts_rp2040_lib_embedded # optional
|
||||||
|
code .
|
||||||
|
|
||||||
|
*Note: The Alire project rename script `alire-rename` is available at
|
||||||
|
<https://github.com/pmunts/alire-goodies>.*
|
||||||
|
"""
|
||||||
|
|
||||||
|
[[depends-on]]
|
||||||
|
embedded_rp2040 = "^15"
|
||||||
|
rp2040_hal = "^2"
|
||||||
|
|
||||||
|
[configuration.values]
|
||||||
|
embedded_rp2040.Board = "generic_board"
|
||||||
|
embedded_rp2040.Max_CPUs = 2
|
||||||
|
rp2040_hal.Interrupts = "bb_runtimes"
|
||||||
|
rp2040_hal.Use_Startup = false
|
||||||
|
|
||||||
|
[[actions]]
|
||||||
|
type = "post-build"
|
||||||
|
command = ["sh", "-c", "./postbuild.sh"]
|
||||||
|
|
||||||
|
[origin]
|
||||||
|
hashes = [
|
||||||
|
"sha256:3c19be3af0d8612068342d677e5b1f2565ec350bb7ff824a2a21382a194c2cf1",
|
||||||
|
"sha512:80ac59a4e67a305108e296e4e6f420f3ccc3259fa905c90f840852f02984edb357e3e0faff3e8c579f3785544932bbc8f289db9040d16a022414bc7d86053705",
|
||||||
|
]
|
||||||
|
url = "https://raw.githubusercontent.com/pmunts/alire-crates/10e528130a5013f04155770fc2d94aa938928b0b/munts_rp2040_firmware_embedded/munts_rp2040_firmware_embedded-2.24840.1.tbz2"
|
||||||
|
|
||||||
Reference in New Issue
Block a user