update rv64 build script. print hello on QEMU!

toolchain_update
WangRunji 6 years ago
parent d3ef0252ac
commit 45b91fbcad

@ -14,6 +14,7 @@ then
fi fi
# CONFIGURATIONS # CONFIGURATIONS
export LOG=info
export LLC=$PWD/../tools/llc export LLC=$PWD/../tools/llc
export LLC_ARCH=riscv64 export LLC_ARCH=riscv64
export RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust/src export RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust/src
@ -452,7 +453,7 @@ fi
CNAME=riscv CNAME=riscv
if ! [[ -f outdir/${CNAME}.o ]] if ! [[ -f outdir/${CNAME}.o ]]
then then
rustc --crate-name riscv $CARGO_PATH/git/checkouts/riscv-1e845b622ce46f1d/1f59ef7*/src/lib.rs \ rustc --crate-name riscv ../crate/riscv/src/lib.rs \
--color always --crate-type lib --emit=metadata,llvm-bc \ --color always --crate-type lib --emit=metadata,llvm-bc \
-C opt-level=1 \ -C opt-level=1 \
-C debuginfo=2 \ -C debuginfo=2 \
@ -471,7 +472,7 @@ fi
# Hand generate build.rs # Hand generate build.rs
if ! [[ -f outdir/libatomic_rt.a ]] if ! [[ -f outdir/libatomic_rt.a ]]
then then
${CC} src/arch/riscv32/compiler_rt.c -march=rv64ia -mabi=lp64 -c -o outdir/compiler_rt.o ${CC} src/arch/riscv32/compiler_rt.c -march=rv64ia -mabi=lp64 -O3 -c -o outdir/compiler_rt.o
${AR} r outdir/libatomic_rt.a outdir/compiler_rt.o ${AR} r outdir/libatomic_rt.a outdir/compiler_rt.o
fi fi
@ -496,13 +497,15 @@ fi
CNAME=ucore CNAME=ucore
#if ! [[ -f outdir/${CNAME}.o ]] #if ! [[ -f outdir/${CNAME}.o ]]
#then #then
if [[ ${K210} = 1 ]]; then
export UCORE_FEATURE_ARGS='--cfg feature="m_mode" --cfg feature="board_k210"'
fi
rustc --edition=2018 --crate-name ucore src/lib.rs \ rustc --edition=2018 --crate-name ucore src/lib.rs \
--color always --crate-type lib --emit=metadata,llvm-bc \ --color always --crate-type lib --emit=metadata,llvm-bc \
-C opt-level=1 \ -C opt-level=1 \
-C debuginfo=2 \ -C debuginfo=2 \
-C debug-assertions=on \ -C debug-assertions=on \
--cfg 'feature="m_mode"' \ ${UCORE_FEATURE_ARGS} \
--cfg 'feature="board_k210"' \
--out-dir $PWD/outdir \ --out-dir $PWD/outdir \
--target $TARGET_JSON \ --target $TARGET_JSON \
-L $PWD/outdir \ -L $PWD/outdir \
@ -557,22 +560,18 @@ rustc --edition=2018 --crate-name ucore src/main.rs \
-L native=outdir -L native=outdir
#fi #fi
${OBJCOPY} outdir/ucore --strip-all -O binary outdir/ucore.bin if [[ ${K210} = 1 ]]; then
${OBJCOPY} outdir/ucore --strip-all -O binary outdir/ucore.bin
#cd ../riscv-pk && mkdir -p build && cd build ${QEMU} -nographic -cpu sifive-e51 -machine sifive_e -kernel outdir/ucore -d in_asm 2> dump
# else
#../configure \ cd ../riscv-pk && mkdir -p build && cd build
# --with-arch=rv64imac \ ../configure \
# --disable-fp-emulation \ --with-arch=rv64imac \
# --host=riscv64-unknown-elf \ --disable-fp-emulation \
# --with-payload=../../kernel/outdir/ucore --host=riscv64-unknown-elf \
# --with-payload=../../kernel/outdir/ucore
#make make
cp bbl ../../kernel/outdir/kernel.bin
#cp bbl ../../kernel/outdir/kernel.bin cd ../../kernel
qemu-system-riscv64 -smp cores=4 -nographic -machine virt -kernel outdir/kernel.bin
#cd ../../kernel fi
#qemu-system-riscv64 -smp cores=4 -nographic -machine virt -kernel outdir/kernel.bin
${QEMU} -nographic -cpu sifive-e51 -machine sifive_e -kernel outdir/ucore -d in_asm 2> dump

@ -6,7 +6,7 @@
OUTPUT_ARCH(riscv) OUTPUT_ARCH(riscv)
ENTRY(_start) ENTRY(_start)
BASE_ADDRESS = 0x40000000; BASE_ADDRESS = 0xffffffff80020000;
SECTIONS SECTIONS
{ {
@ -16,7 +16,7 @@ SECTIONS
.text : { .text : {
stext = .; stext = .;
KEEP(*(.text.boot)) *(.text.entry)
*(.text .text.*) *(.text .text.*)
. = ALIGN(4K); . = ALIGN(4K);
etext = .; etext = .;

Loading…
Cancel
Save