commit
5e3221cee5
|
@ -10,6 +10,8 @@ ARCHIVE ?= $(LIB_DIR)/build/$(NAME)-$(ARCH).a
|
|||
|
||||
INC_DIR += $(addsuffix /include/, $(addprefix $(AM_HOME)/libs/, $(LIBS)))
|
||||
|
||||
CFLAGS += -fdata-sections -ffunction-sections
|
||||
|
||||
$(shell mkdir -p $(DST_DIR))
|
||||
|
||||
include $(AM_HOME)/Makefile.compile
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
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-minimal/include -EL -march=mips32 -fno-pic -MMD -mno-abicalls -fno-delayed-branch -c start.S -o start.o
|
||||
|
||||
-include start.d
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
#include <npc.h>
|
||||
|
||||
.globl _start
|
||||
.type _start, @function
|
||||
|
||||
.type _start, function
|
||||
.globl _ex_entry
|
||||
.type _ex_entry, function
|
||||
|
||||
_start:
|
||||
la $sp, _stack_pointer
|
||||
j _trm_init
|
||||
|
||||
.org EX_ENTRY
|
||||
_ex_entry:
|
||||
j _trap
|
||||
|
|
|
@ -6,4 +6,4 @@ shift
|
|||
|
||||
bash -c "cd $DIR/boot && make"
|
||||
|
||||
mips-linux-gnu-ld -EL -T $DIR/loader.ld -e _start -o $DEST $DIR/boot/start.o --start-group $@ --end-group && python $DIR/gen_coe.py $DEST
|
||||
mips-linux-gnu-ld --gc-sections -EL -T $DIR/loader.ld -e _start -o $DEST $DIR/boot/start.o $@ && python $DIR/gen_coe.py $DEST
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef __NPC_H__
|
||||
#define __NPC_H__
|
||||
|
||||
#include <arch.h>
|
||||
|
||||
#define EX_ENTRY 0x20
|
||||
#define SERIAL_PORT ((volatile char *)0x40001000)
|
||||
#define Rx 0x0
|
||||
#define Tx 0x04
|
||||
|
@ -11,6 +10,10 @@
|
|||
#define GPIO_TRAP ((volatile char *)0x40000000)
|
||||
#define HZ 50000000
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <arch.h>
|
||||
|
||||
struct TrapFrame{
|
||||
u32 at,
|
||||
v0,v1,
|
||||
|
@ -23,3 +26,5 @@ struct TrapFrame{
|
|||
void serial_init();
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
.globl _trap
|
||||
.type _trap function
|
||||
_trap:
|
||||
j _trap
|
|
@ -1,2 +1,4 @@
|
|||
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
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
.section loader, "x"
|
||||
.globl _start
|
||||
.type _start, @function
|
||||
.globl _qemu
|
||||
.type _qemu, @function
|
||||
.extern _trm_init
|
||||
.globl _ex_entry
|
||||
.type _ex_entry, @function
|
||||
|
||||
_start:
|
||||
li $sp, 0x17fffffc
|
||||
jal _trm_init
|
||||
la $k0, _trm_init
|
||||
jr $k0
|
||||
|
||||
_qemu:
|
||||
nop
|
||||
jal _trm_init
|
||||
.org 0x20
|
||||
_ex_entry:
|
||||
la $k0, _trap
|
||||
jr $k0
|
||||
|
|
|
@ -6,13 +6,9 @@ shift
|
|||
|
||||
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
|
||||
|
||||
# generate COE
|
||||
mips-linux-gnu-objdump -d ${DEST}.o > ${DEST}.code.txt
|
||||
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-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 && \
|
||||
mips-linux-gnu-objcopy -O binary ${DEST}.o ${DEST}.bin && \
|
||||
python $DIR/scripts/gen_bram_coe.py ${DEST}.bin ${DEST}.coe && \
|
||||
mips-linux-gnu-objdump -d ${DEST}.o | python $DIR/scripts/instr_check.py
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
SECTIONS
|
||||
{
|
||||
. = 0x10000000;
|
||||
.text : { *(.text) }
|
||||
.data : { *(.data) }
|
||||
__bss_start = . ;
|
||||
.bss : {
|
||||
*(.bss)
|
||||
*(.scommon)
|
||||
*(.sbss)
|
||||
}
|
||||
_end = . ;
|
||||
}
|
||||
MEMORY {
|
||||
bram : ORIGIN = 0x0, LENGTH = 8K
|
||||
ddr : ORIGIN = 0x10000000, LENGTH = 128M
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
loader : { *(loader) } > bram
|
||||
.text : { *(.text) } > ddr
|
||||
.data : { *(.data) } > ddr
|
||||
.bss : {
|
||||
__bss_start = .;
|
||||
*(.bss)
|
||||
_end = . ;
|
||||
} > ddr
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue