Build the SMP library and Moonlight board support against a selectable ThreadX source tree. Keep the pinned regression matrix and add RV32GC and RV64GC context tests. Adapt the direct timeout fixture to the RV64 timer extension and give timing-sensitive cases more phase coverage on HERE VP.
66 lines
2.7 KiB
CMake
66 lines
2.7 KiB
CMake
cmake_minimum_required(VERSION 3.24)
|
|
project(threadx_smp LANGUAGES C ASM)
|
|
|
|
get_filename_component(THREADX_SMP_DEFAULT_SOURCE_DIR
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../../third-party/threadx" ABSOLUTE)
|
|
set(THREADX_SMP_SOURCE_DIR "${THREADX_SMP_DEFAULT_SOURCE_DIR}"
|
|
CACHE PATH "ThreadX source tree used for the SMP port")
|
|
get_filename_component(THREADX_SMP_SOURCE_DIR "${THREADX_SMP_SOURCE_DIR}" ABSOLUTE)
|
|
set(THREADX_COMMON_SMP_DIR "${THREADX_SMP_SOURCE_DIR}/common_smp")
|
|
set(THREADX_SMP_GNU_PORT "${THREADX_SMP_SOURCE_DIR}/ports_smp/${THREADX_ARCH}_smp/gnu")
|
|
add_library(threadx_smp STATIC)
|
|
|
|
if(EXISTS "${THREADX_SMP_GNU_PORT}/CMakeLists.txt")
|
|
set(TX_SMP_USER_FILE "${THREADX_COMMON_SMP_DIR}/inc/tx_user_sample.h"
|
|
CACHE FILEPATH "ThreadX user configuration for the SMP build")
|
|
configure_file("${TX_SMP_USER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/smp_inc/tx_user.h" COPYONLY)
|
|
target_include_directories(threadx_smp PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/smp_inc")
|
|
target_include_directories(threadx_smp PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../moonlight/inc")
|
|
target_compile_definitions(threadx_smp PUBLIC TX_INCLUDE_USER_DEFINE_FILE TX_MPCORE)
|
|
target_sources(threadx_smp PRIVATE
|
|
src/trap_entry.S
|
|
src/tx_initialize_low_level.c
|
|
src/tx_thread_smp_core_preempt.c
|
|
)
|
|
add_subdirectory("${THREADX_SMP_GNU_PORT}" upstream_port)
|
|
add_subdirectory("${THREADX_COMMON_SMP_DIR}" upstream_common)
|
|
return()
|
|
endif()
|
|
|
|
if(NOT THREADX_SMP_SOURCE_DIR STREQUAL THREADX_SMP_DEFAULT_SOURCE_DIR)
|
|
message(FATAL_ERROR "The selected ThreadX source tree has no ${THREADX_ARCH} GNU SMP port")
|
|
endif()
|
|
if(NOT EXISTS "${THREADX_COMMON_SMP_DIR}")
|
|
message(FATAL_ERROR "could not find ThreadX SMP sources, is the submodule checked out?")
|
|
endif()
|
|
|
|
set(THREADX_SMP_CUSTOM_INC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/inc
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../moonlight/inc # needed for Moonlight SMP support headers
|
|
)
|
|
|
|
set(THREADX_SMP_CUSTOM_SRC
|
|
src/trap_entry.S
|
|
src/tx_initialize_low_level.c
|
|
src/tx_port_offset_check.c
|
|
src/tx_thread_context_restore.S
|
|
src/tx_thread_context_save.S
|
|
src/tx_thread_interrupt_control.S
|
|
src/tx_thread_schedule.S
|
|
src/tx_thread_smp_core_get.S
|
|
src/tx_thread_smp_core_preempt.c
|
|
src/tx_thread_smp_current_state_get.S
|
|
src/tx_thread_smp_current_thread_get.S
|
|
src/tx_thread_smp_initialize_wait.S
|
|
src/tx_thread_smp_low_level_initialize.S
|
|
src/tx_thread_smp_protect.S
|
|
src/tx_thread_smp_unprotect.S
|
|
src/tx_thread_stack_build.S
|
|
src/tx_thread_system_return.S
|
|
src/tx_timer_interrupt.c
|
|
)
|
|
|
|
target_sources(threadx_smp PRIVATE ${THREADX_SMP_CUSTOM_SRC})
|
|
target_include_directories(threadx_smp PUBLIC ${THREADX_SMP_CUSTOM_INC})
|
|
add_subdirectory("${THREADX_COMMON_SMP_DIR}" upstream_common)
|