1- #! /usr/bin/env python3
1+ #!/usr/bin/env python3
22
33# SPDX-FileCopyrightText: Copyright 2025 polyproxy
44# SPDX-License-Identifier: MIT
4343
4444EE_COMMON_INCLUDES = "-Iinclude -Isrc -Iinclude/rtl/common -Iinclude/rtl/ee -Iinclude/rtl/ee_gcc -Iinclude/rtl/ee_gcc/gcc-lib"
4545IOP_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
4748EE_COMPILER_FLAGS = "-O2 -G8 -g -Wa,-Iinclude"
4849# We need to get rid of symbols on the C++ code to have a match.
4950EE_COMPILER_FLAGS_CXX = "-O2 -G8 -x c++ -fno-exceptions -fno-strict-aliasing -Wa,-Iinclude"
50-
5151IOP_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
5354EE_COMPILE_CMD = f"{ EE_COMPILER_DIR } /ee-gcc -c { EE_COMMON_INCLUDES } { EE_COMPILER_FLAGS } "
5455EE_COMPILE_CMD_CXX = f"{ EE_COMPILER_DIR } /ee-gcc -c { EE_COMMON_INCLUDES } { EE_COMPILER_FLAGS_CXX } "
55-
5656IOP_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
5859CROSS = "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
627641if __name__ == "__main__" :
628642 parser = argparse .ArgumentParser (description = "Configure the project" )
0 commit comments