1
0
mirror of https://github.com/antonblanchard/microwatt.git synced 2026-04-26 04:17:22 +00:00

rust_lib_demo: Use common console code

Use a symlink to share the console code in hello_world. Not ideal,
but we can improve on it later.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
This commit is contained in:
Anton Blanchard
2020-04-16 17:14:18 +10:00
committed by Anton Blanchard
parent c37a4c16db
commit 90ed7adf58
4 changed files with 12 additions and 139 deletions

View File

@@ -1,15 +1,15 @@
ARCH = $(shell uname -m)
ifneq ("$(ARCH)", "ppc64")
ifneq ("$(ARCH)", "ppc64le")
CROSS_COMPILE = powerpc64le-linux-gnu-
endif
endif
CROSS_COMPILE ?= powerpc64le-linux-
endif
endif
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy
CFLAGS = -Os -g -Wall -std=c99 -msoft-float -mno-string -mno-multiple -mno-vsx -mno-altivec -mlittle-endian -fno-stack-protector -mstrict-align -ffreestanding -fdata-sections -ffunction-sections
CFLAGS = -Os -g -Wall -std=c99 -msoft-float -mno-string -mno-multiple -mno-vsx -mno-altivec -mlittle-endian -fno-stack-protector -mstrict-align -ffreestanding -fdata-sections -ffunction-sections
ASFLAGS = $(CFLAGS)
LDFLAGS = -T powerpc.lds
@@ -20,7 +20,7 @@ all: hello_world.hex
run:
-ln -sf hello_world.bin main_ram.bin
../core_tb > /dev/null
$(RUSTLIB): src/lib.rs
RUSTFLAGS="-C target-feature=-vsx,-altivec,-hard-float" xargo build --release
@@ -30,14 +30,14 @@ size:
dump:
powerpc64le-linux-gnu-objdump -S hello_world.elf | less
hello_world.elf: hello_world.o head.o $(RUSTLIB)
$(LD) $(LDFLAGS) -o hello_world.elf hello_world.o head.o $(RUSTLIB)
hello_world.elf: hello_world.o console.o head.o $(RUSTLIB)
$(LD) $(LDFLAGS) -o $@ $^
hello_world.bin: hello_world.elf
$(OBJCOPY) -O binary hello_world.elf hello_world.bin
$(OBJCOPY) -O binary $^ $@
hello_world.hex: hello_world.bin
./bin2hex.py hello_world.bin > hello_world.hex
../scripts/bin2hex.py $^ > $@
clean:
cargo clean