dev.s
680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <regdef.h>
#include <asm.h>
#include <PR/R4300.h>
#include <PR/bcp.h>
.text
.align 2
.set noreorder
.ent __start
.globl __start
__start:
# insure power remains on
li t0, (1<<PI_GPIO_ENABLE_SHIFT)|1
sw t0, PHYS_TO_K1(PI_GPIO_REG)
# debug output
li t0, 0x20
sw t0, PHYS_TO_K1(PI_DRAM_ADDR_REG)
# setup stack pointer and gp
li sp, PHYS_TO_K1(INTERNAL_RAM_END-4)
la gp, _gp
#debug output
sw sp, PHYS_TO_K1(PI_DRAM_ADDR_REG)
# jump to "C" code
jal main
nop
# power down
lw t0, PHYS_TO_K1(PI_GPIO_REG)
and t0, t0, 0xfffffffe
sw t0, PHYS_TO_K1(PI_GPIO_REG)
.end __start