-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds a nix-shell environment and a Makefile to build the firmware binaries using Nix. The idea is to make it easier to build a previous version of the firmware the same way it was built at the time of development. Potentially, it could also be used with the CI for reproducible builds (to be investigated).
- Loading branch information
1 parent
28a46ae
commit 056b62c
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
RUNNER ?= ../../runners/embedded | ||
RUNNER_NK3AM ?= $(RUNNER)/artifacts/runner-nrf52-bootloader-nk3am.bin | ||
RUNNER_NK3XN ?= $(RUNNER)/artifacts/runner-lpc55-nk3xn.bin | ||
|
||
.PHONY: all | ||
all: | ||
@nix-shell --pure --run "make binaries" | ||
@ls -l *.bin | ||
|
||
.PHONY: binaries | ||
binaries: | ||
$(MAKE) -C $(RUNNER) build-nk3xn | ||
cp $(RUNNER_NK3XN) firmware-nk3xn.bin | ||
$(MAKE) -C $(RUNNER) build-nk3xn FEATURES=provisioner | ||
cp $(RUNNER_NK3XN) provisioner-nk3xn.bin | ||
$(MAKE) -C $(RUNNER) build-nk3xn FEATURES=test | ||
cp $(RUNNER_NK3XN) firmware-test-nk3xn.bin | ||
$(MAKE) -C $(RUNNER) build-nk3am.bl | ||
cp $(RUNNER_NK3AM) firmware-nk3am.bin | ||
$(MAKE) -C $(RUNNER) build-nk3am.bl FEATURES=provisioner | ||
cp $(RUNNER_NK3AM) provisioner-nk3am.bin | ||
$(MAKE) -C $(RUNNER) build-nk3am.bl FEATURES=test | ||
cp $(RUNNER_NK3AM) firmware-test-nk3am.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Commit from 2023-11-10 | ||
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/da4024d0ead5d7820f6bd15147d3fe2a0c0cec73.tar.gz") {} }: | ||
|
||
let | ||
fenix = pkgs.callPackage | ||
(pkgs.fetchFromGitHub { | ||
owner = "nix-community"; | ||
repo = "fenix"; | ||
# commit from: 2023-11-01 | ||
rev = "1a92c6d75963fd594116913c23041da48ed9e020"; | ||
hash = "sha256-L3vZfifHmog7sJvzXk8qiKISkpyltb+GaThqMJ7PU9Y="; | ||
}) | ||
{ }; | ||
toolchain = fenix.fromToolchainFile { | ||
dir = ../..; | ||
sha256 = "sha256-Q9UgzzvxLi4x9aWUJTn+/5EXekC98ODRU1TwhUs9RnY="; | ||
}; | ||
in | ||
pkgs.mkShell { | ||
name = "nk3"; | ||
nativeBuildInputs = with pkgs.buildPackages; [ | ||
flip-link | ||
gcc-arm-embedded | ||
git | ||
gnumake | ||
libclang | ||
toolchain | ||
(python3.withPackages(ps: with ps; [ toml ])) | ||
]; | ||
|
||
shellHook = '' | ||
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib" | ||
export TARGET_CC=arm-none-eabi-gcc | ||
''; | ||
} |