Test upstream RISC-V SMP candidates on HERE VP

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.
This commit is contained in:
alex committed 2026-11-27 11:13:06 +01:00
1 parent f3dc14193c
commit 054251f810
12 files changed
+363 -251

No files matched your search

+33 -1
View File
@@ -24,7 +24,10 @@ if(NOT THREADX_TEST_SIMULATOR)
"THREADX_TEST_SIMULATOR is not set. Configure with -DTHREADX_TEST_SIMULATOR=/path/to/riscv-vp")
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "risc-v32")
if(ARCH_FLAGS MATCHES "-march=(rv(32|64)gc)")
set(THREADX_TEST_ISA "${CMAKE_MATCH_1}_m")
set(THREADX_TEST_FP_CONTEXT ON)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "risc-v32")
set(THREADX_TEST_ISA "rv32imac_m")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "risc-v64")
set(THREADX_TEST_ISA "rv64imac_m")
@@ -216,6 +219,18 @@ add_library(threadx_smp_regression_weak_defaults OBJECT
function(add_threadx_regression_test TEST_SOURCE)
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
if(TEST_NAME STREQUAL "threadx_thread_basic_execution_test")
# This fixture calls _tx_thread_timeout directly. Use its existing pointer
# setup on ports where ULONG cannot carry a thread pointer.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${TEST_SOURCE}")
file(READ "${TEST_SOURCE}" test_source_text)
string(REPLACE "#if defined(_WIN64)\n {\n TX_TIMER_INTERNAL timeout_timer;"
"#if defined(_WIN64) || defined(TX_TIMER_EXTENSION_PTR_DEFINED)\n {\n TX_TIMER_INTERNAL timeout_timer;"
test_source_text "${test_source_text}")
set(TEST_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.c")
file(GENERATE OUTPUT "${TEST_SOURCE}" CONTENT "${test_source_text}")
endif()
if(TEST_NAME STREQUAL "threadx_initialize_kernel_setup_test")
set(test_libraries threadx_smp)
else()
@@ -249,6 +264,10 @@ function(add_threadx_regression_test TEST_SOURCE)
-p tb.top.num_cores=4
)
set_tests_properties(${TEST_NAME} PROPERTIES TIMEOUT 60)
if(TEST_NAME STREQUAL "threadx_byte_memory_thread_contention_test")
# The four-hart VP has to simulate more than 1,280 ticks of active work.
set_tests_properties(${TEST_NAME} PROPERTIES TIMEOUT 120)
endif()
endfunction()
foreach(test_case ${TX_REGRESSION_CASES})
@@ -259,3 +278,16 @@ add_custom_target(
threadx_smp_regression_build
DEPENDS ${TX_REGRESSION_TARGETS}
)
if(THREADX_TEST_FP_CONTEXT)
setup_target(vp_smp_context
SOURCES vp_smp_context.c vp_smp_context_fp.S
LIBRARIES threadx_smp_regression_weak_defaults threadx_smp)
target_include_directories(vp_smp_context PRIVATE ${THREADX4TGFS_ROOT}/port/moonlight/inc)
add_test(NAME vp_smp_context COMMAND ${THREADX_TEST_SIMULATOR}
--isa=${THREADX_TEST_ISA}
-f $<TARGET_FILE:vp_smp_context>
-m 60s
-p tb.top.num_cores=4)
set_tests_properties(vp_smp_context PROPERTIES TIMEOUT 60)
endif()