Files
ThreadX4TGFS/port/moonlight/CMakeLists.txt
Eyck-Alexander Jentzsch 7307a86860 adds ISR check that is closer to productive code
This approach patches the existing trap handler to call the test routine
2026-03-21 20:27:16 +01:00

63 lines
1.9 KiB
CMake

set(MOONLIGHT_ROOT ${CMAKE_CURRENT_LIST_DIR})
set(THREADX4TGFS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
set(MOONLIGHT_SRC_DIR ${MOONLIGHT_ROOT}/src)
set(MOONLIGHT_INC_DIR ${MOONLIGHT_ROOT}/inc)
if(NOT DEFINED MOONLIGHT_TRAP_SOURCE)
set(MOONLIGHT_TRAP_SOURCE ${MOONLIGHT_SRC_DIR}/trap_non_vectored.c)
endif()
set(MOONLIGHT_PLATFORM_SOURCES
${THREADX4TGFS_ROOT}/port/picolibc/port.c
${MOONLIGHT_SRC_DIR}/bootup.c
${MOONLIGHT_SRC_DIR}/board.c
${MOONLIGHT_TRAP_SOURCE}
${MOONLIGHT_SRC_DIR}/exception.c
${MOONLIGHT_SRC_DIR}/vector_table.c)
add_library(moonlight_platform_defaults INTERFACE)
target_include_directories(moonlight_platform_defaults INTERFACE
${MOONLIGHT_INC_DIR}
${THREADX4TGFS_ROOT}/src)
target_compile_options(moonlight_platform_defaults INTERFACE
-ffreestanding
-fno-builtin
-fdata-sections
-ffunction-sections)
target_link_directories(moonlight_platform_defaults INTERFACE
${THREADX4TGFS_ROOT}/src)
if(NX_DEBUG)
target_compile_definitions(moonlight_platform_defaults INTERFACE
NX_DEBUG
NX_DEBUG_PACKET)
endif()
add_library(moonlight_platform_common OBJECT
${MOONLIGHT_PLATFORM_SOURCES})
target_link_libraries(moonlight_platform_common PUBLIC
moonlight_platform_defaults
c
threadx)
if(DEFINED NETXDUO_CUSTOM_PORT)
add_library(moonlight_network_driver OBJECT
${MOONLIGHT_SRC_DIR}/mnrs_network_driver.c)
target_link_libraries(moonlight_network_driver PUBLIC
moonlight_platform_defaults
c
threadx
netxduo)
endif()
function(target_add_moonlight_platform TARGET)
target_link_libraries(${TARGET} PRIVATE moonlight_platform_common)
endfunction()
function(target_add_moonlight_network_driver TARGET)
if(NOT TARGET moonlight_network_driver)
message(FATAL_ERROR "moonlight_network_driver requires netxduo to be available in this build")
endif()
target_link_libraries(${TARGET} PRIVATE moonlight_network_driver)
endfunction()