get asm symbolic source debugging working with gnu assembler and gdb psyq builds

This commit is contained in:
2025-08-06 14:18:11 -04:00
parent b9494d219f
commit 8b252c4e68
6 changed files with 21 additions and 15 deletions
+16 -7
View File
@@ -17,7 +17,7 @@ if ((test-path $path_build) -eq $false) {
# Assumes 'mipsel-none-elf' toolchain is in your system's PATH.
$Prefix = "mipsel-none-elf"
$Compiler = "$($Prefix)-gcc"
$Assembler = $Compiler
$Assembler = "$($Prefix)-as"
$Objcopy = "$($Prefix)-objcopy"
# --- GCC/MIPS Flags ---
@@ -78,7 +78,7 @@ $f_objcopy_format = "-O"
$path_pcsx_redux = join-path $path_toolchain 'pcsx-redux'
$path_nugget = join-path $path_pcsx_redux 'src/mips'
# $path_nugget_common = join-path $path_nugget 'common'
$path_nugget_common = join-path $path_nugget 'common'
$path_psyq = join-path $path_toolchain 'psyq-4_7'
$path_psyq_iwyu = join-path $path_toolchain 'psyq_iwyu'
$path_psyq_imyu_inc = join-path $path_psyq_iwyu 'include'
@@ -111,7 +111,7 @@ function assemble-unit { param(
write-host "Assembling '$unit' -> '$link_module'" -ForegroundColor Cyan
$assemble_args | ForEach-Object { Write-Host "`t$_" -ForegroundColor Green }
& $Assembler $assemble_args
& $Compiler $assemble_args
if ($LASTEXITCODE -ne 0) { write-error "Compilation failed for $unit. Aborting."; exit 1 }
}
function compile-unit { param(
@@ -147,7 +147,8 @@ function compile-unit { param(
$compile_args += $user_compile_args
$compile_args += $f_compile, $unit, ($f_output + $link_module)
$compile_args += $f_compile
$compile_args += $unit, ($f_output + $link_module)
write-host "Compiling '$unit' -> '$link_module'" -ForegroundColor Cyan
$compile_args | ForEach-Object { Write-Host "`t$_" -ForegroundColor Green }
@@ -216,10 +217,14 @@ function link-modules { param(
$final_link_args = @($link_args) + ($f_output + $elf)
$base_name = [System.IO.Path]::GetFileNameWithoutExtension($elf)
$dasm = "$(join-path $path_build $base_name).dasm"
write-host "Linking modules into '$elf'" -ForegroundColor Cyan
$final_link_args += ($f_link_pass_through_prefix + $f_link_end_group)
$final_link_args | foreach-object { write-host $_ }
& $Compiler $final_link_args
& mipsel-none-elf-objdump.exe -W $elf >> $dasm
if ($LASTEXITCODE -ne 0) { write-error "Linking failed. Aborting."; exit 1 }
}
function make-binary { param(
@@ -270,14 +275,18 @@ function build-graphis_hello {
$path_module = join-path $path_code 'graphics_hello_psyq'
$src_asm = join-path $path_module 'hello_gpu.asm'
$src_asm_crt = join-path $path_nugget_common 'crt0/crt0.s'
$module_asm_crt = join-path $path_build 'crt0.o'
$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_args += ($f_include + $path_code)
assemble-unit $src_asm $module_asm $includes $assemble_args
assemble-unit $src_asm_crt $module_asm_crt $includes $assemble_args
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'
@@ -295,7 +304,7 @@ function build-graphis_hello {
$link_args = @()
$link_args += $f_debug
# $link_args += $f_optimize_size
link-modules @($module_asm, $module_c) $elf $link_args
link-modules @($module_asm_crt, $module_asm, $module_c) $elf $link_args
make-binary $elf $exe
}
build-graphis_hello