firmware: use libcompiler_builtins to build satman.

This commit is contained in:
whitequark 2017-02-03 08:11:42 +00:00
parent 4164fc880e
commit f48cf9d9a0
5 changed files with 12 additions and 7 deletions

View File

@ -134,6 +134,7 @@ dependencies = [
"alloc_artiq 0.0.0",
"board 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)",
"logger_artiq 0.0.0",
"std_artiq 0.0.0",

View File

@ -13,6 +13,7 @@ path = "lib.rs"
build_artiq = { path = "../libbuild_artiq" }
[dependencies]
compiler_builtins = { git = "https://github.com/rust-lang-nursery/compiler-builtins" }
alloc_artiq = { path = "../liballoc_artiq" }
std_artiq = { path = "../libstd_artiq", features = ["alloc"] }
logger_artiq = { path = "../liblogger_artiq" }

View File

@ -6,14 +6,18 @@ PYTHON ?= python3
RUSTOUT := cargo/or1k-unknown-none/debug
LDFLAGS += --gc-sections \
-L../libcompiler-rt \
-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
.PHONY: $(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 build --target=or1k-unknown-none \
--manifest-path $(realpath $(SATMAN_DIRECTORY))/Cargo.toml
@ -23,12 +27,9 @@ satman.elf: $(RUSTOUT)/libsatman.a
-T $(SATMAN_DIRECTORY)/satman.ld \
-o $@ \
$^ \
-lbase-nofloat -lcompiler-rt
-lbase-nofloat
@chmod -x $@
%.o: $(SATMAN_DIRECTORY)/%.c
$(compile)
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
@chmod -x $@

View File

@ -1,5 +1,7 @@
#![feature(compiler_builtins_lib)]
#![no_std]
extern crate compiler_builtins;
extern crate alloc_artiq;
#[macro_use]
extern crate std_artiq as std;

View File

@ -32,7 +32,7 @@ RUSTFLAGS = \
-C target-feature=+mul,+div,+ffl1,+cmov,+addc \
-C relocation-model=static \
-C opt-level=s \
-Cpanic=abort
-C panic=abort
export RUSTFLAGS
all: runtime.bin runtime.fbi