2017-02-03 20:53:25 +08:00
|
|
|
include ../include/generated/variables.mak
|
|
|
|
include $(MISOC_DIRECTORY)/software/common.mak
|
|
|
|
|
2017-12-26 01:55:20 +08:00
|
|
|
CFLAGS += \
|
|
|
|
-I$(LIBUNWIND_DIRECTORY) \
|
2017-12-28 07:04:40 +08:00
|
|
|
-I$(LIBUNWIND_DIRECTORY)/../unwinder/include
|
2017-12-26 01:55:20 +08:00
|
|
|
|
2017-12-28 10:20:08 +08:00
|
|
|
LDFLAGS += \
|
2017-12-26 01:55:20 +08:00
|
|
|
-L../libunwind
|
2017-02-03 20:53:25 +08:00
|
|
|
|
2018-01-27 07:01:24 +08:00
|
|
|
RUSTFLAGS += -Cpanic=unwind
|
2017-02-03 20:53:25 +08:00
|
|
|
|
2021-09-01 17:45:27 +08:00
|
|
|
export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot
|
|
|
|
|
2017-12-28 07:04:40 +08:00
|
|
|
all:: runtime.bin runtime.fbi
|
2017-02-03 20:53:25 +08:00
|
|
|
|
|
|
|
.PHONY: $(RUSTOUT)/libruntime.a
|
|
|
|
$(RUSTOUT)/libruntime.a:
|
2021-09-01 17:45:27 +08:00
|
|
|
$(cargo) --target-dir ./cargo \
|
|
|
|
--manifest-path $(RUNTIME_DIRECTORY)/Cargo.toml \
|
2021-11-08 12:57:13 +08:00
|
|
|
--target $(RUNTIME_DIRECTORY)/../$(CARGO_TRIPLE).json
|
2017-02-03 20:53:25 +08:00
|
|
|
|
2017-12-26 04:30:13 +08:00
|
|
|
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
|
2017-12-28 07:04:40 +08:00
|
|
|
$(link) -T $(RUNTIME_DIRECTORY)/runtime.ld \
|
2021-08-17 11:42:04 +08:00
|
|
|
-lunwind-bare -m elf32lriscv
|
2017-02-03 20:53:25 +08:00
|
|
|
|
|
|
|
ksupport_data.o: ../ksupport/ksupport.elf
|
2021-08-17 11:42:04 +08:00
|
|
|
$(LD) -r -m elf32lriscv -b binary -o $@ $<
|
2017-02-03 20:53:25 +08:00
|
|
|
|
|
|
|
%.bin: %.elf
|
2017-12-28 07:04:40 +08:00
|
|
|
$(objcopy) -O binary
|
2017-02-03 20:53:25 +08:00
|
|
|
|
|
|
|
%.fbi: %.bin
|
2021-08-06 11:12:27 +08:00
|
|
|
$(mscimg) -f --little
|