Updates to Freedom SoCs
This commit is contained in:
committed by
Yunsup Lee
parent
f4375c2266
commit
ec70d85cbc
45
bootrom/xip/Makefile
Normal file
45
bootrom/xip/Makefile
Normal file
@ -0,0 +1,45 @@
|
||||
# RISCV environment variable must be set
|
||||
|
||||
CC=$(RISCV)/bin/riscv64-unknown-elf-gcc
|
||||
OBJCOPY=$(RISCV)/bin/riscv64-unknown-elf-objcopy
|
||||
CFLAGS=-march=rv32imac -mabi=ilp32 -O2 -std=gnu11 -Wall -I. -nostartfiles -fno-common -g
|
||||
LFLAGS=-static -nostdlib
|
||||
|
||||
dtb := $(BUILD_DIR)/$(CONFIG).dtb
|
||||
$(dtb): $(BUILD_DIR)/$(CONFIG).dts
|
||||
dtc -I dts -O dtb -o $@ $<
|
||||
|
||||
.PHONY: dtb
|
||||
dtb: $(dtb)
|
||||
|
||||
elf := $(BUILD_DIR)/xip.elf
|
||||
$(elf): xip.S $(dtb)
|
||||
$(CC) $(CFLAGS) -DXIP_TARGET_ADDR=0x20400000 -DDEVICE_TREE='"$(dtb)"' $(LFLAGS) -o $@ $<
|
||||
|
||||
.PHONY: elf
|
||||
elf: $(elf)
|
||||
|
||||
bin := $(BUILD_DIR)/xip.bin
|
||||
$(bin): $(elf)
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
||||
.PHONY: bin
|
||||
bin: $(bin)
|
||||
|
||||
hex := $(BUILD_DIR)/xip.hex
|
||||
$(hex): $(bin)
|
||||
od -t x4 -An -w4 -v $< > $@
|
||||
|
||||
.PHONY: hex
|
||||
hex: $(hex)
|
||||
|
||||
romgen := $(BUILD_DIR)/rom.v
|
||||
$(romgen): $(hex)
|
||||
$(rocketchip_dir)/scripts/vlsi_rom_gen $(ROMCONF) $< > $@
|
||||
|
||||
.PHONY: romgen
|
||||
romgen: $(romgen)
|
||||
|
||||
.PHONY: clean
|
||||
clean::
|
||||
rm -rf $(hex) $(elf)
|
@ -2,25 +2,15 @@
|
||||
// Execute in place
|
||||
// Jump directly to XIP_TARGET_ADDR
|
||||
|
||||
.text
|
||||
.section .text.init
|
||||
.option norvc
|
||||
.globl _start
|
||||
_start:
|
||||
j 1f
|
||||
nop
|
||||
nop
|
||||
#ifdef CONFIG_STRING
|
||||
.word cfg_string
|
||||
#else
|
||||
.word 0 // Filled in by GenerateBootROM in Chisel
|
||||
#endif
|
||||
|
||||
1:
|
||||
csrr a0, mhartid
|
||||
la a1, dtb
|
||||
li t0, XIP_TARGET_ADDR
|
||||
jr t0
|
||||
|
||||
.section .rodata
|
||||
#ifdef CONFIG_STRING
|
||||
cfg_string:
|
||||
.incbin CONFIG_STRING
|
||||
#endif
|
||||
dtb:
|
||||
.incbin DEVICE_TREE
|
||||
|
Reference in New Issue
Block a user