1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 16:16:16 +04:00

move target json. add kflash.py

This commit is contained in:
WangRunji 2019-01-01 01:53:33 +08:00
parent 190711fbc2
commit e46b6c7b0c
7 changed files with 849 additions and 15 deletions

View File

@ -26,10 +26,11 @@ LOG ?= debug
smp ?= 4
m_mode ?=
target := $(arch)-blog_os
target := $(arch)
kernel := target/$(target)/$(mode)/ucore
bin := target/$(target)/$(mode)/kernel.bin
bootimage := target/$(target)/bootimage.bin
bbl_path := $(PWD)/../riscv-pk
user_dir := ../user
### export environments ###
@ -107,7 +108,7 @@ endif
ifneq ($(board), none)
features += board_$(board)
endif
build_args := --target $(target).json --features "$(features)"
build_args := --target targets/$(target).json --features "$(features)"
ifeq ($(mode), release)
build_args += --release
@ -142,7 +143,6 @@ all: kernel
clean:
@cargo clean
@cd $(user_dir) && make clean
@rm -rf ../riscv-pk/build
doc:
@cargo rustdoc -- --document-private-items
@ -170,32 +170,30 @@ sym:
$(bin): kernel
ifeq ($(arch), riscv32)
@cd ../riscv-pk && \
mkdir -p build && \
cd build && \
../configure \
@mkdir -p target/$(target)/bbl && \
cd target/$(target)/bbl && \
$(bbl_path)/configure \
$(bbl_m_mode) \
--with-arch=rv32imac \
--disable-fp-emulation \
--host=riscv64-unknown-elf \
--with-payload=$(abspath $(kernel)) && \
make -j32 && \
cp bbl ../../kernel/$@
cp bbl $(abspath $@)
else ifeq ($(arch), riscv64)
ifeq ($(board), k210)
@$(objcopy) $(kernel) --strip-all -O binary $@
else
@cd ../riscv-pk && \
mkdir -p build && \
cd build && \
../configure \
@mkdir -p target/$(target)/bbl && \
cd target/$(target)/bbl && \
$(bbl_path)/configure \
$(bbl_m_mode) \
--with-arch=rv64imac \
--disable-fp-emulation \
--host=riscv64-unknown-elf \
--with-payload=$(abspath $(kernel)) && \
make -j32 && \
cp bbl ../../kernel/$@
cp bbl $(abspath $@)
endif
else ifeq ($(arch), aarch64)
@$(objcopy) $(kernel) --strip-all -O binary $@
@ -239,3 +237,10 @@ install: $(bin)
endif
endif
ifeq ($(board), k210)
.PHONY:
install: $(bin)
## baudrate no more than 600000
@python3 ../tools/k210/kflash.py $(bin) -b 600000
endif

View File

@ -24,8 +24,8 @@ LLC=$PWD/../tools/llc
RUST_SRC_PATH=$(rustc --print sysroot)/lib/rustlib/src/rust/src
CARGO_PATH=~/.cargo
LLC_ARCH=${TARGET_ARCH}
OUTDIR=$PWD/target/${TARGET_ARCH}-blog_os/debug
TARGET_JSON=$PWD/${TARGET_ARCH}-blog_os.json
OUTDIR=$PWD/target/${TARGET_ARCH}/debug
TARGET_JSON=$PWD/targets/${TARGET_ARCH}.json
CC=${TARGET_ARCH}-unknown-elf-gcc
AR=${TARGET_ARCH}-unknown-elf-ar
OBJCOPY=${TARGET_ARCH}-unknown-elf-objcopy

829
tools/k210/kflash.py Normal file

File diff suppressed because one or more lines are too long