From 713ad6a57a280bf2c7a2c12f718e3cd34761b361 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 5 Aug 2025 21:54:09 -0400 Subject: [PATCH] more progress on psyq program build script --- readme.md | 6 +- scripts/{build_psyqo.ps1 => build_psyq.ps1} | 85 ++++++++++++--------- scripts/{debug_psyqo.ps1 => debug_psyq.ps1} | 0 scripts/update_deps.ps1 | 6 +- 4 files changed, 54 insertions(+), 43 deletions(-) rename scripts/{build_psyqo.ps1 => build_psyq.ps1} (83%) rename scripts/{debug_psyqo.ps1 => debug_psyq.ps1} (100%) diff --git a/readme.md b/readme.md index 233db6b..b22f60f 100644 --- a/readme.md +++ b/readme.md @@ -17,14 +17,14 @@ scoop install lua [armips](https://github.com/Kingcom/armips) * Supports doing bare-metal assembly for the ps1 -* `scoop install armips` +* `scoop install armips` or just clone and build.. [pscx-redux](https://github.com/grumpycoders/pcsx-redux/): A collection of tools, research, hardware design, and libraries aiming at development and reverse engineering on the PlayStation 1. * Used as the runtime sandbox emulated the ps1 * Has hookups to behaving as a gdb server which can be utilized with the gdb client in vscode. * Supports symbolic info emitted by armips -* pysq library has been sucessfully adjusted for modern compiler usage (see: src/) +* pysq library has been sucessfully adjusted for modern compiler usage (see: `src/`) [MIPS Toolchain (from pscx-redux)](https://static.grumpycoder.net/pixel/mips/) @@ -39,9 +39,9 @@ scoop install lua * Original official SDK * Modernized using obj parser to extract info for GNU toolchain usage. -* Can be utilized effectively with the includes below * Can either grab from arthus [psyq-4.7-converted-full.7z](https://psx.arthus.net/sdk/Psy-Q/psyq-4.7-converted-full.7z) or [psyq-4_7-converted-light.zip](psyq-4_7-converted-light.zip) * The light version omits the link modules (object files), just keeps the static archives. +* Can be utilized effectively with the includes below [psyq_include_what_you_use](https://github.com/johnbaumann/psyq_include_what_you_use/) diff --git a/scripts/build_psyqo.ps1 b/scripts/build_psyq.ps1 similarity index 83% rename from scripts/build_psyqo.ps1 rename to scripts/build_psyq.ps1 index 9acb669..867870f 100644 --- a/scripts/build_psyqo.ps1 +++ b/scripts/build_psyq.ps1 @@ -85,11 +85,13 @@ $path_psyq_imyu = join-path $path_third_party 'psyq-iwyu' $path_nugget_common = join-path $path_nugget 'common' -function assemble-unit { param( - [string]$ - ) - $compile_args_asm += $f_debug - $compile_args_asm += @( +function assemble-unit { param( + [string] $unit, + [stirng] $link_module, + [string[]]$include_paths, + [string[]]$user_compile_args +) + $compile_args = @( $f_arch_mips1, $f_arch_abi32, $f_arch_fp32, @@ -100,34 +102,33 @@ function assemble-unit { param( $f_arch_no_shared, $f_arch_no_stack_prot ) - $compile_args_asm += $f_no_stdlib - $compile_args_asm += $f_freestanding - $compile_args_asm += ($f_include + $path_nugget) + $compile_args += $f_no_stdlib + $compile_args += $f_freestanding + $compile_args += ($f_include + $path_nugget) + + $compile_args += $user_compile_args } - function compile-unit { param( - [string]$module, - [string]$unit + [string]$unit, + [string]$link_module, + [string[]]$include_paths, + [string[]]$user_compile_args ) write-host "--- Compiling Source Files ---" -ForegroundColor Cyan - $compile_args_c = @() - $compile_args_c += $f_debug - $compile_args_c += $f_optimize_none - # $compile_args_c += $f_optimize_size + $compile_args = @() + $compile_args += $f_code_sections + $compile_args += $f_data_sections - $compile_args_c += $f_code_sections - $compile_args_c += $f_data_sections - - $compile_args_c += $f_wno_attributes - $compile_args_c += $f_freestanding - $compile_args_c += $f_omit_frame_ptr - $compile_args_c += $f_no_builtin - $compile_args_c += $f_no_stdlib - $compile_args_c += $f_no_strict_alias - $compile_args_c += @( + $compile_args += $f_wno_attributes + $compile_args += $f_freestanding + $compile_args += $f_omit_frame_ptr + $compile_args += $f_no_builtin + $compile_args += $f_no_stdlib + $compile_args += $f_no_strict_alias + $compile_args += @( $f_arch_mips1, $f_arch_abi32, $f_arch_fp32, @@ -140,19 +141,21 @@ function compile-unit { param( $f_arch_no_stack_prot ) $path_psyq_imyu_inc = join-path $path_psyq_imyu 'include' - $compile_args_c += ($f_include + $path_psyq_imyu_inc) - $compile_args_c += ($f_include + $path_nugget) + $compile_args += ($f_include + $path_psyq_imyu_inc) + $compile_args += ($f_include + $path_nugget) + + $compile_args += $user_compile_args + + } - function link-modules { param( - - - ) + [string] $elf, + [string[]]$link_modules, + [string[]]$user_link_args +) write-host "`n--- Linking Modules ---" -ForegroundColor Cyan $link_args = @() - $link_args += $f_debug - # $link_args += $f_optimize_size $link_args += $f_no_stdlib $link_args += $f_link_static @@ -172,8 +175,6 @@ function link-modules { param( $path_psyq_lib = join-path $path_psyq 'lib' $link_args += ($f_link_lib_path + $path_psyq_lib) - $link_args += $link_modules - $map = join-path $path_build 'SpinningCube.map' $link_args += ($f_link_pass_through_prefix + $f_link_mapfile + $map) @@ -206,6 +207,8 @@ function link-modules { param( $link_args += ($f_link_lib + $lib) } + $link_args += $link_modules + $elf = Join-Path $path_build "SpinningCube.elf" $final_link_args = @($link_args) + ($f_output + $elf) @@ -215,9 +218,9 @@ function link-modules { param( & $Compiler $final_link_args if ($LASTEXITCODE -ne 0) { write-error "Linking failed. Aborting."; exit 1 } } - function make-binary { param( - + [string]$elf, + [string]$exe ) Write-Host "`n--- Creating Final Binary ---" -ForegroundColor Cyan $exe = join-path $path_build "SpinningCube.ps-exe" @@ -229,6 +232,14 @@ function make-binary { param( } function build-hello_psyqo { + $compile_args = @() + $compile_args += $f_debug + $compile_args += $f_optimize_none + # $compile_args += $f_optimize_size + + $link_args += $f_debug + # $link_args += $f_optimize_size + } build-hello_psyqo diff --git a/scripts/debug_psyqo.ps1 b/scripts/debug_psyq.ps1 similarity index 100% rename from scripts/debug_psyqo.ps1 rename to scripts/debug_psyq.ps1 diff --git a/scripts/update_deps.ps1 b/scripts/update_deps.ps1 index f3a5518..f487659 100644 --- a/scripts/update_deps.ps1 +++ b/scripts/update_deps.ps1 @@ -30,7 +30,7 @@ push-location $path_armips_build & cmake --build . --config Debug pop-location -$path_pcsx_redux_vsprojects = join-path $path_pcsx_redux 'vscprojects' -$path_pcsx_redux_binaries = join-path $path_pcsx_redux_vsprojects 'x64/Release' +# $path_pcsx_redux_vsprojects = join-path $path_pcsx_redux 'vscprojects' +# $path_pcsx_redux_binaries = join-path $path_pcsx_redux_vsprojects 'x64/Release' -$psyq_obj_parser = join-path $path_pcsx_redux_binaries 'psyq-obj-parser.exe' +# $psyq_obj_parser = join-path $path_pcsx_redux_binaries 'psyq-obj-parser.exe'