Saturn builds

This commit is contained in:
2026-06-21 10:00:30 -05:00
parent 0438011ca3
commit 7f8bcf07e8
82 changed files with 1153 additions and 629 deletions
+10 -7
View File
@@ -48,13 +48,16 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# SH-2 core flags: big-endian (-mb), SH-2 ISA (-m2), no FPU
set(_SAT_C_FLAGS "-m2 -mb -fno-builtin -fomit-frame-pointer")
# SH-2 core flags: big-endian (-mb), SH-2 ISA (-m2), no FPU.
# -ffunction-sections/-fdata-sections enable --gc-sections to eliminate
# unreachable code at the function level (e.g. yyjson FILE* API paths).
set(_SAT_C_FLAGS "-m2 -mb -fno-builtin -fomit-frame-pointer -ffunction-sections -fdata-sections -Os")
set(CMAKE_C_FLAGS_INIT "${_SAT_C_FLAGS}")
# Yaul installs yaul.specs to ${YAUL_INSTALL_ROOT}/sh2eb-elf/lib/ and
# ldscripts/yaul.x to ${YAUL_INSTALL_ROOT}/sh2eb-elf/lib/ldscripts/.
# GCC searches ${prefix}/${target}/lib/ for specs, so -specs=yaul.specs works
# without an absolute path once the SDK is installed.
# Linker flags: gc-sections, no startup/default libs (Yaul provides crt0/init;
# we supply all needed libraries explicitly). -nodefaultlibs prevents cmake/gcc
# from injecting -lc (which does not exist in the Yaul sysroot).
# --start-group/--end-group are placed in target_link_libraries in
# targets/saturn.cmake so they actually wrap the archive list.
set(CMAKE_EXE_LINKER_FLAGS_INIT
"-specs=yaul.specs -Wl,--gc-sections -nostartfiles -Wl,--start-group -Wl,--end-group")
"-Wl,--gc-sections -nostartfiles -nodefaultlibs")