mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
ld: generate linker scripts; add fxcg50_fastload.ld
This commit is contained in:
parent
45881995e9
commit
ac6b1c7d70
3 changed files with 31 additions and 9 deletions
|
@ -250,25 +250,41 @@ add_compile_options(-Wall -Wextra -std=c11 -Os -fstrict-volatile-bitfields -mtas
|
||||||
|
|
||||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||||
add_compile_definitions(FX9860G)
|
add_compile_definitions(FX9860G)
|
||||||
add_library(gint-fx STATIC ${SOURCES_COMMON} ${SOURCES_FX} ${ASSETS_FX})
|
|
||||||
set(NAME "gint-fx")
|
set(NAME "gint-fx")
|
||||||
set(LINKER_SCRIPT "fx9860g.ld")
|
set(LINKER_SCRIPTS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/fx9860g.ld")
|
||||||
|
add_library(gint-fx STATIC ${SOURCES_COMMON} ${SOURCES_FX} ${ASSETS_FX}
|
||||||
|
${LINKER_SCRIPTS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
|
||||||
add_compile_definitions(FXCG50)
|
add_compile_definitions(FXCG50)
|
||||||
add_library(gint-cg STATIC ${SOURCES_COMMON} ${SOURCES_CG} ${ASSETS_CG})
|
|
||||||
set(NAME "gint-cg")
|
set(NAME "gint-cg")
|
||||||
set(LINKER_SCRIPT "fxcg50.ld")
|
set(LINKER_SCRIPTS
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/fxcg50.ld"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/fxcg50_fastload.ld")
|
||||||
|
add_library(gint-cg STATIC ${SOURCES_COMMON} ${SOURCES_CG} ${ASSETS_CG}
|
||||||
|
${LINKER_SCRIPTS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties("${NAME}" PROPERTIES OUTPUT_NAME "${NAME}")
|
set_target_properties("${NAME}" PROPERTIES OUTPUT_NAME "${NAME}")
|
||||||
|
|
||||||
|
# Generate linker scripts
|
||||||
|
macro(generate_linker_script OUTPUT INPUT OPTIONS)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}"
|
||||||
|
COMMAND ${FXSDK_TOOLCHAIN}cpp "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}"
|
||||||
|
-P -C -traditional-cpp ${OPTIONS} -o "${OUTPUT}"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}")
|
||||||
|
endmacro()
|
||||||
|
generate_linker_script("fx9860g.ld" "fx9860g.ld.c" "")
|
||||||
|
generate_linker_script("fxcg50.ld" "fxcg50.ld.c" "")
|
||||||
|
generate_linker_script("fxcg50_fastload.ld" "fxcg50.ld.c" "-DFXCG50_FASTLOAD")
|
||||||
|
|
||||||
# Library file
|
# Library file
|
||||||
install(TARGETS "${NAME}" DESTINATION "${FXSDK_LIB}")
|
install(TARGETS "${NAME}" DESTINATION "${FXSDK_LIB}")
|
||||||
# Linker script
|
# Linker scripts
|
||||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_SCRIPT}"
|
install(FILES ${LINKER_SCRIPTS} DESTINATION "${FXSDK_LIB}")
|
||||||
DESTINATION "${FXSDK_LIB}")
|
|
||||||
# Headers
|
# Headers
|
||||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||||
DESTINATION "${FXSDK_INCLUDE}"
|
DESTINATION "${FXSDK_INCLUDE}"
|
||||||
|
|
|
@ -10,10 +10,16 @@ OUTPUT_FORMAT(elf32-sh)
|
||||||
/* Located in core/start.c */
|
/* Located in core/start.c */
|
||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
|
|
||||||
|
#ifdef FXCG50_FASTLOAD
|
||||||
|
# define _ROM_REGION 0x8c200000
|
||||||
|
#else
|
||||||
|
# define _ROM_REGION 0x00300000
|
||||||
|
#endif
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
/* Userspace mapping of the add-in (without G3A header) */
|
/* Userspace mapping of the add-in (without G3A header) */
|
||||||
rom (rx): o = 0x00300000, l = 2M
|
rom (rx): o = _ROM_REGION, l = 2M
|
||||||
/* Static RAM; stack grows down from the end of this region.
|
/* Static RAM; stack grows down from the end of this region.
|
||||||
The first 5k (0x1400 bytes) are reserved by gint for the VBR space,
|
The first 5k (0x1400 bytes) are reserved by gint for the VBR space,
|
||||||
which is loaded dynamically and accessed through P1 */
|
which is loaded dynamically and accessed through P1 */
|
||||||
|
@ -31,7 +37,7 @@ SECTIONS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* First address to be mapped to ROM */
|
/* First address to be mapped to ROM */
|
||||||
_brom = 0x00300000;
|
_brom = ORIGIN(rom);
|
||||||
/* Size of ROM mappings */
|
/* Size of ROM mappings */
|
||||||
_srom = SIZEOF(.text) + SIZEOF(.rodata)
|
_srom = SIZEOF(.text) + SIZEOF(.rodata)
|
||||||
+ SIZEOF(.gint.drivers) + SIZEOF(.gint.blocks);
|
+ SIZEOF(.gint.drivers) + SIZEOF(.gint.blocks);
|
Loading…
Reference in a new issue