Permalink
Browse files

Func: add simple program or BootROM (refs freechipsproject#185)

  • Loading branch information...
Masayuki Kimura
Masayuki Kimura committed Jan 8, 2018
1 parent 4fd4ae3 commit 8ebcd9485c50c9cccd6032a9d663e2ef052302ec
View
@@ -0,0 +1,15 @@
simple_img = simple.img
GCC=riscv64-unknown-elf-gcc
OBJCOPY=riscv64-unknown-elf-objcopy
all: $(simple_img)
%.img: %.bin
dd if=$< of=$@ bs=128 count=1
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
%.elf: %.S linker.ld
$(GCC) -Tlinker.ld $< -nostdlib -static -Wl,--no-gc-sections -o $@
View
@@ -0,0 +1,11 @@
SECTIONS
{
ROM_BASE = 0x10000; /* ... but actually position independent */
. = ROM_BASE;
.text.start : { *(.text.start) }
. = ROM_BASE + 0x40;
.text.hang : { *(.text.hang) }
. = ROM_BASE + 0x80;
.rodata.dtb : { *(.rodata.dtb) }
}
View
@@ -0,0 +1,25 @@
#define DRAM_BASE 0x80000000
.section .text.start, "ax", @progbits
.globl _start
_start:
li s0, DRAM_BASE
csrr a0, mhartid
la a1, _dtb
jr s0
.section .text.hang, "ax", @progbits
.globl _hang
_hang:
li a0, 0x0abcd
li a1, 0x01234
add a2, a0, a1
1:
wfi
j 1b
.section .rodata.dtb, "a", @progbits
.globl _dtb
.align 5, 0
_dtb:
.ascii "DTB goes here"
View
Binary file not shown.
@@ -25,7 +25,7 @@ class BaseCoreplexConfig extends Config ((site, here, up) => {
case MemoryBusKey => MemoryBusParams(beatBytes = site(XLen)/8, blockBytes = site(CacheBlockBytes))
// Additional device Parameters
case ErrorParams => ErrorParams(Seq(AddressSet(0x3000, 0xfff)), maxAtomic=site(XLen)/8, maxTransfer=4096)
case BootROMParams => BootROMParams(contentFileName = "./bootrom/bootrom.img")
case BootROMParams => BootROMParams(contentFileName = "./program/simple/simple.img")
case DebugModuleParams => DefaultDebugModuleParams(site(XLen))
})

0 comments on commit 8ebcd94

Please sign in to comment.