mips32-npc loader scripts

This commit is contained in:
Yanyan Jiang 2017-05-31 05:16:45 -04:00
parent 067f633b42
commit 059e534d0a
4 changed files with 31 additions and 29 deletions

View File

@ -1,2 +1,4 @@
start.o: start.S start.o: start.S
mips-linux-gnu-gcc -EL -march=mips32 -fno-pic -MMD -mno-abicalls -fno-delayed-branch -c start.S -o start.o mips-linux-gnu-gcc -I$(AM_HOME)/am/arch/mips32-npc/include -EL -march=mips32 -fno-pic -MMD -mno-abicalls -fno-delayed-branch -c start.S -o start.o
-include start.d

View File

@ -1,13 +1,15 @@
.section loader, "x"
.globl _start .globl _start
.type _start, @function .type _start, @function
.globl _qemu .globl _ex_entry
.type _qemu, @function .type _ex_entry, @function
.extern _trm_init
_start: _start:
li $sp, 0x17fffffc li $sp, 0x17fffffc
jal _trm_init la $k0, _trm_init
jr $k0
_qemu: .org 0x20
nop _ex_entry:
jal _trm_init la $k0, _trap
jr $k0

View File

@ -6,13 +6,9 @@ shift
bash -c "cd $DIR/boot && make" bash -c "cd $DIR/boot && make"
mips-linux-gnu-ld -EL -T $DIR/loader.ld -e _start -o ${DEST}.o $DIR/boot/start.o --start-group $@ --end-group mips-linux-gnu-ld -EL -T $DIR/loader.ld -e _start -o ${DEST}.o $DIR/boot/start.o --start-group $@ --end-group && \
mips-linux-gnu-objdump -d ${DEST}.o > ${DEST}.code.txt && \
# generate COE mips-linux-gnu-objcopy -O binary ${DEST}.o ${DEST}.bin && \
mips-linux-gnu-objdump -d ${DEST}.o > ${DEST}.code.txt python $DIR/scripts/gen_bram_coe.py ${DEST}.bin ${DEST}.coe && \
mips-linux-gnu-objcopy -O binary ${DEST}.o ${DEST}.bin
python $DIR/scripts/gen_bram_coe.py ${DEST}.bin ${DEST}.coe
# check instructions
mips-linux-gnu-objdump -d ${DEST}.o | python $DIR/scripts/instr_check.py mips-linux-gnu-objdump -d ${DEST}.o | python $DIR/scripts/instr_check.py

View File

@ -1,13 +1,15 @@
SECTIONS MEMORY {
{ bram : ORIGIN = 0x0, LENGTH = 8K
. = 0x10000000; ddr : ORIGIN = 0x10000000, LENGTH = 128M
.text : { *(.text) } }
.data : { *(.data) }
__bss_start = . ; SECTIONS {
.bss : { loader : { *(loader) } > bram
*(.bss) .text : { *(.text) } > ddr
*(.scommon) .data : { *(.data) } > ddr
*(.sbss) .bss : {
} __bss_start = .;
_end = . ; *(.bss)
} _end = . ;
} > ddr
}