Skip to content

Commit 6f10b9f

Browse files
willieyzhanno-becker
authored andcommitted
Nix: Add a baremetal shell (arm-embedded)
- This commits adds a new shell: 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). Signed-off-by: willieyz <[email protected]>
1 parent 38c9c39 commit 6f10b9f

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

flake.nix

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

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

nix/util.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ rec {
2828
riscv64-gcc = wrap-gcc pkgs.pkgsCross.riscv64;
2929
riscv32-gcc = wrap-gcc pkgs.pkgsCross.riscv32;
3030
ppc64le-gcc = wrap-gcc pkgs.pkgsCross.powernv;
31+
arm-embedded-gcc = wrap-gcc pkgs.armToolchain;
3132
aarch64_be-gcc = (pkgs.callPackage ./aarch64_be-none-linux-gnu-gcc.nix { });
3233
in
3334
# NOTE:
@@ -100,6 +101,7 @@ rec {
100101
hol_light' = pkgs.callPackage ./hol_light { };
101102
s2n_bignum = pkgs.callPackage ./s2n_bignum { };
102103
slothy = pkgs.callPackage ./slothy { };
104+
m55-an547 = pkgs.callPackage ./m55-an547-arm-none-eabi { };
103105

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

0 commit comments

Comments
 (0)