forked from M-Labs/artiq
1
0
Fork 0

firmware: remove false dependency from runtime to ksupport.

This significantly speeds up no-change builds.
This commit is contained in:
whitequark 2017-01-17 05:36:07 +00:00
parent 971e4c3026
commit 0253e0a89d
2 changed files with 15 additions and 9 deletions

View File

@ -12,9 +12,15 @@ pub unsafe fn start() {
stop();
let ksupport_image = include_bytes!(concat!(env!("CARGO_TARGET_DIR"), "/../ksupport.elf"));
let ksupport_addr = (KERNELCPU_EXEC_ADDRESS - KSUPPORT_HEADER_SIZE) as *mut u8;
ptr::copy_nonoverlapping(ksupport_image.as_ptr(), ksupport_addr, ksupport_image.len());
extern {
static _binary_ksupport_elf_start: u8;
static _binary_ksupport_elf_end: u8;
}
let ksupport_start = &_binary_ksupport_elf_start as *const _;
let ksupport_end = &_binary_ksupport_elf_end as *const _;
ptr::copy_nonoverlapping(ksupport_start,
(KERNELCPU_EXEC_ADDRESS - KSUPPORT_HEADER_SIZE) as *mut u8,
ksupport_end as usize - ksupport_start as usize);
csr::kernel_cpu::reset_write(0);

View File

@ -3,9 +3,6 @@ include $(MISOC_DIRECTORY)/software/common.mak
PYTHON ?= python3.5
OBJECTS := flash_storage.o main.o
OBJECTS_KSUPPORT := ksupport_glue.o artiq_personality.o
RUSTOUT := cargo/or1k-unknown-none/debug
RUSTOUT_KSUPPORT := cargo-ksupport/or1k-unknown-none/debug
@ -31,13 +28,13 @@ LDFLAGS += --gc-sections \
all: runtime.bin runtime.fbi
.PHONY: $(RUSTOUT)/libruntime.a
$(RUSTOUT)/libruntime.a: ksupport.elf
$(RUSTOUT)/libruntime.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 $(RUNTIME_DIRECTORY)/../firmware/runtime/Cargo.toml)
runtime.elf: $(OBJECTS) $(RUSTOUT)/libruntime.a
runtime.elf: $(RUSTOUT)/libruntime.a flash_storage.o main.o ksupport_data.o
$(LD) $(LDFLAGS) \
-T $(RUNTIME_DIRECTORY)/runtime.ld \
-o $@ \
@ -52,7 +49,7 @@ $(RUSTOUT_KSUPPORT)/libksupport.a:
cargo build --target=or1k-unknown-none \
--manifest-path $(realpath $(RUNTIME_DIRECTORY)/../firmware/libksupport/Cargo.toml)
ksupport.elf: $(OBJECTS_KSUPPORT) $(RUSTOUT_KSUPPORT)/libksupport.a
ksupport.elf: $(RUSTOUT_KSUPPORT)/libksupport.a ksupport_glue.o artiq_personality.o
$(LD) $(LDFLAGS) \
--eh-frame-hdr \
-T $(RUNTIME_DIRECTORY)/ksupport.ld \
@ -68,6 +65,9 @@ ksupport.elf: $(OBJECTS_KSUPPORT) $(RUSTOUT_KSUPPORT)/libksupport.a
$(OBJCOPY) -O binary $< $@
@chmod -x $@
%_data.o: %.elf
$(LD) -r -b binary -o $@ $<
%.fbi: %.bin
@echo " MSCIMG " $@ && $(PYTHON) -m misoc.tools.mkmscimg -f -o $@ $<