more progress on psyq program build script

This commit is contained in:
2025-08-05 21:54:09 -04:00
parent 5da7c2e3b0
commit 713ad6a57a
4 changed files with 54 additions and 43 deletions
+3 -3
View File
@@ -17,14 +17,14 @@ scoop install lua
[armips](https://github.com/Kingcom/armips) [armips](https://github.com/Kingcom/armips)
* Supports doing bare-metal assembly for the ps1 * 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. [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 * 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. * Has hookups to behaving as a gdb server which can be utilized with the gdb client in vscode.
* Supports symbolic info emitted by armips * 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/) [MIPS Toolchain (from pscx-redux)](https://static.grumpycoder.net/pixel/mips/)
@@ -39,9 +39,9 @@ scoop install lua
* Original official SDK * Original official SDK
* Modernized using obj parser to extract info for GNU toolchain usage. * 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) * 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. * 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/) [psyq_include_what_you_use](https://github.com/johnbaumann/psyq_include_what_you_use/)
@@ -86,10 +86,12 @@ $path_nugget_common = join-path $path_nugget 'common'
function assemble-unit { param( function assemble-unit { param(
[string]$ [string] $unit,
[stirng] $link_module,
[string[]]$include_paths,
[string[]]$user_compile_args
) )
$compile_args_asm += $f_debug $compile_args = @(
$compile_args_asm += @(
$f_arch_mips1, $f_arch_mips1,
$f_arch_abi32, $f_arch_abi32,
$f_arch_fp32, $f_arch_fp32,
@@ -100,34 +102,33 @@ function assemble-unit { param(
$f_arch_no_shared, $f_arch_no_shared,
$f_arch_no_stack_prot $f_arch_no_stack_prot
) )
$compile_args_asm += $f_no_stdlib $compile_args += $f_no_stdlib
$compile_args_asm += $f_freestanding $compile_args += $f_freestanding
$compile_args_asm += ($f_include + $path_nugget) $compile_args += ($f_include + $path_nugget)
$compile_args += $user_compile_args
} }
function compile-unit { param( 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 write-host "--- Compiling Source Files ---" -ForegroundColor Cyan
$compile_args_c = @() $compile_args = @()
$compile_args_c += $f_debug $compile_args += $f_code_sections
$compile_args_c += $f_optimize_none $compile_args += $f_data_sections
# $compile_args_c += $f_optimize_size
$compile_args_c += $f_code_sections $compile_args += $f_wno_attributes
$compile_args_c += $f_data_sections $compile_args += $f_freestanding
$compile_args += $f_omit_frame_ptr
$compile_args_c += $f_wno_attributes $compile_args += $f_no_builtin
$compile_args_c += $f_freestanding $compile_args += $f_no_stdlib
$compile_args_c += $f_omit_frame_ptr $compile_args += $f_no_strict_alias
$compile_args_c += $f_no_builtin $compile_args += @(
$compile_args_c += $f_no_stdlib
$compile_args_c += $f_no_strict_alias
$compile_args_c += @(
$f_arch_mips1, $f_arch_mips1,
$f_arch_abi32, $f_arch_abi32,
$f_arch_fp32, $f_arch_fp32,
@@ -140,19 +141,21 @@ function compile-unit { param(
$f_arch_no_stack_prot $f_arch_no_stack_prot
) )
$path_psyq_imyu_inc = join-path $path_psyq_imyu 'include' $path_psyq_imyu_inc = join-path $path_psyq_imyu 'include'
$compile_args_c += ($f_include + $path_psyq_imyu_inc) $compile_args += ($f_include + $path_psyq_imyu_inc)
$compile_args_c += ($f_include + $path_nugget) $compile_args += ($f_include + $path_nugget)
$compile_args += $user_compile_args
} }
function link-modules { param( function link-modules { param(
[string] $elf,
[string[]]$link_modules,
[string[]]$user_link_args
) )
write-host "`n--- Linking Modules ---" -ForegroundColor Cyan write-host "`n--- Linking Modules ---" -ForegroundColor Cyan
$link_args = @() $link_args = @()
$link_args += $f_debug
# $link_args += $f_optimize_size
$link_args += $f_no_stdlib $link_args += $f_no_stdlib
$link_args += $f_link_static $link_args += $f_link_static
@@ -172,8 +175,6 @@ function link-modules { param(
$path_psyq_lib = join-path $path_psyq 'lib' $path_psyq_lib = join-path $path_psyq 'lib'
$link_args += ($f_link_lib_path + $path_psyq_lib) $link_args += ($f_link_lib_path + $path_psyq_lib)
$link_args += $link_modules
$map = join-path $path_build 'SpinningCube.map' $map = join-path $path_build 'SpinningCube.map'
$link_args += ($f_link_pass_through_prefix + $f_link_mapfile + $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 += ($f_link_lib + $lib)
} }
$link_args += $link_modules
$elf = Join-Path $path_build "SpinningCube.elf" $elf = Join-Path $path_build "SpinningCube.elf"
$final_link_args = @($link_args) + ($f_output + $elf) $final_link_args = @($link_args) + ($f_output + $elf)
@@ -215,9 +218,9 @@ function link-modules { param(
& $Compiler $final_link_args & $Compiler $final_link_args
if ($LASTEXITCODE -ne 0) { write-error "Linking failed. Aborting."; exit 1 } if ($LASTEXITCODE -ne 0) { write-error "Linking failed. Aborting."; exit 1 }
} }
function make-binary { param( function make-binary { param(
[string]$elf,
[string]$exe
) )
Write-Host "`n--- Creating Final Binary ---" -ForegroundColor Cyan Write-Host "`n--- Creating Final Binary ---" -ForegroundColor Cyan
$exe = join-path $path_build "SpinningCube.ps-exe" $exe = join-path $path_build "SpinningCube.ps-exe"
@@ -229,6 +232,14 @@ function make-binary { param(
} }
function build-hello_psyqo { 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 build-hello_psyqo
+3 -3
View File
@@ -30,7 +30,7 @@ push-location $path_armips_build
& cmake --build . --config Debug & cmake --build . --config Debug
pop-location pop-location
$path_pcsx_redux_vsprojects = join-path $path_pcsx_redux 'vscprojects' # $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_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'