Skip to content

Commit fa42091

Browse files
Nix: Add a baremetal shell (arm-embedded)
This commits adds a new shell called arm-embedded for baremetal targets. It includes arm-none-eabi-gcc, qemu, and platform support files from pqmx (currently limited to the MPS3 AN547 Cortex-M55). Co-authored-by: Brendan Moran <[email protected]> Signed-off-by: Matthias J. Kannwischer <[email protected]>
1 parent d9ae49f commit fa42091

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

flake.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@
8484
} ++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [ config.packages.valgrind_varlat ];
8585
};
8686

87+
# arm-none-eabi-gcc + platform files from pqmx
88+
packages.m55-an547 = util.m55-an547;
89+
devShells.arm-embedded = util.mkShell {
90+
packages = builtins.attrValues
91+
{
92+
inherit (config.packages) m55-an547;
93+
inherit (pkgs) gcc-arm-embedded qemu coreutils python3 git;
94+
};
95+
};
8796
devShells.hol_light = util.mkShell {
8897
packages = builtins.attrValues {
8998
inherit (config.packages) hol_light s2n_bignum;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (c) The mldsa-native project authors
2+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
3+
4+
{ stdenvNoCC
5+
, fetchFromGitHub
6+
, writeText
7+
}:
8+
9+
stdenvNoCC.mkDerivation {
10+
pname = "mldsa-native-m55-an547";
11+
version = "main-2025-10-02";
12+
13+
14+
# Fetch platform files from pqmx (envs/m55-an547)
15+
src = fetchFromGitHub {
16+
owner = "slothy-optimizer";
17+
repo = "pqmx";
18+
rev = "4ed493d3cf2af62a08fd9fe36c3472a0dc50ad9f";
19+
hash = "sha256-jLIqwknjRwcoDeEAETlMhRqZQ5a3QGCDZX9DENelGeQ=";
20+
};
21+
22+
dontBuild = true;
23+
24+
installPhase = ''
25+
mkdir -p $out/platform/m55-an547/src/platform/
26+
cp -r envs/m55-an547/src/platform/. $out/platform/m55-an547/src/platform/
27+
cp integration/*.c $out/platform/m55-an547/src/platform/
28+
'';
29+
30+
setupHook = writeText "setup-hook.sh" ''
31+
export M55_AN547_PATH="$1/platform/m55-an547/src/platform/"
32+
'';
33+
34+
meta = {
35+
description = "Platform files for the Cortex-M55 (AN547)";
36+
homepage = "https://github.com/slothy-optimizer/pqmx";
37+
};
38+
}

nix/util.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ rec {
3030
riscv64-gcc = wrap-gcc pkgs.pkgsCross.riscv64;
3131
riscv32-gcc = wrap-gcc pkgs.pkgsCross.riscv32;
3232
ppc64le-gcc = wrap-gcc pkgs.pkgsCross.powernv;
33+
arm-embedded-gcc = wrap-gcc pkgs.armToolchain;
3334
aarch64_be-gcc = (pkgs.callPackage ./aarch64_be-none-linux-gnu-gcc.nix { });
3435
in
3536
# NOTE:
@@ -102,6 +103,7 @@ rec {
102103
hol_light' = pkgs.callPackage ./hol_light { };
103104
s2n_bignum = pkgs.callPackage ./s2n_bignum { };
104105
slothy = pkgs.callPackage ./slothy { };
106+
m55-an547 = pkgs.callPackage ./m55-an547-arm-none-eabi { };
105107

106108
# Helper function to build individual cross toolchains
107109
_individual_toolchain = { name, cross_compilers }:

0 commit comments

Comments
 (0)