Last active
March 18, 2024 17:43
-
-
Save karmanyaahm/cd1326b0a8bc4ad1d2e51247bfc80951 to your computer and use it in GitHub Desktop.
Put this in a directory and then call `nix develop --impure` This is assuming flakes are enabled in the nix config (I'm using it on NixOS but it should??? work on any nix package manager installation?)
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
{ | |
description = "Scratch dir for various testing"; | |
outputs = {nixpkgs, ...}: let | |
system = "x86_64-linux"; | |
pkgs = nixpkgs.legacyPackages.${system}; | |
nixarm = import <nixpkgs> { | |
crossSystem = { | |
config = "aarch64-unknown-linux-gnu"; | |
}; | |
}; | |
# this will use aarch64 binaries from binary cache, so no need to build those | |
pkgsArm = import <nixpkgs> { | |
config = {}; | |
overlays = []; | |
system = "aarch64-linux"; | |
}; | |
# these will be your cross packages | |
pkgsCross = import <nixpkgs> { | |
overlays = [(self: super: { | |
# things | |
})]; | |
crossSystem = { | |
config = "aarch64-unknown-linux-gnu"; | |
}; | |
}; | |
in { | |
devShells.${system}.default = pkgs.mkShell { | |
packages = [ | |
pkgs.qemu | |
pkgsArm.gdb | |
pkgsArm.gef | |
#pkgs.gcc-arm-embedded | |
pkgsArm.gcc | |
]; | |
}; | |
}; | |
} |
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
all: clean build | |
build: | |
gcc student_a64_template.s a64_testbench.o -o ac_lab -g -lm | |
run: build | |
qemu-aarch64 ./ac_lab ${ARGS} | |
run-and-wait-for-debug: | |
while true; do make build && qemu-aarch64 -g 25540 ./ac_lab ${ARGS}; sleep 1; done | |
#pass arguments to makefile like BREAK_AT=aiken_to_long | |
debug: | |
gef -q ac_lab -ex 'target remote localhost:25540' -ex 'gef config context.layout "-legend regs -stack code args source memory threads -trace extra"' -ex 'break ${BREAK_AT}' | |
clean: | |
rm -f ac_lab qemu*.core | |
verify: | |
python3 verify.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment