Switch ok with debug mode apps, implement sys_exit correctly later.

This commit is contained in:
Yifan Wu 2020-11-29 01:31:36 +08:00
parent e552f3cfca
commit 91043b08cd
16 changed files with 244 additions and 147 deletions

View file

@ -1,5 +1,5 @@
TARGET := riscv64gc-unknown-none-elf
MODE := release
MODE := debug
APP_DIR := src/bin
TARGET_DIR := target/$(TARGET)/$(MODE)
APPS := $(wildcard $(APP_DIR)/*.rs)
@ -9,7 +9,7 @@ BINS := $(patsubst $(APP_DIR)/%.rs, $(TARGET_DIR)/%.bin, $(APPS))
OBJDUMP := rust-objdump --arch-name=riscv64
OBJCOPY := rust-objcopy --binary-architecture=riscv64
elf:
elf: $(APPS)
@python3 build.py
binary: elf

View file

@ -1,6 +1,6 @@
import os
base_address = 0x80040000
base_address = 0x80100000
step = 0x20000
linker = 'src/linker.ld'
@ -18,7 +18,7 @@ for app in apps:
lines.append(line)
with open(linker, 'w+') as f:
f.writelines(lines)
os.system('cargo build --bin %s --release' % app)
os.system('cargo build --bin %s' % app)
print('[build.py] application %s start with address %s' %(app, hex(base_address+step*app_id)))
with open(linker, 'w+') as f:
f.writelines(lines_before)

View file

@ -2,7 +2,7 @@
OUTPUT_ARCH(riscv)
ENTRY(_start)
BASE_ADDRESS = 0x80040000;
BASE_ADDRESS = 0x80100000;
SECTIONS
{