forked from M-Labs/artiq
firmware: use libcompiler_builtins to build satman.
This commit is contained in:
parent
4164fc880e
commit
f48cf9d9a0
|
@ -134,6 +134,7 @@ dependencies = [
|
||||||
"alloc_artiq 0.0.0",
|
"alloc_artiq 0.0.0",
|
||||||
"board 0.0.0",
|
"board 0.0.0",
|
||||||
"build_artiq 0.0.0",
|
"build_artiq 0.0.0",
|
||||||
|
"compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"logger_artiq 0.0.0",
|
"logger_artiq 0.0.0",
|
||||||
"std_artiq 0.0.0",
|
"std_artiq 0.0.0",
|
||||||
|
|
|
@ -13,6 +13,7 @@ path = "lib.rs"
|
||||||
build_artiq = { path = "../libbuild_artiq" }
|
build_artiq = { path = "../libbuild_artiq" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins" }
|
||||||
alloc_artiq = { path = "../liballoc_artiq" }
|
alloc_artiq = { path = "../liballoc_artiq" }
|
||||||
std_artiq = { path = "../libstd_artiq", features = ["alloc"] }
|
std_artiq = { path = "../libstd_artiq", features = ["alloc"] }
|
||||||
logger_artiq = { path = "../liblogger_artiq" }
|
logger_artiq = { path = "../liblogger_artiq" }
|
||||||
|
|
|
@ -6,14 +6,18 @@ PYTHON ?= python3
|
||||||
RUSTOUT := cargo/or1k-unknown-none/debug
|
RUSTOUT := cargo/or1k-unknown-none/debug
|
||||||
|
|
||||||
LDFLAGS += --gc-sections \
|
LDFLAGS += --gc-sections \
|
||||||
-L../libcompiler-rt \
|
|
||||||
-L../libbase
|
-L../libbase
|
||||||
|
|
||||||
|
RUSTFLAGS = \
|
||||||
|
-C target-feature=+mul,+div,+ffl1,+cmov,+addc \
|
||||||
|
-C opt-level=s \
|
||||||
|
-C panic=abort
|
||||||
|
export RUSTFLAGS
|
||||||
|
|
||||||
all: satman.bin satman.fbi
|
all: satman.bin satman.fbi
|
||||||
|
|
||||||
.PHONY: $(RUSTOUT)/libsatman.a
|
.PHONY: $(RUSTOUT)/libsatman.a
|
||||||
$(RUSTOUT)/libsatman.a:
|
$(RUSTOUT)/libsatman.a:
|
||||||
RUSTFLAGS="-C target-feature=+mul,+div,+ffl1,+cmov,+addc -C opt-level=s -Cpanic=abort" \
|
|
||||||
CARGO_TARGET_DIR=$(realpath .)/cargo \
|
CARGO_TARGET_DIR=$(realpath .)/cargo \
|
||||||
cargo build --target=or1k-unknown-none \
|
cargo build --target=or1k-unknown-none \
|
||||||
--manifest-path $(realpath $(SATMAN_DIRECTORY))/Cargo.toml
|
--manifest-path $(realpath $(SATMAN_DIRECTORY))/Cargo.toml
|
||||||
|
@ -23,12 +27,9 @@ satman.elf: $(RUSTOUT)/libsatman.a
|
||||||
-T $(SATMAN_DIRECTORY)/satman.ld \
|
-T $(SATMAN_DIRECTORY)/satman.ld \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$^ \
|
$^ \
|
||||||
-lbase-nofloat -lcompiler-rt
|
-lbase-nofloat
|
||||||
@chmod -x $@
|
@chmod -x $@
|
||||||
|
|
||||||
%.o: $(SATMAN_DIRECTORY)/%.c
|
|
||||||
$(compile)
|
|
||||||
|
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
$(OBJCOPY) -O binary $< $@
|
$(OBJCOPY) -O binary $< $@
|
||||||
@chmod -x $@
|
@chmod -x $@
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
#![feature(compiler_builtins_lib)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
extern crate compiler_builtins;
|
||||||
extern crate alloc_artiq;
|
extern crate alloc_artiq;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate std_artiq as std;
|
extern crate std_artiq as std;
|
||||||
|
|
|
@ -32,7 +32,7 @@ RUSTFLAGS = \
|
||||||
-C target-feature=+mul,+div,+ffl1,+cmov,+addc \
|
-C target-feature=+mul,+div,+ffl1,+cmov,+addc \
|
||||||
-C relocation-model=static \
|
-C relocation-model=static \
|
||||||
-C opt-level=s \
|
-C opt-level=s \
|
||||||
-Cpanic=abort
|
-C panic=abort
|
||||||
export RUSTFLAGS
|
export RUSTFLAGS
|
||||||
|
|
||||||
all: runtime.bin runtime.fbi
|
all: runtime.bin runtime.fbi
|
||||||
|
|
Loading…
Reference in New Issue