forked from M-Labs/artiq
1
0
Fork 0

cargo: use cargo xbuild

This commit is contained in:
occheung 2021-09-01 17:45:27 +08:00
parent 9f6b3f6014
commit dcbd9f905c
5 changed files with 33 additions and 4 deletions

View File

@ -3,11 +3,15 @@ include $(MISOC_DIRECTORY)/software/common.mak
RUSTFLAGS += -Cpanic=abort RUSTFLAGS += -Cpanic=abort
export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot
all:: bootloader.bin all:: bootloader.bin
.PHONY: $(RUSTOUT)/libbootloader.a .PHONY: $(RUSTOUT)/libbootloader.a
$(RUSTOUT)/libbootloader.a: $(RUSTOUT)/libbootloader.a:
$(cargo) --manifest-path $(BOOTLOADER_DIRECTORY)/Cargo.toml $(cargo) --target-dir ./cargo \
--manifest-path $(BOOTLOADER_DIRECTORY)/Cargo.toml \
--target $(BOOTLOADER_DIRECTORY)/../riscv32ima-unknown-none-elf.json
bootloader.elf: $(RUSTOUT)/libbootloader.a bootloader.elf: $(RUSTOUT)/libbootloader.a
$(link) -T $(BOOTLOADER_DIRECTORY)/bootloader.ld $(link) -T $(BOOTLOADER_DIRECTORY)/bootloader.ld

View File

@ -14,11 +14,15 @@ LDFLAGS += --eh-frame-hdr \
RUSTFLAGS += -Cpanic=unwind RUSTFLAGS += -Cpanic=unwind
export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot
all:: ksupport.elf all:: ksupport.elf
.PHONY: $(RUSTOUT)/libksupport.a .PHONY: $(RUSTOUT)/libksupport.a
$(RUSTOUT)/libksupport.a: $(RUSTOUT)/libksupport.a:
$(cargo) --manifest-path $(KSUPPORT_DIRECTORY)/Cargo.toml $(cargo) --target-dir ./cargo \
--manifest-path $(KSUPPORT_DIRECTORY)/Cargo.toml \
--target $(KSUPPORT_DIRECTORY)/../riscv32ima-unknown-none-elf.json
ksupport.elf: $(RUSTOUT)/libksupport.a glue.o ksupport.elf: $(RUSTOUT)/libksupport.a glue.o
$(link) -T $(KSUPPORT_DIRECTORY)/ksupport.ld \ $(link) -T $(KSUPPORT_DIRECTORY)/ksupport.ld \

View File

@ -10,11 +10,15 @@ LDFLAGS += \
RUSTFLAGS += -Cpanic=unwind RUSTFLAGS += -Cpanic=unwind
export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot
all:: runtime.bin runtime.fbi all:: runtime.bin runtime.fbi
.PHONY: $(RUSTOUT)/libruntime.a .PHONY: $(RUSTOUT)/libruntime.a
$(RUSTOUT)/libruntime.a: $(RUSTOUT)/libruntime.a:
$(cargo) --manifest-path $(RUNTIME_DIRECTORY)/Cargo.toml $(cargo) --target-dir ./cargo \
--manifest-path $(RUNTIME_DIRECTORY)/Cargo.toml \
--target $(RUNTIME_DIRECTORY)/../riscv32ima-unknown-none-elf.json
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
$(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \ $(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \

View File

@ -9,7 +9,9 @@ all:: satman.bin satman.fbi
.PHONY: $(RUSTOUT)/libsatman.a .PHONY: $(RUSTOUT)/libsatman.a
$(RUSTOUT)/libsatman.a: $(RUSTOUT)/libsatman.a:
$(cargo) --manifest-path $(SATMAN_DIRECTORY)/Cargo.toml $(cargo) --target-dir ./cargo \
--manifest-path $(SATMAN_DIRECTORY)/Cargo.toml \
--target $(SATMAN_DIRECTORY)/../riscv32ima-unknown-none-elf.json
satman.elf: $(RUSTOUT)/libsatman.a satman.elf: $(RUSTOUT)/libsatman.a
$(link) -T $(SATMAN_DIRECTORY)/satman.ld $(link) -T $(SATMAN_DIRECTORY)/satman.ld

View File

@ -180,6 +180,20 @@
propagatedBuildInputs = with pkgs.python3Packages; [ jinja2 numpy migen pyserial asyncserial ]; propagatedBuildInputs = with pkgs.python3Packages; [ jinja2 numpy migen pyserial asyncserial ];
}; };
cargo-xbuild = rustPlatform.buildRustPackage rec {
pname = "cargo-xbuild";
version = "0.6.5";
src = pkgs.fetchFromGitHub {
owner = "rust-osdev";
repo = pname;
rev = "v${version}";
sha256 = "18djvygq9v8rmfchvi2hfj0i6fhn36m716vqndqnj56fiqviwxvf";
};
cargoSha256 = "13sj9j9kl6js75h9xq0yidxy63vixxm9q3f8jil6ymarml5wkhx8";
};
vivadoEnv = pkgs.buildFHSUserEnv { vivadoEnv = pkgs.buildFHSUserEnv {
name = "vivado-env"; name = "vivado-env";
targetPkgs = vivadoDeps; targetPkgs = vivadoDeps;
@ -211,6 +225,7 @@
pkgs.lld_11 pkgs.lld_11
vivado vivado
rustPlatform.cargoSetupHook rustPlatform.cargoSetupHook
cargo-xbuild
]; ];
buildPhase = buildPhase =
'' ''