Skip to content

Commit a5ac297

Browse files
committed
prlib: microcode setup
1 parent 2cd1659 commit a5ac297

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1840
-104
lines changed

config/p3.jul12.checksum.sha1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6883b00102f831881b6dcdea38b30ee1e91ee0a3 build/SCPS_150.17.rom
1+
8e7899f42ff2690362889da6cbf957e0faac608a build/SCPS_150.17.rom

config/p3.jul12.slinky.yaml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ settings:
99
- .symtab
1010
- .strtab
1111

12+
discard_wildcard_section: False
13+
sections_denylist:
14+
- .reginfo
15+
- .MIPS.abiflags
16+
- .gnu.attributes
17+
- .pdr
18+
1219
#sections_start_alignment: {
1320
# .vutext: 64,
1421
# .reginfo: 16,
@@ -30,7 +37,7 @@ segments:
3037
alloc_sections: [.text]
3138
files:
3239
- { path: asm/sdk/crt0.s.o }
33-
- { path: asm/sdk/tmp.s.o }
40+
- { path: asm/sdk/libgcc.s.o }
3441

3542
- { path: src/dbug/dbgmsg.c.o }
3643
- { path: src/dbug/syori.c.o }
@@ -139,9 +146,10 @@ segments:
139146

140147
- name: vutext
141148
alloc_sections: [.vutext]
149+
keep_sections: True
142150
subalign: 16
143151
files:
144-
- { path: asm/data/vutext.s.o }
152+
- { path: src/prlib/vu1/vump_common.dsm.o }
145153

146154
# # TODO: .reginfo should go here.
147155
# - name: reginfo
@@ -151,7 +159,7 @@ segments:
151159
# keep_sections: True
152160
# files:
153161
# - { path: asm/sdk/crt0.s.o }
154-
# - { path: asm/sdk/tmp.s.o }
162+
# - { path: asm/sdk/libgcc.s.o }
155163

156164
# - { path: src/dbug/dbgmsg.c.o }
157165
# - { path: src/dbug/syori.c.o }
@@ -260,9 +268,10 @@ segments:
260268

261269
- name: data
262270
alloc_sections: [.data]
271+
segment_start_align: 0x80
263272
files:
264273
- { path: asm/sdk/crt0.s.o }
265-
- { path: asm/data/sdk/tmp.data.s.o }
274+
- { path: asm/data/sdk/libgcc.data.s.o }
266275

267276
- { path: src/dbug/dbgmsg.c.o }
268277
- { path: src/dbug/syori.c.o }
@@ -377,13 +386,19 @@ segments:
377386

378387
- { path: asm/data/sdk/newlib.data.s.o }
379388

380-
- { path: asm/data/vudata.s.o }
389+
- name: vudata
390+
alloc_sections: [.vudata]
391+
keep_sections: True
392+
subalign: 16
393+
files:
394+
- { path: src/prlib/vu1/vump_common.dsm.o }
381395

382396
- name: rodata
383397
alloc_sections: [.rodata]
398+
segment_start_align: 0x80
384399
files:
385400
- { path: asm/sdk/crt0.s.o }
386-
- { path: asm/sdk/tmp.s.o }
401+
- { path: asm/sdk/libgcc.s.o }
387402

388403
- { path: src/dbug/dbgmsg.c.o }
389404
- { path: src/dbug/syori.c.o }
@@ -492,14 +507,16 @@ segments:
492507

493508
- name: gcc_except_table
494509
alloc_sections: [.rodata]
510+
segment_start_align: 0x80
495511
files:
496512
- { path: asm/data/gcc_except_table.rodata.s.o }
497513

498514
- name: lit8
499515
alloc_sections: [.lit8]
516+
segment_start_align: 0x80
500517
files:
501518
- { path: asm/sdk/crt0.s.o }
502-
- { path: asm/sdk/tmp.s.o }
519+
- { path: asm/sdk/libgcc.s.o }
503520

504521
- { path: src/dbug/dbgmsg.c.o }
505522
- { path: src/dbug/syori.c.o }
@@ -608,9 +625,10 @@ segments:
608625

609626
- name: lit4
610627
alloc_sections: [.lit4]
628+
segment_start_align: 0x80
611629
files:
612630
- { path: asm/sdk/crt0.s.o }
613-
- { path: asm/sdk/tmp.s.o }
631+
- { path: asm/sdk/libgcc.s.o }
614632

615633
- { path: src/dbug/dbgmsg.c.o }
616634
- { path: src/dbug/syori.c.o }
@@ -719,9 +737,10 @@ segments:
719737

720738
- name: sdata
721739
alloc_sections: [.sdata]
740+
segment_start_align: 0x80
722741
files:
723742
- { path: asm/sdk/crt0.s.o }
724-
- { path: asm/sdk/tmp.s.o }
743+
- { path: asm/sdk/libgcc.s.o }
725744

726745
- { path: src/dbug/dbgmsg.c.o }
727746
- { path: src/dbug/syori.c.o }
@@ -832,9 +851,10 @@ segments:
832851
- name: sbss
833852
alloc_sections: [.sbss, .scommon]
834853
noload_sections: [.sbss, .scommon]
854+
segment_start_align: 0x80
835855
files:
836856
- { path: asm/sdk/crt0.s.o }
837-
- { path: asm/sdk/tmp.s.o }
857+
- { path: asm/sdk/libgcc.s.o }
838858

839859
- { path: src/dbug/dbgmsg.c.o }
840860
- { path: src/dbug/syori.c.o }
@@ -944,9 +964,10 @@ segments:
944964
- name: bss
945965
alloc_sections: [.bss]
946966
noload_sections: [.bss, COMMON]
967+
segment_start_align: 0x80
947968
files:
948969
- { path: asm/data/sdk/crt0.bss.s.o }
949-
- { path: asm/sdk/tmp.s.o }
970+
- { path: asm/sdk/libgcc.s.o }
950971

951972
- { path: src/dbug/dbgmsg.c.o }
952973
- { path: src/dbug/syori.c.o }
@@ -1053,7 +1074,14 @@ segments:
10531074

10541075
- { path: asm/data/sdk/scelib.bss.s.o }
10551076
- { path: asm/data/sdk/newlib.bss.s.o }
1056-
1077+
1078+
- name: vubss
1079+
alloc_sections: [.vubss]
1080+
keep_sections: True
1081+
subalign: 16
1082+
files:
1083+
- { path: src/prlib/vu1/vump_common.dsm.o }
1084+
10571085
- name: mfifo
10581086
alloc_sections: [.mfifo]
10591087
subalign: 0x10000

config/p3.jul12.symbol_addrs.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ ob = 0x00399d48; // size:0x18
1111
reg_frame = 0x001000c8; // type:func
1212
dereg_frame = 0x00100100; // type:func
1313

14+
frame_table = 0x0017a900;
15+
__CTOR_LIST__ = 0x0017a928;
16+
__DTOR_LIST__ = 0x0017a950;
17+
1418
// dbug/dbgmsg.c
1519
DbgMsgInit = 0x00100130; // type:func
1620
DbgMsgClear = 0x001001c8; // type:func
@@ -2221,10 +2225,10 @@ _t8NaMATRIX3Zfi4i4$IDENT
22212225

22222226
//
22232227
//
2224-
// ** VU MICROCODE (.vutext) **
2228+
// ** VU MICROCODE (.vutext/.vudata) **
22252229
//
22262230
//
2227-
vump_dmatag = 0x00178040;
2231+
vump_dmatag = 0x00178040; // defined:true
22282232

22292233
//
22302234
//
@@ -2417,8 +2421,6 @@ __moddi3 = 0x00169b00; // type:func
24172421
__udivdi3 = 0x0016a1c8; // type:func
24182422
__umoddi3 = 0x0016a798; // type:func
24192423

2420-
__DTOR_LIST__ = 0x0017a950;
2421-
24222424
// sce/ee/gcc/src/gcc/build/gcc/dp-bit.c
24232425
dpadd = 0x0016b0e8; // type:func
24242426
dpsub = 0x0016b140; // type:func

config/p3.jul12.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: PaRappa the Rapper 2 (NTSC-J) (July 12th prototype)
2-
#sha1: e693c3968afc22dfcb4cc4529aceb7c4f4921a94
3-
sha1: 6883b00102f831881b6dcdea38b30ee1e91ee0a3
2+
sha1: 8e7899f42ff2690362889da6cbf957e0faac608a
43
options:
54
# paths
65
basename: SCPS_150.17
@@ -52,7 +51,7 @@ segments:
5251
subsegments:
5352
# .text
5453
- [0x0, asm, sdk/crt0]
55-
- [0xC8, asm, sdk/tmp]
54+
- [0xC8, asm, sdk/libgcc]
5655

5756
- [0x130, c, dbug/dbgmsg]
5857
- [0x838, c, dbug/syori]
@@ -181,11 +180,10 @@ segments:
181180
- [0x652D0, asm, sdk/newlib]
182181

183182
# .vutext
184-
- [0x78040, vutext, vutext]
185-
# - [0x7A890, databin, pad]
183+
- { start: 0x78040, type: vutext, use_src_path: True, name: prlib/vu1/vump_common }
186184

187185
# .data
188-
- [0x7A900, data, sdk/tmp]
186+
- [0x7A900, data, sdk/libgcc]
189187

190188
- [0x7A970, .data, dbug/dbgmsg]
191189
- [0x7B9E0, .data, dbug/vramsave]

configure.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env python3
1+
#!/usr/bin/env python3
22

33
# SPDX-FileCopyrightText: Copyright 2025 polyproxy
44
# SPDX-License-Identifier: MIT
@@ -43,17 +43,18 @@
4343

4444
EE_COMMON_INCLUDES = "-Iinclude -Isrc -Iinclude/rtl/common -Iinclude/rtl/ee -Iinclude/rtl/ee_gcc -Iinclude/rtl/ee_gcc/gcc-lib"
4545
IOP_COMMON_INCLUDES = "-Iinclude -Isrc/iop_mdl/wp2cd/iop -Iinclude/rtl/common -Iinclude/rtl/iop -Iinclude/rtl/iop_gcc -Iinclude/rtl/iop_gcc/gcc-lib"
46+
DVP_COMMON_INCLUDES = "-Isrc/prlib/vu1"
4647

4748
EE_COMPILER_FLAGS = "-O2 -G8 -g -Wa,-Iinclude"
4849
# We need to get rid of symbols on the C++ code to have a match.
4950
EE_COMPILER_FLAGS_CXX = "-O2 -G8 -x c++ -fno-exceptions -fno-strict-aliasing -Wa,-Iinclude"
50-
5151
IOP_COMPILER_FLAGS = f"-B {TOOLS_DIR}/toolchain/iop-gcc281/lib/gcc-lib/mipsel-scei-elfl/2.8.1/ -O0 -G0 -g -Wa,-Iinclude"
52+
DVP_COMPILER_FLAGS = "" # None (at the moment)
5253

5354
EE_COMPILE_CMD = f"{EE_COMPILER_DIR}/ee-gcc -c {EE_COMMON_INCLUDES} {EE_COMPILER_FLAGS}"
5455
EE_COMPILE_CMD_CXX = f"{EE_COMPILER_DIR}/ee-gcc -c {EE_COMMON_INCLUDES} {EE_COMPILER_FLAGS_CXX}"
55-
5656
IOP_COMPILE_CMD = f"{IOP_COMPILER_DIR}/iop-gcc -c {IOP_COMMON_INCLUDES} {IOP_COMPILER_FLAGS}"
57+
DVP_COMPILE_CMD = f"{EE_COMPILER_DIR}/ee-dvp-as {DVP_COMMON_INCLUDES} {DVP_COMPILER_FLAGS}"
5758

5859
CROSS = "mips-linux-gnu-"
5960

@@ -218,7 +219,7 @@ def build(
218219
# Rules
219220
slinky_args = "--omit-version-comment"
220221
common_ld_args = "-EL -Map $mapfile -T $in -o $out"
221-
ee_ld_args = f"{common_ld_args} -T config/p3.jul12.misc.txt -T config/p3.jul12.vu_syms.txt -T config/p3.jul12.undefined_syms.txt"
222+
ee_ld_args = f"{common_ld_args} -T config/p3.jul12.misc.txt -T config/p3.jul12.undefined_syms.txt"
222223
wp2_ld_args = f"{common_ld_args} -T config/irx.wave2ps2.jul12.undefined_syms_auto.txt -T config/irx.wave2ps2.jul12.undefined_funcs_auto.txt -T config/irx.wave2ps2.jul12.undefined_syms.txt"
223224

224225
if not append:
@@ -269,6 +270,13 @@ def build(
269270
command=f"{IOP_COMPILE_CMD} $in -o $out && {CROSS}strip $out -N dummy-symbol-name",
270271
)
271272

273+
ninja.rule(
274+
"dvp_as",
275+
description="dvp_as $in",
276+
command=f"{DVP_COMPILE_CMD} $in -o $out && {CROSS}strip $out -N dummy-symbol-name",
277+
depfile="dvp.d",
278+
)
279+
272280
ninja.rule(
273281
"slink",
274282
description="slink $out",
@@ -299,6 +307,7 @@ def build(
299307
command=f"{CROSS}objcopy $in $out -O binary",
300308
)
301309

310+
task_dvp = "dvp_as"
302311
task_as = "ee_as" if not is_irx else "iop_as"
303312
task_cpp = "ee_cpp" if not is_irx else "iop_cpp"
304313
task_cc = "ee_cc" if not is_irx else "iop_cc"
@@ -322,6 +331,11 @@ def build(
322331
seg, splat.segtypes.common.data.CommonSegData
323332
):
324333
build(entry.object_path, entry.src_paths, task_as)
334+
#elif isinstance(seg, tools.splat_ext.vutext.PS2SegVutext):
335+
#elif isinstance(seg, splat.segtypes.ps2.vutext.PS2SegVutext):
336+
#elif type(seg).__name__ == "PS2SegVutext":
337+
elif seg.type == "vutext":
338+
build(entry.object_path, entry.src_paths, task_dvp)
325339
elif isinstance(seg, splat.segtypes.common.cpp.CommonSegCpp):
326340
build(entry.object_path, entry.src_paths, task_cpp)
327341
elif isinstance(seg, splat.segtypes.common.c.CommonSegC):
@@ -538,14 +552,14 @@ def build_objdiff_objects():
538552
f"python3 tools/buildtools/elf_patcher.py {target_path} gas"
539553
)
540554

541-
# Keep until splat #504 is merged
542-
asm_text = asm_path.read_text()
543-
asm_text = re.sub(r" ACC,", " $ACC,", asm_text)
544-
asm_text = re.sub(r" Q, ", " $Q, ", asm_text)
545-
asm_text = re.sub(r", Q\n", ", $Q\n", asm_text)
546-
asm_text = re.sub(r" R, ", " $R, ", asm_text)
547-
asm_text = re.sub(r", R\n", ", $R\n", asm_text)
548-
asm_path.write_text(asm_text)
555+
# ~~Keep until splat #504 is merged~~
556+
# asm_text = asm_path.read_text()
557+
# asm_text = re.sub(r" ACC,", " $ACC,", asm_text)
558+
# asm_text = re.sub(r" Q, ", " $Q, ", asm_text)
559+
# asm_text = re.sub(r", Q\n", ", $Q\n", asm_text)
560+
# asm_text = re.sub(r" R, ", " $R, ", asm_text)
561+
# asm_text = re.sub(r", R\n", ", $R\n", asm_text)
562+
# asm_path.write_text(asm_text)
549563

550564
target_path.parent.mkdir(parents=True, exist_ok=True)
551565

@@ -622,7 +636,7 @@ def prepare_rom_from_elfs(elfs: list[Path]):
622636

623637
if elf == Path(f"iso/{P3_BASENAME}"):
624638
with open(f"{elf}.rom", "rb+") as f:
625-
f.truncate(0x1b9e034) # Remove .mfifo end alignment
639+
f.truncate(0x1b9e040) # Remove .mfifo end alignment
626640

627641
if __name__ == "__main__":
628642
parser = argparse.ArgumentParser(description="Configure the project")

docs/build.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333

3434
After running `ninja`, you should see something like the following:
3535
```
36-
[254/257] sha1sum config/irx.wave2ps2.jul12.checksum.sha1
36+
[238/248] sha1sum config/irx.wave2ps2.jul12.checksum.sha1
3737
build/WAVE2PS2.IRX.rom: OK
38-
[257/257] sha1sum config/p3.jul12.checksum.sha1
38+
[248/248] sha1sum config/p3.jul12.checksum.sha1
3939
build/SCPS_150.17.rom: OK
4040
```
4141

dvp.d

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
build/src/prlib/vu1/vump_common.dsm.o: src/prlib/vu1/vump_common.dsm \
2+
src/prlib/vu1/vump_common.vsm \
3+
src/prlib/vu1/vump_normal.vsm \
4+
src/prlib/vu1/vump_bothface.vsm \
5+
src/prlib/vu1/vump_contour.vsm \
6+
src/prlib/vu1/vump_refmap.vsm \
7+
src/prlib/vu1/vump_screen.vsm \
8+
src/prlib/vu1/vump_antiline.vsm \
9+
src/prlib/vu1/vump_menderer_create_texture.vsm \
10+
src/prlib/vu1/vump_menderer_draw_mesh.vsm

progress/menu_progress.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"schemaVersion": 1, "label": "menu", "message": "69.2513%", "color": "yellow"}
1+
{"schemaVersion": 1, "label": "menu", "message": "69.7860%", "color": "yellow"}

0 commit comments

Comments
 (0)