-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Emin017/dev
Update for CI
- Loading branch information
Showing
2 changed files
with
41 additions
and
4 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,37 @@ | ||
{ | ||
description = "MEMU"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }@inputs: | ||
flake-utils.lib.eachDefaultSystem | ||
(system: | ||
let | ||
pkgs = import nixpkgs { inherit system;}; | ||
deps = with pkgs; [ | ||
git | ||
gnumake autoconf automake | ||
cmake ninja | ||
pkgsCross.riscv64-embedded.buildPackages.gcc | ||
]; | ||
in | ||
{ | ||
legacyPackages = pkgs; | ||
devShell = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } { | ||
buildInputs = deps; | ||
RV64_TOOLCHAIN_ROOT = "${pkgs.pkgsCross.riscv64-embedded.buildPackages.gcc}"; | ||
shellHook = '' | ||
export EMU_CC=$RV64_TOOLCHAIN_ROOT/bin/riscv64-none-elf-gcc | ||
export EMU_OBJCOPY=$RV64_TOOLCHAIN_ROOT/bin/riscv64-none-elf-objcopy | ||
make test-img | ||
unset EMU_CC | ||
unset EMU_OBJCOPY | ||
''; | ||
}; | ||
} | ||
) | ||
// { inherit inputs;}; | ||
} |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
CSRCS = $(wildcard *.c) | ||
CC ?= riscv64-linux-gnu-gcc | ||
OBJCOPY ?= riscv64-linux-gnu-objcopy | ||
EMU_CC ?= riscv64-linux-gnu-gcc | ||
EMU_OBJCOPY ?= riscv64-linux-gnu-objcopy | ||
|
||
compile: | ||
@echo "Compiling..." | ||
@riscv64-linux-gnu-gcc -march=rv64g -ffreestanding -nostdlib -static -Wl,-Ttext=0 -O2 -o prog $(CSRCS) | ||
@riscv64-linux-gnu-objcopy -O binary --only-section=.text prog prog.bin | ||
$(EMU_CC) -march=rv64g -ffreestanding -nostdlib -static -Wl,-Ttext=0 -O2 -o prog $(CSRCS) | ||
$(EMU_OBJCOPY) -O binary --only-section=.text prog prog.bin | ||
@echo "Compilation complete." |