Add "crt-lite", builds an empty crt0 without C runtime stuff (such as malloc and devoptap).

This commit is contained in:
James Benton 2017-05-05 17:00:33 +01:00
parent def87c9bc8
commit cbb377b4b6
4 changed files with 54 additions and 0 deletions

View File

@ -21,6 +21,16 @@ externalproject_add(crt
-DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR>
-DCMAKE_TOOLCHAIN_FILE:string=${CMAKE_SOURCE_DIR}/cmake/wut-toolchain.cmake)
externalproject_add(crt-lite
SOURCE_DIR "${CMAKE_SOURCE_DIR}/crt-lite"
CMAKE_GENERATOR "Unix Makefiles"
INSTALL_DIR "${CMAKE_BINARY_DIR}/staging"
CMAKE_CACHE_ARGS
-DDEVKITPPC:string=${DEVKITPPC}
-DWUT_ROOT:string=${CMAKE_SOURCE_DIR}
-DCMAKE_INSTALL_PREFIX:string=<INSTALL_DIR>
-DCMAKE_TOOLCHAIN_FILE:string=${CMAKE_SOURCE_DIR}/cmake/wut-toolchain.cmake)
externalproject_add(rpl
SOURCE_DIR "${CMAKE_SOURCE_DIR}/rpl"
CMAKE_GENERATOR "Unix Makefiles"

View File

@ -70,3 +70,17 @@ macro(add_rpx target)
COMMAND "${ELF_TO_RPL}" "$<TARGET_FILE:${target}>" "$<TARGET_FILE:${target}>.rpx"
COMMENT "Converting $<TARGET_FILE:${target}> to rpx")
endmacro()
macro(add_rpx_lite target)
add_executable(${ARGV})
set_target_properties(${target} PROPERTIES
COMPILE_FLAGS "${RPX_COMPILE_FLAGS}"
LINK_FLAGS "${RPX_LINKER_FLAGS}")
target_include_directories(${target} PRIVATE "${WUT_ROOT}/include")
target_link_libraries(${target} crt-lite)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${ELF_TO_RPL}" "$<TARGET_FILE:${target}>" "$<TARGET_FILE:${target}>.rpx"
COMMENT "Converting $<TARGET_FILE:${target}> to rpx")
endmacro()

15
crt-lite/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.2)
project(wut-crt-lite)
include(../cmake/wut-toolchain.cmake)
set_property(SOURCE crt0.S PROPERTY LANGUAGE C)
add_library(crt-lite
crt0.S)
set_target_properties(crt-lite PROPERTIES
COMPILE_FLAGS "-fno-builtin -ffreestanding"
LINKER_FLAGS "-fPIC")
target_include_directories(crt-lite PRIVATE "../include")
install(TARGETS crt-lite ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")

15
crt-lite/crt0.s Normal file
View File

@ -0,0 +1,15 @@
.extern main
.extern exit
.global _start
_start:
bl main
b exit
.global __wrap___eabi
__wrap___eabi:
blr
.global __init
__init:
blr