diff options
Diffstat (limited to 'utils/atj2137')
3 files changed, 47 insertions, 27 deletions
diff --git a/utils/atj2137/adfuload/test_binary/backlight_c/Makefile b/utils/atj2137/adfuload/test_binary/backlight_c/Makefile index a3cc13642a..d36664819d 100644 --- a/utils/atj2137/adfuload/test_binary/backlight_c/Makefile +++ b/utils/atj2137/adfuload/test_binary/backlight_c/Makefile | |||
@@ -10,12 +10,12 @@ AS = $(TOOLCHAIN)as | |||
10 | OBJCOPY = $(TOOLCHAIN)objcopy | 10 | OBJCOPY = $(TOOLCHAIN)objcopy |
11 | OBJDUMP = $(TOOLCHAIN)objdump | 11 | OBJDUMP = $(TOOLCHAIN)objdump |
12 | 12 | ||
13 | CFLAGS = -Wundef -march=4kec -nostdlib -Os -c | 13 | CFLAGS = -Wundef -march=mips32r2 -nostdlib -Os -c |
14 | 14 | ||
15 | OBJS = crt0.o test_bl.o | 15 | OBJS = crt0.o test_bl.o |
16 | LDSCRIPT= test_bl.lds | 16 | LDSCRIPT= test_bl.lds |
17 | 17 | ||
18 | LDFLAGS = -Wundef -march=4kec -T$(LDSCRIPT) -nostartfiles \ | 18 | LDFLAGS = -Wundef -march=mips32r2 -T$(LDSCRIPT) -nostartfiles \ |
19 | -nostdlib -Xlinker -Map=$(TARGET).map | 19 | -nostdlib -Xlinker -Map=$(TARGET).map |
20 | 20 | ||
21 | all : $(TARGET).bin | 21 | all : $(TARGET).bin |
diff --git a/utils/atj2137/adfuload/test_binary/backlight_c/crt0.S b/utils/atj2137/adfuload/test_binary/backlight_c/crt0.S index 485a4fc26c..1d6293bd93 100644 --- a/utils/atj2137/adfuload/test_binary/backlight_c/crt0.S +++ b/utils/atj2137/adfuload/test_binary/backlight_c/crt0.S | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | .set mips32r2 | 6 | .set mips32r2 |
7 | .set noreorder | 7 | .set noreorder |
8 | .set noat | 8 | // .set noat |
9 | 9 | ||
10 | .section .init.text,"ax",%progbits | 10 | .section .init.text,"ax",%progbits |
11 | 11 | ||
@@ -18,50 +18,68 @@ load_addr: | |||
18 | addiu v0, ra, -12 # calc real load address | 18 | addiu v0, ra, -12 # calc real load address |
19 | # account for branch delay slot | 19 | # account for branch delay slot |
20 | # and very first 'di' instruction | 20 | # and very first 'di' instruction |
21 | la t0, relocstart | ||
22 | la t1, relocend | ||
23 | beq t0, v0, entry_point # no relocation needed | ||
24 | nop | ||
25 | 21 | ||
26 | reloc_loop: | ||
27 | lw t2, 0(v0) # src | ||
28 | addiu v0, 4 # inc src addr | ||
29 | addiu t0, 4 # inc dst addr | ||
30 | bne t0, t1, reloc_loop | ||
31 | sw t2, -4(t0) # dst | ||
32 | |||
33 | entry_point_jump: | ||
34 | la t0, entry_point | ||
35 | jr t0 | ||
36 | nop | ||
37 | |||
38 | entry_point: | ||
39 | # setup caches | 22 | # setup caches |
40 | # 4-way, 256 sets, 16 bytes cacheline I/D | 23 | # 4-way, 256 sets, 16 bytes cacheline I/D |
41 | li t0, 3 # enable cache for kseg0 accesses | ||
42 | mtc0 t0, C0_CONFIG | ||
43 | |||
44 | la t0, 0x80000000 # an idx op should use an unmappable address | 24 | la t0, 0x80000000 # an idx op should use an unmappable address |
45 | ori t1, t0, 0x4000 # 16kB cache | 25 | ori t1, t0, 0x4000 # 16kB cache |
46 | mtc0 zero, C0_TAGLO | 26 | mtc0 zero, C0_TAGLO |
47 | mtc0 zero, C0_TAGHI | 27 | mtc0 zero, C0_TAGHI |
28 | ehb # execution hazard barrier | ||
48 | 29 | ||
49 | cache_init_loop: | 30 | cache_init_loop: |
50 | cache 8, 0(t0) # index store icache tag | 31 | cache ICIndexStTag, 0(t0) # index store icache tag |
51 | cache 9, 0(t0) # index store dcache tag | 32 | cache DCIndexStTag, 0(t0) # index store dcache tag |
52 | addiu t0, t0, 0x10 | 33 | addiu t0, t0, 0x10 |
53 | bne t0, t1, cache_init_loop | 34 | bne t0, t1, cache_init_loop |
54 | nop | 35 | nop |
55 | 36 | ||
37 | li t0, 3 # enable cache for kseg0 accesses | ||
38 | mtc0 t0, C0_CONFIG | ||
39 | ehb | ||
40 | |||
41 | relocation: | ||
42 | la t0, relocstart | ||
43 | la t1, relocend | ||
44 | beq t0, v0, entry_point # no relocation needed | ||
45 | nop | ||
46 | |||
47 | reloc_loop: | ||
48 | lw s0, 0(v0) # src | ||
49 | lw s1, 4(v0) | ||
50 | lw s2, 8(v0) | ||
51 | lw s3, 12(v0) | ||
52 | |||
53 | sw s0, 0(t0) # dst | ||
54 | sw s1, 4(t0) | ||
55 | sw s2, 8(t0) | ||
56 | sw s3, 12(t0) | ||
57 | |||
58 | synci 0(t0) # dcache writeback invalidate | ||
59 | # icache invalidate | ||
60 | |||
61 | addiu t0, t0, 16 # inc dst addr | ||
62 | blt t0, t1, reloc_loop | ||
63 | addiu v0, v0, 16 # inc src addr | ||
64 | |||
65 | entry_point_jump: | ||
66 | la t0, entry_point | ||
67 | jr.hb t0 # jump register with hazard barier | ||
68 | nop | ||
69 | |||
70 | entry_point: | ||
56 | # clear bss | 71 | # clear bss |
57 | la t0, bssbegin | 72 | la t0, bssbegin |
58 | la t1, bssend | 73 | la t1, bssend |
59 | 74 | beq t0, t1, stack_setup | |
75 | nop | ||
76 | |||
60 | clear_bss_loop: | 77 | clear_bss_loop: |
61 | addiu t0, 4 | 78 | addiu t0, 4 |
62 | bne t0, t1, clear_bss_loop | 79 | bne t0, t1, clear_bss_loop |
63 | sw zero, -4(t0) | 80 | sw zero, -4(t0) |
64 | 81 | ||
82 | stack_setup: | ||
65 | # setup stack | 83 | # setup stack |
66 | la sp, stackend | 84 | la sp, stackend |
67 | la t0, stackbegin | 85 | la t0, stackbegin |
diff --git a/utils/atj2137/adfuload/test_binary/backlight_c/test_bl.lds b/utils/atj2137/adfuload/test_binary/backlight_c/test_bl.lds index 744cad5175..870b708fa3 100644 --- a/utils/atj2137/adfuload/test_binary/backlight_c/test_bl.lds +++ b/utils/atj2137/adfuload/test_binary/backlight_c/test_bl.lds | |||
@@ -5,7 +5,7 @@ SECTIONS | |||
5 | { | 5 | { |
6 | 6 | ||
7 | 7 | ||
8 | .text 0xa0001000 : | 8 | .text 0x80000000 : |
9 | { | 9 | { |
10 | relocstart = .; | 10 | relocstart = .; |
11 | *(.init.text*) | 11 | *(.init.text*) |
@@ -21,6 +21,7 @@ SECTIONS | |||
21 | 21 | ||
22 | .bss : | 22 | .bss : |
23 | { | 23 | { |
24 | . = ALIGN(4); | ||
24 | bssbegin = .; | 25 | bssbegin = .; |
25 | *(.sbss*) | 26 | *(.sbss*) |
26 | *(.bss*) | 27 | *(.bss*) |
@@ -31,6 +32,7 @@ SECTIONS | |||
31 | 32 | ||
32 | .stack (NOLOAD) : | 33 | .stack (NOLOAD) : |
33 | { | 34 | { |
35 | . = ALIGN(4); | ||
34 | stackbegin = .; | 36 | stackbegin = .; |
35 | . += 0x2000; | 37 | . += 0x2000; |
36 | stackend = .; | 38 | stackend = .; |