Line 130... |
Line 130... |
executable. As an example, the following will work. The file start.s
|
executable. As an example, the following will work. The file start.s
|
was derived from the output of a file start.c compiled by gcc:
|
was derived from the output of a file start.c compiled by gcc:
|
|
|
or32-rtems-gcc -g -c -o start.o start.s
|
or32-rtems-gcc -g -c -o start.o start.s
|
or32-rtems-gcc -g -c -DOR1K -o dhry.o dhry.c
|
or32-rtems-gcc -g -c -DOR1K -o dhry.o dhry.c
|
or32-rtems-ld -Ttext 0x100 -o dhry.or32 start.o dhry.o
|
or32-rtems-ld -Ttext 0x0 -o dhry.or32 start.o dhry.o
|
|
|
---------------------- CUT HERE -------------------------
|
---------------------- CUT HERE -------------------------
|
|
|
# file start.s
|
# file start.s
|
.file "start.s"
|
.file "start.s"
|
Line 144... |
Line 144... |
# _main program location. It should be linked at
|
# _main program location. It should be linked at
|
# the start of all programs.
|
# the start of all programs.
|
|
|
.text
|
.text
|
.align 4
|
.align 4
|
|
.org 0x100 # The reset routine goes at 0x100
|
.proc _rst
|
.proc _rst
|
.def _rst
|
.def _rst
|
.val _rst
|
.val _rst
|
.scl 2
|
.scl 2
|
.type 041
|
.type 041
|
Line 157... |
Line 158... |
.def .bf
|
.def .bf
|
.val .
|
.val .
|
.scl 101
|
.scl 101
|
.endef
|
.endef
|
l.addi r1,r0,0x7f00 # Set STACK to value 0x7f00
|
l.addi r1,r0,0x7f00 # Set STACK to value 0x7f00
|
|
l.addi r2,r1,0x0 # FRAME and STACK are the same
|
l.mfspr r3,r0,17 # Get SR value
|
l.mfspr r3,r0,17 # Get SR value
|
l.ori r3,r3,2 # Set exception enable bit
|
l.ori r3,r3,2 # Set exception enable bit
|
l.mtspr r0,r3,17 # Enable exceptions
|
|
l.jal _main # Jump to main routine
|
l.jal _main # Jump to main routine
|
l.addi r6,r1,0 # No arguments to main (DELAY SLOT)
|
l.mtspr r0,r3,17 # Enable exceptions (DELAY SLOT)
|
|
|
.endproc _rst
|
.endproc _rst
|
.def _rst
|
.def _rst
|
.val .
|
.val .
|
.scl -1
|
.scl -1
|
.endef
|
.endef
|
|
|
|
.org 0xFFC
|
|
l.nop # Guarantee the exception vector space
|
|
# does not have general purpose code
|
|
|
|
# C code starts at 0x1000
|
|
|
---------------------- CUT HERE -------------------------
|
---------------------- CUT HERE -------------------------
|
No newline at end of file
|
No newline at end of file
|