Skip to content

Commit 73582ee

Browse files
feat: riscv-virt-rt 0.1.0 — board support for QEMU's RISC-V virt machine (#219)
* feat: riscv-virt-rt 0.1.0 — board support for QEMU's RISC-V virt machine The first bare-metal package in this index. With it, a firmware project is an ordinary mcpp project: mcpp add riscv-virt-rt@0.1.0 mcpp build --target riscv64-none-elf # + .bin, .map, a size summary mcpp run --target riscv64-none-elf # boots in qemu mcpp test --target riscv64-none-elf and its manifest names no linker script, load address, libc, -nostdlib or emulator — there is no [target.*] section at all. Verified end to end against this tree as a path index: added, downloaded, built and booted, printing from the firmware. Two descriptor choices are load-bearing, both measured rather than assumed: * Form A (`mcpp = "*/mcpp.toml"`), because the package ships a build.mcpp and mcpp looks for that at the package ROOT. Form B leaves the root at the extract dir and absorbs the tarball's wrap layer inside each source glob, which would leave build.mcpp one level down and unfound — the package would resolve and compile, then link against nothing. * `deps` at the xpm PLATFORM level, carrying xim:picolibc-riscv and xim:qemu-riscv. mcpp materializes `[xlings] deps` for the ROOT project only, so the package's own declaration does not reach a consumer. Verified by removing picolibc from the store: `mcpp add` + `mcpp build` reinstalled it and linked; without this edge the build stops at build.mcpp saying the sysroot is declared but not installed. Requires mcpp >= 2026.8.19.2 (build.mcpp calls `mcpp::runner`). No workspace member under tests/examples/: those run on all three platforms with no capability gate, and this one needs an emulator and a target sysroot. The package's own repo CI installs both and boots rv64 and rv32 on every push. * riscv-virt-rt 0.2.0 — the version that ships the project template 0.2.0 adds templates/blinky, so `mcpp new <name> --template riscv-virt-rt` produces a firmware project that builds, boots and tests unmodified. The template ships with the package rather than with mcpp, whose builtin registry is frozen at `bin`; `mcpp new` writes the dependency line at the version it resolved, so the two cannot drift. 0.1.0 stays listed: a version that has been published is a version someone may have pinned. --------- Co-authored-by: speak-agent <x.d2learn.org@gmail.com>
1 parent 11dfd1e commit 73582ee

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

pkgs/r/riscv-virt-rt.lua

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
-- riscv-virt-rt — board support for QEMU's RISC-V `virt` machine.
2+
--
3+
-- Form A (`mcpp = "*/mcpp.toml"`) rather than an inline Form B table, and the
4+
-- choice is load-bearing rather than stylistic: this package ships a
5+
-- `build.mcpp`, and mcpp looks for that at the PACKAGE ROOT. Form B leaves the
6+
-- root at the extract dir and absorbs the tarball's `riscv-virt-rt-<v>/` wrap
7+
-- layer inside each source glob — which would leave `build.mcpp` one level
8+
-- down, unfound, and the package would resolve, compile its module, and then
9+
-- link against nothing. Pointing at the manifest moves the root inside the
10+
-- wrap layer, where both the manifest and the program live.
11+
--
12+
-- ⚠️ `deps` is at the xpm PLATFORM level, not in the mcpp segment. The two
13+
-- entries are xim packages (an emulator and a target sysroot), not mcpp
14+
-- packages, so they travel on xim's install-time dependency edge. This matters
15+
-- more than it looks: mcpp materializes `[xlings] deps` for the ROOT project
16+
-- only, so a consumer that just runs `mcpp add riscv-virt-rt` would otherwise
17+
-- get the board package with neither a libc nor an emulator, and find out at
18+
-- build.mcpp time.
19+
package = {
20+
spec = "1",
21+
namespace = "mcpplibs",
22+
name = "riscv-virt-rt",
23+
description = "Board support for QEMU's RISC-V virt machine — picolibc, startup, memory layout and the emulator",
24+
licenses = {"Apache-2.0"},
25+
repo = "https://github.com/mcpplibs/riscv-virt-rt",
26+
type = "package",
27+
28+
-- 0.2.0 adds the project template (`mcpp new <name> --template
29+
-- riscv-virt-rt`); 0.1.0 stays listed because a version that has been
30+
-- published is a version someone may have pinned.
31+
xpm = {
32+
linux = {
33+
deps = { "xim:picolibc-riscv@1.8.12", "xim:qemu-riscv@9.2.4-1" },
34+
["0.1.0"] = {
35+
url = {
36+
GLOBAL = "https://github.com/mcpplibs/riscv-virt-rt/archive/refs/tags/0.1.0.tar.gz",
37+
CN = "https://gitcode.com/mcpp-res/riscv-virt-rt/releases/download/0.1.0/riscv-virt-rt-0.1.0.tar.gz",
38+
},
39+
sha256 = "8afb5ff2e9593b59f1f90029f57d577df454c78cdeff80760894c72aac7e5168",
40+
},
41+
["0.2.0"] = {
42+
url = {
43+
GLOBAL = "https://github.com/mcpplibs/riscv-virt-rt/archive/refs/tags/0.2.0.tar.gz",
44+
CN = "https://gitcode.com/mcpp-res/riscv-virt-rt/releases/download/0.2.0/riscv-virt-rt-0.2.0.tar.gz",
45+
},
46+
sha256 = "79f1dc4415a59ba828048eb8706322957723f8a6fd84bde3faba6a377e48242b",
47+
},
48+
},
49+
macosx = {
50+
deps = { "xim:picolibc-riscv@1.8.12", "xim:qemu-riscv@9.2.4-1" },
51+
["0.1.0"] = {
52+
url = {
53+
GLOBAL = "https://github.com/mcpplibs/riscv-virt-rt/archive/refs/tags/0.1.0.tar.gz",
54+
CN = "https://gitcode.com/mcpp-res/riscv-virt-rt/releases/download/0.1.0/riscv-virt-rt-0.1.0.tar.gz",
55+
},
56+
sha256 = "8afb5ff2e9593b59f1f90029f57d577df454c78cdeff80760894c72aac7e5168",
57+
},
58+
["0.2.0"] = {
59+
url = {
60+
GLOBAL = "https://github.com/mcpplibs/riscv-virt-rt/archive/refs/tags/0.2.0.tar.gz",
61+
CN = "https://gitcode.com/mcpp-res/riscv-virt-rt/releases/download/0.2.0/riscv-virt-rt-0.2.0.tar.gz",
62+
},
63+
sha256 = "79f1dc4415a59ba828048eb8706322957723f8a6fd84bde3faba6a377e48242b",
64+
},
65+
},
66+
windows = {
67+
deps = { "xim:picolibc-riscv@1.8.12", "xim:qemu-riscv@9.2.4-1" },
68+
["0.1.0"] = {
69+
url = {
70+
GLOBAL = "https://github.com/mcpplibs/riscv-virt-rt/archive/refs/tags/0.1.0.tar.gz",
71+
CN = "https://gitcode.com/mcpp-res/riscv-virt-rt/releases/download/0.1.0/riscv-virt-rt-0.1.0.tar.gz",
72+
},
73+
sha256 = "8afb5ff2e9593b59f1f90029f57d577df454c78cdeff80760894c72aac7e5168",
74+
},
75+
["0.2.0"] = {
76+
url = {
77+
GLOBAL = "https://github.com/mcpplibs/riscv-virt-rt/archive/refs/tags/0.2.0.tar.gz",
78+
CN = "https://gitcode.com/mcpp-res/riscv-virt-rt/releases/download/0.2.0/riscv-virt-rt-0.2.0.tar.gz",
79+
},
80+
sha256 = "79f1dc4415a59ba828048eb8706322957723f8a6fd84bde3faba6a377e48242b",
81+
},
82+
},
83+
},
84+
85+
-- The package's own manifest, inside the tarball's wrap directory.
86+
mcpp = "*/mcpp.toml",
87+
}

0 commit comments

Comments
 (0)