From c052253b0ed541e6d8430445c12789541b006d08 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 5 Aug 2025 23:34:34 -0400 Subject: [PATCH] setup graphics_hello_psyq --- .vscode/c_cpp_properties.json | 23 ++++++++++++++++++ .vscode/launch.json | 24 ------------------- code/graphics_hello_psyq/hello_gpu.c | 6 +++++ code/graphics_hello_psyq/hello_gpu.s | 1 + code/hello_psyq/hello_psyq.s | 2 ++ scripts/build_psyq.ps1 | 36 ++++++++++++++++++++++++++-- 6 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 code/graphics_hello_psyq/hello_gpu.c create mode 100644 code/graphics_hello_psyq/hello_gpu.s diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..165c800 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,23 @@ +{ + "configurations": [ + { + "name": "The Usual", + "includePath": [ + "${env:AppData}/mips/mips/include", + "${workspaceFolder}/toolchain/pcsx-redux/src/mips", + "${workspaceFolder}/toolchain/psyq-4_7/include" + ], + "cStandard": "c17", + "defines": [ + "__STDC_HOSTED__ = 0" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "intelliSenseMode": "gcc-x86" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 533e342..cd83f89 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,30 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "name": "Debug: Spinning Cube", - "type": "gdb", - "request": "attach", - "target": "localhost:3333", - "remote": true, - "cwd": "${workspaceRoot}/psxdev_sample/SpinningCube/build", - "valuesFormatting": "parseText", - "stopAtConnect": true, - "gdbpath": "gdb-multiarch", - "windows": { - "gdbpath": "gdb-multiarch.exe" - }, - "osx": { - "gdbpath": "gdb" - }, - "executable": "${workspaceRoot}/psxdev_sample/SpinningCube/build/SpinningCube.elf", - "autorun": [ - "monitor reset shellhalt", - "load SpinningCube.elf", - "tbreak main", - "continue" - ] - }, { "name": "Debug: Hello Psy-Q!", "type": "gdb", diff --git a/code/graphics_hello_psyq/hello_gpu.c b/code/graphics_hello_psyq/hello_gpu.c new file mode 100644 index 0000000..430ddd9 --- /dev/null +++ b/code/graphics_hello_psyq/hello_gpu.c @@ -0,0 +1,6 @@ +#include + +int main(void) +{ + return 0; +} diff --git a/code/graphics_hello_psyq/hello_gpu.s b/code/graphics_hello_psyq/hello_gpu.s new file mode 100644 index 0000000..1d226d2 --- /dev/null +++ b/code/graphics_hello_psyq/hello_gpu.s @@ -0,0 +1 @@ +.include "./toolchain/pcsx-redux/src/mips/common/crt0/crt0.s" diff --git a/code/hello_psyq/hello_psyq.s b/code/hello_psyq/hello_psyq.s index 1d226d2..b39d3d8 100644 --- a/code/hello_psyq/hello_psyq.s +++ b/code/hello_psyq/hello_psyq.s @@ -1 +1,3 @@ .include "./toolchain/pcsx-redux/src/mips/common/crt0/crt0.s" + + diff --git a/scripts/build_psyq.ps1 b/scripts/build_psyq.ps1 index 95d8aa6..7250dc6 100644 --- a/scripts/build_psyq.ps1 +++ b/scripts/build_psyq.ps1 @@ -20,7 +20,7 @@ $Compiler = "$($Prefix)-gcc" $Assembler = $Compiler $Objcopy = "$($Prefix)-objcopy" -# --- Abstracted GCC/MIPS Flags --- +# --- GCC/MIPS Flags --- # General Compiler Flags $f_compile = "-c" @@ -262,4 +262,36 @@ function build-hello_psyqo { link-modules @($module_hello_psyq, $module_hello_psyq_crt) $elf_hello_psyq $link_args make-binary $elf_hello_psyq $exe_hello_psyq } -build-hello_psyqo +# build-hello_psyqo + +function build-double_buffer { + $includes += @() + + $path_module = join-path $path_code 'graphics_hello_psyq' + + $src_asm = join-path $path_module 'hello_gpu.s' + $module_asm = join-path $path_build 'hello_gpu.o' + + $assemble_args = @() + $assemble_args += $f_debug + $assemble_args += $f_optimize_none + assemble-unit $src_asm $module_asm $includes $assemble_args + + $src_c = join-path $path_module 'hello_gpu.c' + $module_c = join-path $path_build 'hello_gpu_c.o' + + $compile_args = @() + $compile_args += $f_debug + $compile_args += $f_optimize_none + # $compile_args += $f_optimize_size + compile-unit $src_c $module_c $includes $compile_args + + $elf = join-path $path_build 'hello_gpu.elf' + $exe = join-path $path_build 'hello_gpu.ps-exe' + + $link_args += $f_debug + # $link_args += $f_optimize_size + link-modules @($module_asm, $module_c) $elf $link_args + make-binary $elf $exe +} +build-double_buffer