Simulator configuration fragment.
add rom loadermem 0x1FC00000 loadermem generic 4K loadermem load "kernel/loader.bin"
Loader entry code fragment.
.globl __start .ent __start __start: la $ra, 0x80000400 ;hardcoded kernel entry address j $ra ;jump nop ;branch delay slot .end __start
Kernel entry code fragment.
.section .excvec, "ax" ;emit code into .execvec section ;flags say allocatable and executable .org 0x400 ;hardcoded kernel entry address .globl start .ent start start: la $sp, 0x80000400 ;hardcoded stack pointer address jal main ;jump and link nop ;branch delay slot halt ;a macro to stop the simulator .end start
Linker script fragment.
SECTIONS { .kernel 0x80000000 : { /* output section kernel with address */ *(.excvec) /* input section .execvec goes first */ *(.text .text.*) /* .text sections come next */ *(.rodata .rodata.*) /* .rodata sections next */ ...