generate BootROM contents from assembly code
This commit is contained in:
1
bootrom/.gitignore
vendored
Normal file
1
bootrom/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.elf
|
12
bootrom/Makefile
Normal file
12
bootrom/Makefile
Normal 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
13
bootrom/bootrom.S
Normal 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
BIN
bootrom/bootrom.img
Executable file
Binary file not shown.
5
bootrom/linker.ld
Normal file
5
bootrom/linker.ld
Normal file
@ -0,0 +1,5 @@
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x1000;
|
||||
.text : { *(.text) }
|
||||
}
|
Reference in New Issue
Block a user