mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-24 19:04:02 +08:00
firmware: migrate last vestiges of the old runtime build system.
This commit is contained in:
parent
cde2054926
commit
b9cbedceb1
@ -1,4 +1,3 @@
|
||||
graft artiq/runtime
|
||||
graft artiq/firmware
|
||||
graft artiq/examples
|
||||
include artiq/gui/logo*.svg
|
||||
|
37
artiq/firmware/ksupport/Makefile
Normal file
37
artiq/firmware/ksupport/Makefile
Normal file
@ -0,0 +1,37 @@
|
||||
include ../include/generated/variables.mak
|
||||
include $(MISOC_DIRECTORY)/software/common.mak
|
||||
|
||||
CFLAGS += \
|
||||
-I$(LIBUNWIND_DIRECTORY) \
|
||||
-I$(LIBUNWIND_DIRECTORY)/../unwinder/include \
|
||||
-I$(MISOC_DIRECTORY)/software/include/dyld
|
||||
CFLAGS += -DNDEBUG
|
||||
|
||||
LDFLAGS += --eh-frame-hdr \
|
||||
-L../libcompiler-rt \
|
||||
-L../libbase \
|
||||
-L../libm \
|
||||
-L../libunwind \
|
||||
-L../libdyld
|
||||
|
||||
RUSTFLAGS += -Cpanic=unwind
|
||||
|
||||
all: ksupport.elf
|
||||
|
||||
.PHONY: $(RUSTOUT)/libksupport.a
|
||||
$(RUSTOUT)/libksupport.a:
|
||||
$(cargo) --manifest-path $(KSUPPORT_DIRECTORY)/Cargo.toml
|
||||
|
||||
ksupport.elf: $(RUSTOUT)/libksupport.a glue.o artiq_personality.o
|
||||
$(LD) $(LDFLAGS) -T $(KSUPPORT_DIRECTORY)/ksupport.ld -o $@ $^ \
|
||||
-lbase -lm -lcompiler-rt -ldyld -lunwind
|
||||
@chmod -x $@
|
||||
|
||||
%.o: $(KSUPPORT_DIRECTORY)/%.c
|
||||
$(compile)
|
||||
|
||||
clean:
|
||||
$(RM) *.o ksupport.elf
|
||||
$(RM) -rf cargo
|
||||
|
||||
.PHONY: all clean
|
32
artiq/firmware/runtime/Makefile
Normal file
32
artiq/firmware/runtime/Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
include ../include/generated/variables.mak
|
||||
include $(MISOC_DIRECTORY)/software/common.mak
|
||||
|
||||
LDFLAGS += -L../libbase
|
||||
|
||||
RUSTFLAGS += -Cpanic=abort
|
||||
|
||||
all: runtime.bin runtime.fbi
|
||||
|
||||
.PHONY: $(RUSTOUT)/libruntime.a
|
||||
$(RUSTOUT)/libruntime.a:
|
||||
$(cargo) --manifest-path $(RUNTIME_DIRECTORY)/Cargo.toml
|
||||
|
||||
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
|
||||
$(LD) $(LDFLAGS) -T $(RUNTIME_DIRECTORY)/runtime.ld -o $@ $^
|
||||
@chmod -x $@
|
||||
|
||||
ksupport_data.o: ../ksupport/ksupport.elf
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
@chmod -x $@
|
||||
|
||||
%.fbi: %.bin
|
||||
@echo " MSCIMG " $@ && $(PYTHON) -m misoc.tools.mkmscimg -f -o $@ $<
|
||||
|
||||
clean:
|
||||
$(RM) *.o runtime.elf runtime.bin runtime.fbi
|
||||
$(RM) -rf cargo
|
||||
|
||||
.PHONY: all clean
|
@ -13,11 +13,11 @@ pub unsafe fn start() {
|
||||
stop();
|
||||
|
||||
extern {
|
||||
static _binary_ksupport_elf_start: u8;
|
||||
static _binary_ksupport_elf_end: u8;
|
||||
static _binary____ksupport_ksupport_elf_start: u8;
|
||||
static _binary____ksupport_ksupport_elf_end: u8;
|
||||
}
|
||||
let ksupport_start = &_binary_ksupport_elf_start as *const _;
|
||||
let ksupport_end = &_binary_ksupport_elf_end as *const _;
|
||||
let ksupport_start = &_binary____ksupport_ksupport_elf_start as *const _;
|
||||
let ksupport_end = &_binary____ksupport_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);
|
||||
|
@ -48,5 +48,6 @@ def build_artiq_soc(soc, argdict):
|
||||
builder.add_software_package("libm")
|
||||
builder.add_software_package("libdyld")
|
||||
builder.add_software_package("libunwind")
|
||||
builder.add_software_package("runtime", os.path.join(artiq_dir, "runtime"))
|
||||
builder.add_software_package("ksupport", os.path.join(artiq_dir, "firmware", "ksupport"))
|
||||
builder.add_software_package("runtime", os.path.join(artiq_dir, "firmware", "runtime"))
|
||||
builder.build()
|
||||
|
@ -1,86 +0,0 @@
|
||||
include ../include/generated/variables.mak
|
||||
include $(MISOC_DIRECTORY)/software/common.mak
|
||||
|
||||
PYTHON ?= python3
|
||||
|
||||
CARGO_normal := env
|
||||
CARGO_quiet = @echo " CARGO " $@ && $(CARGO_normal)
|
||||
|
||||
ifeq ($(V),1)
|
||||
CARGO = $(CARGO_normal)
|
||||
else
|
||||
CARGO = $(CARGO_quiet)
|
||||
endif
|
||||
|
||||
RUSTOUT := cargo/or1k-unknown-none/debug
|
||||
RUSTOUT_KSUPPORT := cargo-ksupport/or1k-unknown-none/debug
|
||||
|
||||
CFLAGS += \
|
||||
-I$(LIBUNWIND_DIRECTORY) \
|
||||
-I$(LIBUNWIND_DIRECTORY)/../unwinder/include \
|
||||
-I$(MISOC_DIRECTORY)/software/include/dyld
|
||||
CFLAGS += -DNDEBUG
|
||||
|
||||
LDFLAGS += --gc-sections \
|
||||
-L../libcompiler-rt \
|
||||
-L../libbase \
|
||||
-L../libm \
|
||||
-L../libunwind \
|
||||
-L../libdyld
|
||||
|
||||
RUSTFLAGS = \
|
||||
-C target-feature=+mul,+div,+ffl1,+cmov,+addc \
|
||||
-C relocation-model=static \
|
||||
-C opt-level=s \
|
||||
-C panic=abort
|
||||
export RUSTFLAGS
|
||||
|
||||
all: runtime.bin runtime.fbi
|
||||
|
||||
.PHONY: $(RUSTOUT)/libruntime.a
|
||||
$(RUSTOUT)/libruntime.a:
|
||||
$(CARGO) \
|
||||
CARGO_TARGET_DIR=$(realpath .)/cargo \
|
||||
cargo build --target=or1k-unknown-none \
|
||||
--manifest-path $(realpath $(RUNTIME_DIRECTORY)/../firmware/runtime/Cargo.toml)
|
||||
|
||||
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
|
||||
$(LD) $(LDFLAGS) -T $(RUNTIME_DIRECTORY)/runtime.ld -o $@ $^
|
||||
@chmod -x $@
|
||||
|
||||
.PHONY: $(RUSTOUT_KSUPPORT)/libksupport.a
|
||||
$(RUSTOUT_KSUPPORT)/libksupport.a:
|
||||
$(CARGO) \
|
||||
CARGO_TARGET_DIR=$(realpath .)/cargo-ksupport \
|
||||
cargo build --target=or1k-unknown-none \
|
||||
--manifest-path $(realpath $(RUNTIME_DIRECTORY)/../firmware/ksupport/Cargo.toml)
|
||||
|
||||
ksupport.elf: $(RUSTOUT_KSUPPORT)/libksupport.a ksupport_glue.o artiq_personality.o
|
||||
$(LD) $(LDFLAGS) \
|
||||
--eh-frame-hdr \
|
||||
-T $(RUNTIME_DIRECTORY)/ksupport.ld \
|
||||
-o $@ \
|
||||
$^ \
|
||||
-lbase -lm -lcompiler-rt -ldyld -lunwind
|
||||
@chmod -x $@
|
||||
|
||||
%.o: $(RUNTIME_DIRECTORY)/%.c
|
||||
$(compile)
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
@chmod -x $@
|
||||
|
||||
%_data.o: %.elf
|
||||
$(LD) -r -b binary -o $@ $<
|
||||
|
||||
%.fbi: %.bin
|
||||
@echo " MSCIMG " $@ && $(PYTHON) -m misoc.tools.mkmscimg -f -o $@ $<
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJECTS) $(OBJECTS_KSUPPORT)
|
||||
$(RM) runtime.elf runtime.bin runtime.fbi .*~ *~
|
||||
$(RM) ksupport.elf ksupport.bin
|
||||
$(RM) -rf cargo
|
||||
|
||||
.PHONY: all clean
|
@ -1,4 +1,4 @@
|
||||
CC ?= clang
|
||||
|
||||
libartiq_support.so: ../../runtime/artiq_personality.c artiq_terminate.c artiq_time.c
|
||||
$(CC) -std=c99 -Wall -Werror -I. -I../../runtime -g -fPIC -shared -o $@ $^
|
||||
libartiq_support.so: ../../firmware/ksupport/artiq_personality.c artiq_terminate.c artiq_time.c
|
||||
$(CC) -std=c99 -Wall -Werror -I. -I../../firmware/ksupport -g -fPIC -shared -o $@ $^
|
||||
|
@ -15,7 +15,7 @@ requirements:
|
||||
- python 3.5.2
|
||||
- setuptools
|
||||
- migen 0.5.dev py_54+git58e8f45
|
||||
- misoc 0.6.dev py_2+git02884fe
|
||||
- misoc 0.6.dev py_4+git40e9940
|
||||
- jesd204b 0.2
|
||||
- binutils-or1k-linux >=2.27
|
||||
- llvm-or1k
|
||||
|
Loading…
Reference in New Issue
Block a user