parent
9aba174156
commit
6aa5f18429
|
@ -0,0 +1,6 @@
|
|||
# Object files
|
||||
*.o
|
||||
*.bin
|
||||
*.elf
|
||||
*.mem
|
||||
*.dump
|
|
@ -0,0 +1,19 @@
|
|||
target := bootrom
|
||||
|
||||
BIN2MEM := ../BinToMem.py
|
||||
|
||||
RISCV_TOOLS_PATH := /opt/riscv32/bin
|
||||
RISCV_TOOLS_PREFIX := riscv32-unknown-elf-
|
||||
|
||||
GCC?=$(abspath $(RISCV_TOOLS_PATH)/$(RISCV_TOOLS_PREFIX)gcc)
|
||||
OBJCOPY?=$(abspath $(RISCV_TOOLS_PATH)/$(RISCV_TOOLS_PREFIX)objcopy)
|
||||
OBJDUMP?=$(abspath $(RISCV_TOOLS_PATH)/$(RISCV_TOOLS_PREFIX)objdump)
|
||||
|
||||
all:
|
||||
$(GCC) -Tlink.ld bootrom.S -march=rv32im -mabi=ilp32 -mcmodel=medlow -nostartfiles -nostdlib -static -Wl,--no-gc-sections -o $(target).elf
|
||||
$(OBJCOPY) -O binary $(target).elf $(target).bin
|
||||
$(OBJDUMP) -d $(target).elf --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.text.init --section=.data > $(target).dump
|
||||
$(BIN2MEM) $(target).bin $(target).mem
|
||||
|
||||
clean:
|
||||
rm -f *.img *.dump *.bin *.sv *.elf *.mem
|
|
@ -0,0 +1,10 @@
|
|||
Bootrom源码。
|
||||
|
||||
当从外部Flash启动时,需要先从此Bootrom启动(做一些初始化操作),然后通过Bootrom跳转到Flash地址空间,执行用户程序。
|
||||
|
||||
编译:
|
||||
|
||||
```
|
||||
make
|
||||
```
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
.global entry
|
||||
.option norvc
|
||||
entry:
|
||||
lui a0, 0x0200
|
||||
slli a0, a0, 0x4
|
||||
// jump to 0x02000000
|
||||
jalr a0
|
||||
loop:
|
||||
j loop
|
|
@ -0,0 +1,11 @@
|
|||
OUTPUT_ARCH( "riscv" )
|
||||
ENTRY( entry )
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x01000000;
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
_end = .;
|
||||
}
|
Loading…
Reference in New Issue