1
0

generate BootROM contents from assembly code

This commit is contained in:
Howard Mao
2016-08-05 11:07:42 -07:00
parent dab96096b4
commit dd1fed41b6
11 changed files with 49 additions and 19 deletions

1
bootrom/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.elf

12
bootrom/Makefile Normal file
View File

@ -0,0 +1,12 @@
bootrom_img = bootrom.img
GCC=riscv64-unknown-elf-gcc
OBJCOPY=riscv64-unknown-elf-objcopy
all: $(bootrom_img)
%.img: %.elf
$(OBJCOPY) -O binary --change-addresses=-0x1000 --only-section .text $< $@
%.elf: %.S linker.ld
$(GCC) -Tlinker.ld $< -nostdlib -static -o $@

13
bootrom/bootrom.S Normal file
View File

@ -0,0 +1,13 @@
.text
.global _start
_start:
// This boot ROM doesn't know about any boot devices, so it just spins,
// waiting for the debugger to load a program and change the PC.
j _start // reset vector
.word 0 // reserved
.word 0 // reserved
.word 0 // pointer to config string
.word 0 // default trap vector
.word 0
.word 0
.word 0

BIN
bootrom/bootrom.img Executable file

Binary file not shown.

5
bootrom/linker.ld Normal file
View File

@ -0,0 +1,5 @@
SECTIONS
{
. = 0x1000;
.text : { *(.text) }
}