Search
lxdream.org :: lxdream :: r812:8cc61d5ea1f8
lxdream 0.9.1
released Jun 29
Download Now
changeset812:8cc61d5ea1f8
parent811:7ff871670e58
child813:262efed79218
authornkeynes
dateWed Aug 13 10:32:00 2008 +0000 (11 years ago)
Add ARM test harness (not quite working on DC but almost...)
test/Makefile.in
test/aica.x
test/asic.h
test/crt0.s
test/dma.h
test/dmac.c
test/lib-arm/crt0.s
test/lib-arm/libc.a
test/lib-arm/libm.a
test/lib.h
test/lib/crt0.s
test/testaica.c
test/testspu.c
1.1 --- a/test/Makefile.in Wed Aug 13 10:27:49 2008 +0000
1.2 +++ b/test/Makefile.in Wed Aug 13 10:32:00 2008 +0000
1.3 @@ -19,9 +19,12 @@
1.4 SH4OBJCOPY = @SHOBJCOPY@ -O binary
1.5
1.6 ARMCC = @ARMCC@
1.7 -ARMCFLAGS = -O2
1.8 +ARMCFLAGS = -O2 -fno-builtin -fno-strict-aliasing -mlittle-endian
1.9 ARMLD = @ARMLD@
1.10 -ARMOBJCOPY = @ARMOBJCOPY@
1.11 +ARMLDFLAGS = -Wl,-T$(srcdir)/aica.x -nostartfiles -mlittle-endian \
1.12 + -nostdlib -L$(srcdir)/lib-arm
1.13 +ARMLIBS = -Wl,--start-group -lc -lgcc -lm -Wl,--end-group
1.14 +ARMOBJCOPY = @ARMOBJCOPY@ -O binary
1.15
1.16 RUNTEST = ../src/lxdream -c $(srcdir)/lxdream.rc -puH -A null
1.17 RUNTESTX = ../src/lxdream -c $(srcdir)/lxdream.rc -xpuH -A null
1.18 @@ -72,7 +75,7 @@
1.19
1.20 build-tests: testsh4 testmath testide testta testregs testrend testdisp testspu testmmu
1.21
1.22 -testsh4: crt0.so sh4/testsh4.so timer.so interrupt.so \
1.23 +testsh4: lib/crt0.so sh4/testsh4.so timer.so interrupt.so \
1.24 sh4/add.so sh4/addc.so sh4/addv.so sh4/and.so sh4/andi.so \
1.25 sh4/bf.so sh4/bsr.so sh4/bt.so sh4/cmp.so sh4/cmpstr.so \
1.26 sh4/div0.so sh4/div1.so sh4/float.so sh4/fmov.so sh4/ftrc.so \
1.27 @@ -83,57 +86,61 @@
1.28 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.29 $(SH4OBJCOPY) testsh4 testsh4.bin
1.30
1.31 -testide: crt0.so testide.so ide.so lib.so testdata.so
1.32 +testide: lib/crt0.so testide.so ide.so lib.so testdata.so
1.33 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.34 $(SH4OBJCOPY) testide testide.bin
1.35
1.36 -testmmu: crt0.so testmmu.so lib.so
1.37 +testmmu: lib/crt0.so testmmu.so lib.so
1.38 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.39 $(SH4OBJCOPY) testmmu testmmu.bin
1.40
1.41 -testmath: crt0.so $(SHARED_OBJECTS) testmath.so math.so
1.42 +testmath: lib/crt0.so $(SHARED_OBJECTS) testmath.so math.so
1.43 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.44
1.45 -testregs: crt0.so $(SHARED_OBJECTS) testregs.so ide.so
1.46 +testregs: lib/crt0.so $(SHARED_OBJECTS) testregs.so ide.so
1.47 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.48 $(SH4OBJCOPY) testregs testregs.bin
1.49
1.50 -testta: crt0.so $(SHARED_OBJECTS) testta.so pvr.so dmac.so asic.so lib.so testdata.so
1.51 +testta: lib/crt0.so $(SHARED_OBJECTS) testta.so pvr.so dmac.so asic.so lib.so testdata.so
1.52 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.53 $(SH4OBJCOPY) testta testta.bin
1.54
1.55 -testrend: crt0.so $(SHARED_OBJECTS) testrend.so pvr.so dmac.so asic.so lib.so testdata.so
1.56 +testaica: lib/crt0.so $(SHARED_OBJECTS) testaica.so dmac.so asic.so lib.so
1.57 + $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.58 + $(SH4OBJCOPY) testaica testaica.bin
1.59 +
1.60 +testrend: lib/crt0.so $(SHARED_OBJECTS) testrend.so pvr.so dmac.so asic.so lib.so testdata.so
1.61 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.62 $(SH4OBJCOPY) testrend testrend.bin
1.63
1.64 -testblend: crt0.so $(SHARED_OBJECTS) testblend.so pvr.so dmac.so asic.so lib.so testdata.so
1.65 +testblend: lib/crt0.so $(SHARED_OBJECTS) testblend.so pvr.so dmac.so asic.so lib.so testdata.so
1.66 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.67 $(SH4OBJCOPY) testblend testblend.bin
1.68
1.69 -testdisp: crt0.so $(SHARED_OBJECTS) testdisp.so pvr.so asic.so lib.so testdata.so timer.so
1.70 +testdisp: lib/crt0.so $(SHARED_OBJECTS) testdisp.so pvr.so asic.so lib.so testdata.so timer.so
1.71 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.72 $(SH4OBJCOPY) testdisp testdisp.bin
1.73
1.74 -testyuv: crt0.so $(SHARED_OBJECTS) testyuv.so pvr.so asic.so lib.so testdata.so timer.so dmac.so
1.75 +testyuv: lib/crt0.so $(SHARED_OBJECTS) testyuv.so pvr.so asic.so lib.so testdata.so timer.so dmac.so
1.76 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.77 $(SH4OBJCOPY) testyuv testyuv.bin
1.78
1.79 -testspu: crt0.so $(SHARED_OBJECTS) testspu.so asic.so lib.so testdata.so timer.so dmac.so
1.80 +testspu: lib/crt0.so $(SHARED_OBJECTS) testspu.so asic.so lib.so testdata.so timer.so dmac.so
1.81 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.82 $(SH4OBJCOPY) testspu testspu.bin
1.83
1.84 -testg2: crt0.so $(SHARED_OBJECTS) testg2.so asic.so lib.so testdata.so timer.so dmac.so
1.85 +testg2: lib/crt0.so $(SHARED_OBJECTS) testg2.so asic.so lib.so testdata.so timer.so dmac.so
1.86 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.87 $(SH4OBJCOPY) testg2 testg2.bin
1.88
1.89 -readdata: crt0.so readdata.so
1.90 +readdata: lib/crt0.so readdata.so
1.91 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.92
1.93 -rend: crt0.so rendload.so asic.so lib.so timer.so pvr.so
1.94 +rend: lib/crt0.so rendload.so asic.so lib.so timer.so pvr.so
1.95 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.96 $(SH4OBJCOPY) rend rend.bin
1.97
1.98 -testFF10: crt0.so testFF10.so lib.so
1.99 +testFF10: lib/crt0.so testFF10.so lib.so
1.100 $(SH4CC) $(SH4LDFLAGS) $^ -o $@ $(SH4LIBS)
1.101 $(SH4OBJCOPY) testFF10 testFF10.bin
1.102
1.103 @@ -152,7 +159,7 @@
1.104
1.105 uninstall:
1.106
1.107 -DISTFILES = asic.c asic.h bin2c.c crt0.s dma.h dmac.c ide.c ide.h interrupt.s \
1.108 +DISTFILES = asic.c asic.h bin2c.c dma.h dmac.c ide.c ide.h interrupt.s \
1.109 lib.c lib.h math.s pvr.c pvr.h rendload.c sh4/add.s sh4/addc.s \
1.110 sh4/addv.s sh4/and.s sh4/andi.s sh4/bf.s sh4/bsr.s sh4/bt.s sh4/cmp.s \
1.111 sh4/cmpstr.s sh4/div0.s sh4/div1.s sh4/excslot.s sh4/float.s sh4/fmov.s \
1.112 @@ -161,7 +168,8 @@
1.113 sh4/xtrct.s testdata.c testdata.h testdisp.c testide.c testmath.c \
1.114 testmmu.c testregs.c testrend.c testspu.c testta.c testyuv.c timer.c timer.h \
1.115 testta.data testta2.data testta3.data testta4.data testta5.data testsort.data \
1.116 - lxdream.rc dc.x lib/libc.a lib/libm.a lib/newlib-1.8.2-dc.patch \
1.117 + lxdream.rc dc.x lib/crt0.s lib/libc.a lib/libm.a lib/newlib-1.8.2-dc.patch \
1.118 + aica.x lib-arm/libc.a lib-arm/libm.a lib-arm/crt0.s \
1.119 include/_ansi.h include/_syslist.h include/ar.h include/assert.h include/ctype.h \
1.120 include/dirent.h include/errno.h include/fastmath.h include/fcntl.h include/grp.h \
1.121 include/ieeefp.h include/locale.h include/machine/fastmath.h include/machine/ieeefp.h \
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/test/aica.x Wed Aug 13 10:32:00 2008 +0000
2.3 @@ -0,0 +1,229 @@
2.4 +/* Sega Dreamcast linker script */
2.5 +
2.6 +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm",
2.7 + "elf32-littlearm")
2.8 +OUTPUT_ARCH(arm)
2.9 +ENTRY(start)
2.10 + SEARCH_DIR(/usr/local/dcdev/arm-elf/lib);
2.11 +/* Do we need any of these for elf?
2.12 + __DYNAMIC = 0; */
2.13 +
2.14 +MEMORY
2.15 +{
2.16 + ram (rwx) : ORIGIN = 0x00000000, LENGTH = 0x00200000
2.17 +}
2.18 +
2.19 +SECTIONS
2.20 +{
2.21 + /* Read-only sections, merged into text segment: */
2.22 +/* . = 0x1000;*/
2.23 + .interp : { *(.interp) }
2.24 + .hash : { *(.hash) }
2.25 + .dynsym : { *(.dynsym) }
2.26 + .dynstr : { *(.dynstr) }
2.27 + .gnu.version : { *(.gnu.version) }
2.28 + .gnu.version_d : { *(.gnu.version_d) }
2.29 + .gnu.version_r : { *(.gnu.version_r) }
2.30 + .rel.init : { *(.rel.init) }
2.31 + .rela.init : { *(.rela.init) }
2.32 + .rel.text :
2.33 + {
2.34 + *(.rel.text)
2.35 + *(.rel.text.*)
2.36 + *(.rel.gnu.linkonce.t*)
2.37 + }
2.38 + .rela.text :
2.39 + {
2.40 + *(.rela.text)
2.41 + *(.rela.text.*)
2.42 + *(.rela.gnu.linkonce.t*)
2.43 + }
2.44 + .rel.fini : { *(.rel.fini) }
2.45 + .rela.fini : { *(.rela.fini) }
2.46 + .rel.rodata :
2.47 + {
2.48 + *(.rel.rodata)
2.49 + *(.rel.rodata.*)
2.50 + *(.rel.gnu.linkonce.r*)
2.51 + }
2.52 + .rela.rodata :
2.53 + {
2.54 + *(.rela.rodata)
2.55 + *(.rela.rodata.*)
2.56 + *(.rela.gnu.linkonce.r*)
2.57 + }
2.58 + .rel.data :
2.59 + {
2.60 + *(.rel.data)
2.61 + *(.rel.data.*)
2.62 + *(.rel.gnu.linkonce.d*)
2.63 + }
2.64 + .rela.data :
2.65 + {
2.66 + *(.rela.data)
2.67 + *(.rela.data.*)
2.68 + *(.rela.gnu.linkonce.d*)
2.69 + }
2.70 + .rel.ctors : { *(.rel.ctors) }
2.71 + .rela.ctors : { *(.rela.ctors) }
2.72 + .rel.dtors : { *(.rel.dtors) }
2.73 + .rela.dtors : { *(.rela.dtors) }
2.74 + .rel.got : { *(.rel.got) }
2.75 + .rela.got : { *(.rela.got) }
2.76 + .rel.sdata :
2.77 + {
2.78 + *(.rel.sdata)
2.79 + *(.rel.sdata.*)
2.80 + *(.rel.gnu.linkonce.s*)
2.81 + }
2.82 + .rela.sdata :
2.83 + {
2.84 + *(.rela.sdata)
2.85 + *(.rela.sdata.*)
2.86 + *(.rela.gnu.linkonce.s*)
2.87 + }
2.88 + .rel.sbss : { *(.rel.sbss) }
2.89 + .rela.sbss : { *(.rela.sbss) }
2.90 + .rel.bss : { *(.rel.bss) }
2.91 + .rela.bss : { *(.rela.bss) }
2.92 + .rel.plt : { *(.rel.plt) }
2.93 + .rela.plt : { *(.rela.plt) }
2.94 + .init :
2.95 + {
2.96 + KEEP (*(.init))
2.97 + } =0
2.98 + .plt : { *(.plt) }
2.99 + .text :
2.100 + {
2.101 + *(.text)
2.102 + *(.text.*)
2.103 + *(.stub)
2.104 + /* .gnu.warning sections are handled specially by elf32.em. */
2.105 + *(.gnu.warning)
2.106 + *(.gnu.linkonce.t*)
2.107 + } =0
2.108 + _etext = .;
2.109 + PROVIDE (etext = .);
2.110 + .fini :
2.111 + {
2.112 + KEEP (*(.fini))
2.113 + } =0
2.114 + .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }
2.115 + .rodata1 : { *(.rodata1) }
2.116 + /* Adjust the address for the data segment. We want to adjust up to
2.117 + the same address within the page on the next page up. */
2.118 + . = ALIGN(128) + (. & (128 - 1));
2.119 + .data :
2.120 + {
2.121 + *(.data)
2.122 + *(.data.*)
2.123 + *(.gnu.linkonce.d*)
2.124 + SORT(CONSTRUCTORS)
2.125 + }
2.126 + .data1 : { *(.data1) }
2.127 + .eh_frame : { *(.eh_frame) }
2.128 + .gcc_except_table : { *(.gcc_except_table) }
2.129 + .ctors ALIGN(4):
2.130 + {
2.131 + ___ctors = .;
2.132 + /* gcc uses crtbegin.o to find the start of
2.133 + the constructors, so we make sure it is
2.134 + first. Because this is a wildcard, it
2.135 + doesn't matter if the user does not
2.136 + actually link against crtbegin.o; the
2.137 + linker won't look for a file to match a
2.138 + wildcard. The wildcard also means that it
2.139 + doesn't matter which directory crtbegin.o
2.140 + is in. */
2.141 + KEEP (*crtbegin.o(.ctors))
2.142 + /* We don't want to include the .ctor section from
2.143 + from the crtend.o file until after the sorted ctors.
2.144 + The .ctor section from the crtend file contains the
2.145 + end of ctors marker and it must be last */
2.146 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
2.147 + KEEP (*(SORT(.ctors.*)))
2.148 + KEEP (*(.ctors))
2.149 + ___ctors_end = .;
2.150 + }
2.151 + .dtors :
2.152 + {
2.153 + ___dtors = .;
2.154 + KEEP (*crtbegin.o(.dtors))
2.155 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
2.156 + KEEP (*(SORT(.dtors.*)))
2.157 + KEEP (*(.dtors))
2.158 + ___dtors_end = .;
2.159 + }
2.160 + .got : { *(.got.plt) *(.got) }
2.161 + .dynamic : { *(.dynamic) }
2.162 + /* We want the small data sections together, so single-instruction offsets
2.163 + can access them all, and initialized data all before uninitialized, so
2.164 + we can shorten the on-disk segment size. */
2.165 + .sdata :
2.166 + {
2.167 + *(.sdata)
2.168 + *(.sdata.*)
2.169 + *(.gnu.linkonce.s.*)
2.170 + }
2.171 + _edata = .;
2.172 + PROVIDE (edata = .);
2.173 + __bss_start = .;
2.174 + .sbss :
2.175 + {
2.176 + *(.dynsbss)
2.177 + *(.sbss)
2.178 + *(.sbss.*)
2.179 + *(.scommon)
2.180 + }
2.181 + .bss :
2.182 + {
2.183 + *(.dynbss)
2.184 + *(.bss)
2.185 + *(.bss.*)
2.186 + *(COMMON)
2.187 + /* Align here to ensure that the .bss section occupies space up to
2.188 + _end. Align after .bss to ensure correct alignment even if the
2.189 + .bss section disappears because there are no input sections. */
2.190 + . = ALIGN(32 / 8);
2.191 + }
2.192 + . = ALIGN(32 / 8);
2.193 + _end = .;
2.194 + __bss_end = .;
2.195 + PROVIDE (end = .);
2.196 + /* Stabs debugging sections. */
2.197 + .stab 0 : { *(.stab) }
2.198 + .stabstr 0 : { *(.stabstr) }
2.199 + .stab.excl 0 : { *(.stab.excl) }
2.200 + .stab.exclstr 0 : { *(.stab.exclstr) }
2.201 + .stab.index 0 : { *(.stab.index) }
2.202 + .stab.indexstr 0 : { *(.stab.indexstr) }
2.203 + .comment 0 : { *(.comment) }
2.204 + /* DWARF debug sections.
2.205 + Symbols in the DWARF debugging sections are relative to the beginning
2.206 + of the section so we begin them at 0. */
2.207 + /* DWARF 1 */
2.208 + .debug 0 : { *(.debug) }
2.209 + .line 0 : { *(.line) }
2.210 + /* GNU DWARF 1 extensions */
2.211 + .debug_srcinfo 0 : { *(.debug_srcinfo) }
2.212 + .debug_sfnames 0 : { *(.debug_sfnames) }
2.213 + /* DWARF 1.1 and DWARF 2 */
2.214 + .debug_aranges 0 : { *(.debug_aranges) }
2.215 + .debug_pubnames 0 : { *(.debug_pubnames) }
2.216 + /* DWARF 2 */
2.217 + .debug_info 0 : { *(.debug_info) }
2.218 + .debug_abbrev 0 : { *(.debug_abbrev) }
2.219 + .debug_line 0 : { *(.debug_line) }
2.220 + .debug_frame 0 : { *(.debug_frame) }
2.221 + .debug_str 0 : { *(.debug_str) }
2.222 + .debug_loc 0 : { *(.debug_loc) }
2.223 + .debug_macinfo 0 : { *(.debug_macinfo) }
2.224 + /* SGI/MIPS DWARF 2 extensions */
2.225 + .debug_weaknames 0 : { *(.debug_weaknames) }
2.226 + .debug_funcnames 0 : { *(.debug_funcnames) }
2.227 + .debug_typenames 0 : { *(.debug_typenames) }
2.228 + .debug_varnames 0 : { *(.debug_varnames) }
2.229 +/* .stack 0x8c00f400 : { _stack = .; *(.stack) }*/
2.230 + /* These must appear regardless of . */
2.231 + _stack = 0x00200000;
2.232 +}
3.1 --- a/test/asic.h Wed Aug 13 10:27:49 2008 +0000
3.2 +++ b/test/asic.h Wed Aug 13 10:32:00 2008 +0000
3.3 @@ -13,10 +13,10 @@
3.4 #define EVENT_MAPLE_DMA 12
3.5 #define EVENT_MAPLE_ERR 13 /* ??? */
3.6 #define EVENT_IDE_DMA 14
3.7 -#define EVENT_SPU_DMA0 15
3.8 -#define EVENT_SPU_DMA1 16
3.9 -#define EVENT_SPU_DMA2 17
3.10 -#define EVENT_SPU_DMA3 18
3.11 +#define EVENT_G2_DMA0 15
3.12 +#define EVENT_G2_DMA1 16
3.13 +#define EVENT_G2_DMA2 17
3.14 +#define EVENT_G2_DMA3 18
3.15 #define EVENT_PVR_DMA 19
3.16 #define EVENT_SORT_DMA 20
3.17 #define EVENT_PVR_PUNCHOUT_DONE 21
4.1 --- a/test/crt0.s Wed Aug 13 10:27:49 2008 +0000
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,119 +0,0 @@
4.4 - .section .text
4.5 - .global start
4.6 - .global ___exit
4.7 - .global _atexit
4.8 -start:
4.9 - mov.l setup_cache_k,r0
4.10 - mov.l p2_mask,r1
4.11 - or r1,r0
4.12 - jmp @r0
4.13 - nop
4.14 -setup_cache:
4.15 - mov.l ccr_addr,r0
4.16 - mov.w ccr_data,r1
4.17 - mov.l r1,@r0
4.18 - mov.l start_2_k,r0
4.19 - nop
4.20 - nop
4.21 - nop
4.22 - nop
4.23 - nop
4.24 - nop
4.25 - nop
4.26 - jmp @r0
4.27 - nop
4.28 -start_2:
4.29 - mov.l old_stack_k,r14
4.30 - mov.l r15,@r14
4.31 - mov.l old_pr_k,r14
4.32 - sts pr,r15
4.33 - mov.l r15,@r14
4.34 - mov.l stack_k,r15
4.35 -
4.36 - ! zero out bss
4.37 - mov.l edata_k,r0
4.38 - mov.l end_k,r1
4.39 - mov #0,r2
4.40 -start_l:
4.41 - mov.l r2,@r0
4.42 - add #4,r0
4.43 - cmp/ge r0,r1
4.44 - bt start_l
4.45 -
4.46 -#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY)
4.47 - mov.l set_fpscr_k, r1
4.48 - jsr @r1
4.49 - mov #0,r4
4.50 - lds r3,fpscr
4.51 -#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */
4.52 -
4.53 - ! call the mainline
4.54 - mov.l main_k,r0
4.55 - jsr @r0
4.56 - or r0,r0
4.57 -
4.58 - ! call exit
4.59 - mov r0,r4
4.60 - mov.l exit_k,r0
4.61 - jsr @r0
4.62 - or r0,r0
4.63 -
4.64 -___exit:
4.65 - mov.l old_pr_k,r14
4.66 - mov.l @r14,r15
4.67 - lds r15,pr
4.68 - mov.l old_stack_k,r14
4.69 - mov.l @r14,r15
4.70 - rts
4.71 - nop
4.72 -
4.73 -_atexit:
4.74 - rts
4.75 - nop
4.76 -
4.77 - .align 4
4.78 -#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
4.79 -set_fpscr_k:
4.80 - .long ___set_fpscr
4.81 -#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */
4.82 -stack_k:
4.83 - .long _stack
4.84 -edata_k:
4.85 - .long _edata
4.86 -end_k:
4.87 - .long _end
4.88 -main_k:
4.89 - .long _main
4.90 -exit_k:
4.91 - .long _exit
4.92 -
4.93 -old_stack_k:
4.94 - .long _old_stack
4.95 -old_pr_k:
4.96 - .long _old_pr
4.97 -
4.98 -_old_stack:
4.99 - .long 0
4.100 -_old_pr:
4.101 - .long 0
4.102 -
4.103 -setup_cache_k:
4.104 - .long setup_cache
4.105 -start_2_k:
4.106 - .long start_2
4.107 -p2_mask:
4.108 - .long 0xa0000000
4.109 -ccr_addr:
4.110 - .long 0xff00001c
4.111 -ccr_data:
4.112 - .word 0x090b
4.113 -
4.114 - .align 4
4.115 -
4.116 -#ifdef __ELF__
4.117 - .section .stack,"aw"
4.118 -#else
4.119 - .section .stack
4.120 -#endif
4.121 -! _stack: .long 0xdeaddead
4.122 -
5.1 --- a/test/dma.h Wed Aug 13 10:27:49 2008 +0000
5.2 +++ b/test/dma.h Wed Aug 13 10:32:00 2008 +0000
5.3 @@ -45,3 +45,21 @@
5.4 * @return 0 on success, non-zero on failure.
5.5 */
5.6 int pvr_dma_write( unsigned int target, char *buf, int length, int region );
5.7 +
5.8 +/**
5.9 + * Transfer TA data to the PVR via SORT-DMA.
5.10 + *
5.11 + * @param sorttable Start address of the sort table
5.12 + * @param tablelen Size of the sort table (in bytes)
5.13 + * @param data Start address of the TA data (polygons)
5.14 + * @param datalen Size of the polygon data block (in bytes)
5.15 + * @param bitwidth
5.16 + * @param datasize
5.17 + * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region.
5.18 + *
5.19 + * @return 0 on success, non-zero on failure.
5.20 + */
5.21 +int sort_dma_write( char *sorttable, int tablelen, char *data, int datalen, int bitwidth, int datasize );
5.22 +
5.23 +int aica_dma_write( uint32_t aica_addr, char *data, uint32_t size );
5.24 +int aica_dma_read( char *data, uint32_t aica_addr, uint32_t size );
6.1 --- a/test/dmac.c Wed Aug 13 10:27:49 2008 +0000
6.2 +++ b/test/dmac.c Wed Aug 13 10:32:00 2008 +0000
6.3 @@ -40,6 +40,20 @@
6.4 #define SORT_DMA_CTL (ASIC_BASE+0x820)
6.5 #define SORT_DMA_COUNT (ASIC_BASE+0x860)
6.6
6.7 +#define G2BASERAM 0x00800000
6.8 +
6.9 +#define G2DMABASE 0xA05F7800
6.10 +#define G2DMATIMEOUT (G2DMABASE+0x90)
6.11 +#define G2DMAMAGIC (G2DMABASE+0xBC)
6.12 +#define G2DMAEXT(x) (G2DMABASE+(0x20*(x)))
6.13 +#define G2DMAHOST(x) (G2DMABASE+(0x20*(x))+0x04)
6.14 +#define G2DMASIZE(x) (G2DMABASE+(0x20*(x))+0x08)
6.15 +#define G2DMADIR(x) (G2DMABASE+(0x20*(x))+0x0C)
6.16 +#define G2DMAMODE(x) (G2DMABASE+(0x20*(x))+0x10)
6.17 +#define G2DMACTL1(x) (G2DMABASE+(0x20*(x))+0x14)
6.18 +#define G2DMACTL2(x) (G2DMABASE+(0x20*(x))+0x18)
6.19 +#define G2DMASTOP(x) (G2DMABASE+(0x20*(x))+0x1C)
6.20 +
6.21 void dmac_dump_channel( FILE *f, unsigned int channel )
6.22 {
6.23 fprintf( f, "DMAC SAR: %08X Count: %08X Ctl: %08X OR: %08X\n",
6.24 @@ -157,3 +171,35 @@
6.25 CHECK_IEQUALS( 0, long_read(SORT_DMA_CTL) );
6.26 return result;
6.27 }
6.28 +
6.29 +int aica_dma_transfer( uint32_t aica_addr, char *data, uint32_t size, int writeFlag )
6.30 +{
6.31 + long_write( G2DMATIMEOUT, 0 );
6.32 + long_write( G2DMAMAGIC, 0x4659404f );
6.33 + long_write( G2DMACTL1(0), 0 );
6.34 + long_write( G2DMAEXT(0), aica_addr );
6.35 + long_write( G2DMAHOST(0), ((uint32_t)data) );
6.36 + long_write( G2DMASIZE(0), ((size+31)&0x7FFFFFE0) | 0x80000000 );
6.37 + long_write( G2DMADIR(0), (writeFlag ? 0 : 1) );
6.38 + long_write( G2DMAMODE(0), 0 );
6.39 +
6.40 + long_write( G2DMACTL1(0), 1 );
6.41 + long_write( G2DMACTL2(0), 1 );
6.42 + if( asic_wait( EVENT_G2_DMA0 ) != 0 ) {
6.43 + fprintf( stderr, "Timeout waiting for G2 DMA event\n" );
6.44 + return -1;
6.45 + }
6.46 + // CHECK_IEQUALS( 0, long_read( G2DMACTL1(0) ) );
6.47 + CHECK_IEQUALS( 0, long_read( G2DMACTL2(0) ) );
6.48 + return 0;
6.49 +}
6.50 +
6.51 +int aica_dma_write( uint32_t aica_addr, char *data, uint32_t size )
6.52 +{
6.53 + return aica_dma_transfer( aica_addr, data, size, 1 );
6.54 +}
6.55 +
6.56 +int aica_dma_read( char *data, uint32_t aica_addr, uint32_t size )
6.57 +{
6.58 + return aica_dma_transfer( aica_addr, data, size, 0 );
6.59 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/test/lib-arm/crt0.s Wed Aug 13 10:32:00 2008 +0000
7.3 @@ -0,0 +1,59 @@
7.4 +.section .text
7.5 +.code 32
7.6 +.align 0
7.7 +.global start
7.8 +.global ___exit
7.9 +.global _atexit
7.10 +start:
7.11 +
7.12 +/* Start by setting up a stack */
7.13 + /* Set up the stack pointer to a fixed value */
7.14 + ldr r3, .LC0
7.15 + mov sp, r3
7.16 + /* Setup a default stack-limit in-case the code has been
7.17 + compiled with "-mapcs-stack-check". Hard-wiring this value
7.18 + is not ideal, since there is currently no support for
7.19 + checking that the heap and stack have not collided, or that
7.20 + this default 64k is enough for the program being executed.
7.21 + However, it ensures that this simple crt0 world will not
7.22 + immediately cause an overflow event: */
7.23 + sub sl, sp, #64 << 10 /* Still assumes 256bytes below sl */
7.24 +
7.25 + /* Zero-out the BSS segment */
7.26 + mov a2, #0 /* Second arg: fill value */
7.27 + mov fp, a2 /* Null frame pointer */
7.28 + mov r7, a2 /* Null frame pointer for Thumb */
7.29 +
7.30 + ldr a1, .LC1 /* First arg: start of memory block */
7.31 + ldr a3, .LC2
7.32 + sub a3, a3, a1 /* Third arg: length of block */
7.33 + bl memset
7.34 + b .LB0
7.35 + .word 0 /* padding */
7.36 +
7.37 +.syscall:
7.38 + .word -1 /* Syscall # */
7.39 + .word 0 /* Arguments */
7.40 + .word 0
7.41 + .word 0
7.42 +
7.43 + /* Enter main with no arguments for now */
7.44 +.LB0:
7.45 + mov r0, #0 /* no arguments */
7.46 + mov r1, #0 /* no argv either */
7.47 + bl main
7.48 +
7.49 + bl exit /* Should not return */
7.50 +
7.51 + /* For Thumb, constants must be after the code since only
7.52 + positive offsets are supported for PC relative addresses. */
7.53 +
7.54 + .align 0
7.55 +.LC0:
7.56 + .word _stack
7.57 +.LC1:
7.58 + .word __bss_start
7.59 +.LC2:
7.60 + .word __bss_end
7.61 +
7.62 +
8.1 Binary file test/lib-arm/libc.a has changed
9.1 Binary file test/lib-arm/libm.a has changed
10.1 --- a/test/lib.h Wed Aug 13 10:27:49 2008 +0000
10.2 +++ b/test/lib.h Wed Aug 13 10:32:00 2008 +0000
10.3 @@ -16,6 +16,8 @@
10.4 #define ASIC_IRQC2 0xA05f6938
10.5 #define IRQB0_MASK 0x0007B000
10.6
10.7 +#define AICA_RESET 0xA0702C00
10.8 +
10.9 #define float_read(A) (*((volatile float*)(A)))
10.10 #define float_write(A, V) ( (*((volatile float*)(A))) = (V) )
10.11 #define long_read(A) (*((volatile unsigned long*)(A)))
10.12 @@ -38,9 +40,8 @@
10.13 void reset_asic_status(void);
10.14 void g2_fifo_wait( void );
10.15
10.16 -void spu_memload( uint32_t dst, const void *src, int length );
10.17 -void spu_memread( void *dst, uint32_t src, int length );
10.18 -void dump_spu_memory( unsigned int from, int length );
10.19 +#define aica_enable() long_write( AICA_RESET, (long_read(AICA_RESET) & 0xFFFFFFFE) )
10.20 +#define aica_disable() long_write( AICA_RESET, (long_read(AICA_RESET) | 1) )
10.21
10.22 struct spudma_struct {
10.23 uint32_t g2_addr;
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/test/lib/crt0.s Wed Aug 13 10:32:00 2008 +0000
11.3 @@ -0,0 +1,119 @@
11.4 + .section .text
11.5 + .global start
11.6 + .global ___exit
11.7 + .global _atexit
11.8 +start:
11.9 + mov.l setup_cache_k,r0
11.10 + mov.l p2_mask,r1
11.11 + or r1,r0
11.12 + jmp @r0
11.13 + nop
11.14 +setup_cache:
11.15 + mov.l ccr_addr,r0
11.16 + mov.w ccr_data,r1
11.17 + mov.l r1,@r0
11.18 + mov.l start_2_k,r0
11.19 + nop
11.20 + nop
11.21 + nop
11.22 + nop
11.23 + nop
11.24 + nop
11.25 + nop
11.26 + jmp @r0
11.27 + nop
11.28 +start_2:
11.29 + mov.l old_stack_k,r14
11.30 + mov.l r15,@r14
11.31 + mov.l old_pr_k,r14
11.32 + sts pr,r15
11.33 + mov.l r15,@r14
11.34 + mov.l stack_k,r15
11.35 +
11.36 + ! zero out bss
11.37 + mov.l edata_k,r0
11.38 + mov.l end_k,r1
11.39 + mov #0,r2
11.40 +start_l:
11.41 + mov.l r2,@r0
11.42 + add #4,r0
11.43 + cmp/ge r0,r1
11.44 + bt start_l
11.45 +
11.46 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY)
11.47 + mov.l set_fpscr_k, r1
11.48 + jsr @r1
11.49 + mov #0,r4
11.50 + lds r3,fpscr
11.51 +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) */
11.52 +
11.53 + ! call the mainline
11.54 + mov.l main_k,r0
11.55 + jsr @r0
11.56 + or r0,r0
11.57 +
11.58 + ! call exit
11.59 + mov r0,r4
11.60 + mov.l exit_k,r0
11.61 + jsr @r0
11.62 + or r0,r0
11.63 +
11.64 +___exit:
11.65 + mov.l old_pr_k,r14
11.66 + mov.l @r14,r15
11.67 + lds r15,pr
11.68 + mov.l old_stack_k,r14
11.69 + mov.l @r14,r15
11.70 + rts
11.71 + nop
11.72 +
11.73 +_atexit:
11.74 + rts
11.75 + nop
11.76 +
11.77 + .align 4
11.78 +#if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
11.79 +set_fpscr_k:
11.80 + .long ___set_fpscr
11.81 +#endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */
11.82 +stack_k:
11.83 + .long _stack
11.84 +edata_k:
11.85 + .long _edata
11.86 +end_k:
11.87 + .long _end
11.88 +main_k:
11.89 + .long _main
11.90 +exit_k:
11.91 + .long _exit
11.92 +
11.93 +old_stack_k:
11.94 + .long _old_stack
11.95 +old_pr_k:
11.96 + .long _old_pr
11.97 +
11.98 +_old_stack:
11.99 + .long 0
11.100 +_old_pr:
11.101 + .long 0
11.102 +
11.103 +setup_cache_k:
11.104 + .long setup_cache
11.105 +start_2_k:
11.106 + .long start_2
11.107 +p2_mask:
11.108 + .long 0xa0000000
11.109 +ccr_addr:
11.110 + .long 0xff00001c
11.111 +ccr_data:
11.112 + .word 0x090b
11.113 +
11.114 + .align 4
11.115 +
11.116 +#ifdef __ELF__
11.117 + .section .stack,"aw"
11.118 +#else
11.119 + .section .stack
11.120 +#endif
11.121 +! _stack: .long 0xdeaddead
11.122 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/test/testaica.c Wed Aug 13 10:32:00 2008 +0000
12.3 @@ -0,0 +1,102 @@
12.4 +/**
12.5 + * $Id: testdata.c 602 2008-01-15 20:50:23Z nkeynes $
12.6 + *
12.7 + * AICA test loader
12.8 + *
12.9 + * Copyright (c) 2006 Nathan Keynes.
12.10 + *
12.11 + * This program is free software; you can redistribute it and/or modify
12.12 + * it under the terms of the GNU General Public License as published by
12.13 + * the Free Software Foundation; either version 2 of the License, or
12.14 + * (at your option) any later version.
12.15 + *
12.16 + * This program is distributed in the hope that it will be useful,
12.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.19 + * GNU General Public License for more details.
12.20 + */
12.21 +
12.22 +#include <stdio.h>
12.23 +
12.24 +#include "lib.h"
12.25 +
12.26 +#define AICA_RAM_BASE 0x00800000
12.27 +
12.28 +#define AICA_SYSCALL (AICA_RAM_BASE+0x30)
12.29 +#define AICA_SYSCALL_ARG1 (AICA_SYSCALL+4)
12.30 +#define AICA_SYSCALL_ARG2 (AICA_SYSCALL+8)
12.31 +#define AICA_SYSCALL_ARG3 (AICA_SYSCALL+12)
12.32 +#define AICA_SYSCALL_RETURN (AICA_SYSCALL+4)
12.33 +
12.34 +#define SYS_READ 0
12.35 +#define SYS_WRITE 1
12.36 +#define SYS_OPEN 2
12.37 +#define SYS_CLOSE 3
12.38 +#define SYS_CREAT 4
12.39 +#define SYS_LINK 5
12.40 +#define SYS_UNLINK 6
12.41 +#define SYS_CHDIR 7
12.42 +#define SYS_CHMOD 8
12.43 +#define SYS_LSEEK 9
12.44 +#define SYS_FSTAT 10
12.45 +#define SYS_TIME 11
12.46 +#define SYS_STAT 12
12.47 +#define SYS_UTIME 13
12.48 +#define SYS_ASSIGNWRKMEM 14
12.49 +#define SYS_EXIT 15
12.50 +#define SYS_OPENDIR 16
12.51 +#define SYS_CLOSEDIR 17
12.52 +#define SYS_READDIR 18
12.53 +#define SYS_GETHOSTINFO 19
12.54 +
12.55 +uint32_t do_syscall( uint32_t syscall, uint32_t arg1, uint32_t arg2, uint32_t arg3 )
12.56 +{
12.57 + uint32_t fd, len;
12.58 + char *data;
12.59 +
12.60 + switch( syscall ) {
12.61 + case SYS_READ:
12.62 + fd = arg1;
12.63 + data = (char *)(AICA_RAM_BASE + (arg2 & 0x001FFFFF));
12.64 + len = arg3;
12.65 + return read( fd, data, len );
12.66 + case SYS_WRITE:
12.67 + fd = arg1;
12.68 + data = (char *)(AICA_RAM_BASE + (arg2 & 0x001FFFFF));
12.69 + len = arg3;
12.70 + return write( fd, data, len );
12.71 + break;
12.72 + case SYS_EXIT:
12.73 + aica_disable();
12.74 + exit(arg1);
12.75 + default:
12.76 + return 0;
12.77 + }
12.78 +}
12.79 +
12.80 +
12.81 +int main( int argc, char *argv[] )
12.82 +{
12.83 + char buf[65536] __attribute__((aligned(32)));
12.84 + uint32_t aica_addr = AICA_RAM_BASE;
12.85 + int len;
12.86 +
12.87 + aica_disable();
12.88 + /* Load ARM program from stdin and copy to ARM memory */
12.89 + while( (len = read(0, buf, sizeof(buf))) > 0 ) {
12.90 + aica_dma_write( aica_addr, buf, len );
12.91 + aica_addr += len;
12.92 + }
12.93 +
12.94 + /* Main loop waiting for IO commands */
12.95 + aica_enable();
12.96 + do {
12.97 + int syscall = long_read(AICA_SYSCALL);
12.98 + if( syscall != -1 ) {
12.99 + uint32_t result = do_syscall( syscall, long_read(AICA_SYSCALL_ARG1),
12.100 + long_read(AICA_SYSCALL_ARG2), long_read(AICA_SYSCALL_ARG3) );
12.101 + long_write( AICA_SYSCALL_RETURN, result );
12.102 + long_write( AICA_SYSCALL, -1 );
12.103 + }
12.104 + } while( 1 );
12.105 +}
12.106 \ No newline at end of file
13.1 --- a/test/testspu.c Wed Aug 13 10:27:49 2008 +0000
13.2 +++ b/test/testspu.c Wed Aug 13 10:32:00 2008 +0000
13.3 @@ -38,7 +38,7 @@
13.4
13.5 long_write( SPUDMACTL1(chan), 1 );
13.6 long_write( SPUDMACTL2(chan), 1 );
13.7 - if( asic_wait( EVENT_SPU_DMA0 + chan ) != 0 ) {
13.8 + if( asic_wait( EVENT_G2_DMA0 + chan ) != 0 ) {
13.9 fprintf( stderr, "Timeout waiting for DMA event\n" );
13.10 dump_spu_regs();
13.11 return -1;
13.12 @@ -60,7 +60,7 @@
13.13
13.14 long_write( SPUDMACTL1(chan), 1 );
13.15 long_write( SPUDMACTL2(chan), 1 );
13.16 - if( asic_wait( EVENT_SPU_DMA0 + chan ) != 0 ) {
13.17 + if( asic_wait( EVENT_G2_DMA0 + chan ) != 0 ) {
13.18 fprintf( stderr, "Timeout waiting for DMA event\n" );
13.19 dump_spu_regs();
13.20 return -1;
.