upgrade to latest rocket-chip

This commit is contained in:
Howard Mao
2017-05-25 10:42:19 -07:00
parent a123d82677
commit 062d443863
15 changed files with 112 additions and 100 deletions

View File

@@ -7,10 +7,13 @@ OBJDUMP=riscv64-unknown-elf-objdump
all: $(bootrom_img)
%.img: %.elf
$(OBJCOPY) -O binary --change-addresses=-0x1000 --only-section .text $< $@
$(OBJCOPY) -O binary --change-addresses=-0x10000 $< $@
%.elf: %.S linker.ld
$(GCC) -Tlinker.ld $< -nostdlib -static -o $@
%.dump: %.elf
$(OBJDUMP) -d $< > $@
clean:
rm -f *.elf *.dump *.img

View File

@@ -1,20 +1,23 @@
.text
.global _start
#define DRAM_BASE 0x80000000
.section .text.start, "ax", @progbits
.globl _start
_start:
csrr a0, mhartid
sll a0, a0, 2 // offset for hart msip
li a1, 0x2000000 // base address of clint
add a0, a0, a1
sw zero, 0(a0) // clear the interrupt
li a0, DRAM_BASE // program reset vector
csrw mepc, a0 // return from interrupt to start of user program
mret
.section .text.hang, "ax", @progbits
.globl _hang
_hang:
// This boot ROM doesn't know about any boot devices, so it just spins,
// waiting for the serial interface to load the program and interrupt it
j setup_wfi_loop // reset vector
.word 0 // reserved
.word 0 // reserved
.word 0 // pointer to config string
default_trap_vec:
j boot_trap // default trap vector
.word 0
.word 0
.word 0
setup_wfi_loop:
la a0, default_trap_vec
la a0, _start
csrw mtvec, a0
li a0, 8 // MIE or MSIP bit
csrw mie, a0 // set only MSIP in mie CSR
@@ -23,13 +26,3 @@ setup_wfi_loop:
wfi_loop:
wfi
j wfi_loop
boot_trap:
csrr a0, mhartid
sll a0, a0, 2 // offset for hart msip
li a1, 0x2000000 // base address of clint
add a0, a0, a1
sw zero, 0(a0) // clear the interrupt
li a0, 0x80000000 // program reset vector
csrw mepc, a0 // return from interrupt to start of user program
mret

Binary file not shown.

View File

@@ -1,5 +1,9 @@
SECTIONS
{
. = 0x1000;
.text : { *(.text) }
ROM_BASE = 0x10000; /* ... but actually position independent */
. = ROM_BASE;
.text.start : { *(.text.start) }
. = ROM_BASE + 0x40;
.text.hang : { *(.text.hang) }
}