Compare commits
17 Commits
27438ef6a5
...
91632bcdee
| Author | SHA1 | Date | |
|---|---|---|---|
| 91632bcdee | |||
| 5b2da239d2 | |||
| 1165785154 | |||
| ba39d23a18 | |||
| d97e71ca83 | |||
| 4c15a3e15f | |||
| 68057507c9 | |||
| 32df317b38 | |||
| 12ae01cda2 | |||
| ff0f81e9c0 | |||
| f989e21bad | |||
| e3a7a9ccaf | |||
| c717297b30 | |||
| b16a0ed956 | |||
| 21f95341af | |||
| 86025e020d | |||
| 764ccd4a52 |
+13
-26
@@ -4,43 +4,44 @@ cmake_minimum_required(VERSION 3.21)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
include(${CMAKE_TOOLCHAIN_FILE})
|
||||
###############################################################################
|
||||
add_subdirectory(port/moonlight)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
###############################################################################
|
||||
# Adds picolibc
|
||||
#set(CMAKE_SYSTEM_PROCESSOR riscv)
|
||||
set(__THREAD_LOCAL_STORAGE OFF)
|
||||
add_subdirectory(third-party/picolibc)
|
||||
#add_subdirectory(picolibc/semihost)
|
||||
target_link_libraries(c PUBLIC gcc)
|
||||
target_sources(c PRIVATE ${CMAKE_CURRENT_LIST_DIR}/port/picolibc/port.c)
|
||||
target_link_libraries(c PUBLIC moonlight gcc)
|
||||
###############################################################################
|
||||
# Adds threadx
|
||||
set(THREADX_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx)
|
||||
add_subdirectory(third-party/threadx)
|
||||
target_link_libraries(threadx PUBLIC c)
|
||||
target_link_libraries(threadx PUBLIC c moonlight)
|
||||
#Adds threadx_smp
|
||||
add_subdirectory(port/threadx_smp)
|
||||
target_link_libraries(threadx_smp PUBLIC c)
|
||||
target_link_libraries(threadx_smp PUBLIC c moonlight)
|
||||
# Adds netxduo
|
||||
set(NETXDUO_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/threadx)
|
||||
set(NETXDUO_CUSTOM_PORT ${CMAKE_CURRENT_LIST_DIR}/port/netxduo)
|
||||
set(NXD_ENABLE_FILE_SERVERS OFF)
|
||||
set(NX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/port/threadx/inc/nx_user.h)
|
||||
add_subdirectory(third-party/netxduo)
|
||||
target_link_libraries(netxduo PUBLIC c)
|
||||
if(NX_DEBUG)
|
||||
target_compile_definitions(netxduo PRIVATE NX_DEBUG NX_DEBUG_PACKET NX_ENABLE_PACKET_DEBUG_INFO)
|
||||
endif()
|
||||
if(TX_TRACE)
|
||||
target_compile_definitions(threadx PUBLIC TX_ENABLE_EVENT_TRACE)
|
||||
target_compile_definitions(threadx_smp PUBLIC TX_ENABLE_EVENT_TRACE)
|
||||
target_compile_definitions(netxduo PUBLIC TX_ENABLE_EVENT_TRACE)
|
||||
endif()
|
||||
###############################################################################
|
||||
project(threadx_demo C ASM)
|
||||
option(NX_DEBUG "compile netxduo debug output in" OFF)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
option(TX_TRACE "Enable dump of traces to be read by TraceX" OFF)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
|
||||
|
||||
add_subdirectory(port/moonlight)
|
||||
|
||||
function(setup_target TARGET)
|
||||
set(options)
|
||||
set(oneValueArgs PLATFORM_TARGET)
|
||||
set(multiValueArgs LIBRARIES SOURCES)
|
||||
cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if(ST_UNPARSED_ARGUMENTS)
|
||||
@@ -51,16 +52,6 @@ function(setup_target TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
if(ST_PLATFORM_TARGET)
|
||||
target_add_moonlight_platform(${TARGET} PLATFORM_TARGET ${ST_PLATFORM_TARGET})
|
||||
else()
|
||||
target_add_moonlight_platform(${TARGET})
|
||||
endif()
|
||||
|
||||
if("netxduo" IN_LIST ST_LIBRARIES)
|
||||
target_add_moonlight_network_driver(${TARGET})
|
||||
endif()
|
||||
|
||||
if(ST_SOURCES)
|
||||
target_sources(${TARGET} PRIVATE ${ST_SOURCES})
|
||||
endif()
|
||||
@@ -70,10 +61,6 @@ function(setup_target TARGET)
|
||||
endif()
|
||||
|
||||
target_link_options(${TARGET} PRIVATE
|
||||
-nostartfiles
|
||||
-nostdlib
|
||||
-T ${CMAKE_SOURCE_DIR}/src/${TARGET_MEM}.lds
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=${CMAKE_BINARY_DIR}/${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
@@ -86,5 +73,5 @@ function(setup_target TARGET)
|
||||
endfunction()
|
||||
|
||||
setup_target(thread_demo LIBRARIES threadx SOURCES src/thread_demo/main.c)
|
||||
setup_target(tcp_demo LIBRARIES threadx netxduo SOURCES src/tcp_demo/main.c)
|
||||
setup_target(smp_demo PLATFORM_TARGET moonlight_platform_common_smp LIBRARIES threadx_smp SOURCES src/thread_demo/main.c)
|
||||
setup_target(tcp_demo LIBRARIES netxduo threadx SOURCES src/tcp_demo/main.c)
|
||||
setup_target(smp_demo LIBRARIES threadx_smp SOURCES src/thread_demo/main.c)
|
||||
|
||||
@@ -1,91 +1,41 @@
|
||||
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)
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(moonlight LANGUAGES C)
|
||||
|
||||
if(NOT DEFINED MOONLIGHT_TRAP_SOURCE) # Hook to use vectored traps, also used in regression testing
|
||||
|
||||
set(MOONLIGHT_ROOT ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(MOONLIGHT_INC_DIR ${MOONLIGHT_ROOT}/inc)
|
||||
set(MOONLIGHT_SRC_DIR ${MOONLIGHT_ROOT}/src)
|
||||
set(MOONLIGHT_LDS_DIR ${MOONLIGHT_ROOT}/lds)
|
||||
|
||||
if(NOT DEFINED TARGET_MEM)
|
||||
set(TARGET_MEM "ram" CACHE STRING "memory map to use")
|
||||
endif()
|
||||
|
||||
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
|
||||
add_library(moonlight STATIC
|
||||
${MOONLIGHT_SRC_DIR}/board.c
|
||||
${MOONLIGHT_TRAP_SOURCE}
|
||||
${MOONLIGHT_SRC_DIR}/bootup.c
|
||||
${MOONLIGHT_SRC_DIR}/exception.c
|
||||
${MOONLIGHT_SRC_DIR}/vector_table.c)
|
||||
${MOONLIGHT_TRAP_SOURCE}
|
||||
)
|
||||
|
||||
# define a basic library containing all generic board components
|
||||
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
|
||||
target_include_directories(moonlight PUBLIC ${MOONLIGHT_INC_DIR})
|
||||
target_link_directories(moonlight INTERFACE ${MOONLIGHT_LDS_DIR})
|
||||
|
||||
target_compile_options(moonlight
|
||||
PUBLIC
|
||||
-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()
|
||||
-ffunction-sections
|
||||
)
|
||||
|
||||
# helper to tie in different threadx runtimes
|
||||
function(moonlight_define_platform TARGET THREADX_TARGET)
|
||||
add_library(${TARGET} OBJECT
|
||||
${MOONLIGHT_PLATFORM_SOURCES})
|
||||
target_link_libraries(${TARGET} PUBLIC
|
||||
moonlight_platform_defaults
|
||||
c
|
||||
${THREADX_TARGET})
|
||||
endfunction()
|
||||
|
||||
if(TARGET threadx)
|
||||
moonlight_define_platform(moonlight_platform_common threadx)
|
||||
endif()
|
||||
|
||||
if(TARGET threadx_smp)
|
||||
moonlight_define_platform(moonlight_platform_common_smp threadx_smp)
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
# helper for consumers to inject moonlight as a dependency into a target
|
||||
function(target_add_moonlight_platform TARGET)
|
||||
set(options)
|
||||
set(oneValueArgs PLATFORM_TARGET)
|
||||
cmake_parse_arguments(TAMP "${options}" "${oneValueArgs}" "" ${ARGN})
|
||||
|
||||
if(TAMP_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "target_add_moonlight_platform(${TARGET} ...): unknown args: ${TAMP_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
if(NOT TAMP_PLATFORM_TARGET)
|
||||
if(NOT TARGET moonlight_platform_common)
|
||||
message(FATAL_ERROR "moonlight_platform_common is not available in this build; pass PLATFORM_TARGET explicitly")
|
||||
endif()
|
||||
set(TAMP_PLATFORM_TARGET moonlight_platform_common)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET} PRIVATE ${TAMP_PLATFORM_TARGET})
|
||||
endfunction()
|
||||
|
||||
# helper to inject the network driver into a target
|
||||
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()
|
||||
target_link_options(moonlight
|
||||
INTERFACE
|
||||
-nostartfiles
|
||||
-T ${MOONLIGHT_LDS_DIR}/${TARGET_MEM}.lds
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
int uart_putc(int ch);
|
||||
int uart_getc(void);
|
||||
int board_init(void);
|
||||
int register_irq_handler(unsigned irq_num, void (*handler)());
|
||||
@@ -33,4 +33,8 @@ static inline uint8_t uart_read(volatile uart_t* reg)
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline int uart_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* _DEVICES_UART_H */
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#include "csr.h"
|
||||
#include "platform.h"
|
||||
#include "uart.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
// needed by picolibc/port.c
|
||||
int uart_putc(int ch) {
|
||||
@@ -22,11 +20,6 @@ int uart_getc(void) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
int uart_init(void) {
|
||||
puts("[UART0] : Uart Init Done, this is Test output!");
|
||||
return 0;
|
||||
};
|
||||
|
||||
int board_init(void) {
|
||||
int ret;
|
||||
ret = uart_init();
|
||||
|
||||
+11
-59
@@ -6,20 +6,15 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <picotls.h>
|
||||
#include <aclint_ipi.h>
|
||||
#include <tx_port.h>
|
||||
#include <riscv-csr.h>
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C extern "C"
|
||||
#else
|
||||
#define EXTERN_C extern
|
||||
#endif
|
||||
#if defined(TX_THREAD_SMP_MAX_CORES) && (TX_THREAD_SMP_MAX_CORES > 1)
|
||||
#define BOOTUP_SMP_ENABLED
|
||||
#endif
|
||||
|
||||
// Generic C function pointer.
|
||||
typedef void(*function_t)(void) ;
|
||||
@@ -49,56 +44,15 @@ EXTERN_C void _start(void) __attribute__ ((naked,section(".text.boot")));
|
||||
|
||||
// Entry and exit points as C functions.
|
||||
EXTERN_C void _initialize(void) __attribute__ ((noreturn,section(".text.boot")));
|
||||
EXTERN_C void _secondary_sleep_forever(void) __attribute__ ((noreturn,section(".text.boot")));
|
||||
EXTERN_C void _secondary_initialize(void) __attribute__ ((noreturn,section(".text.boot"),weak));
|
||||
EXTERN_C void _exit(int exit_code) __attribute__ ((noreturn,noinline,weak));
|
||||
EXTERN_C void bootup_wake_secondary_cores(void) __attribute__ ((weak));
|
||||
|
||||
// Standard entry point, no arguments.
|
||||
extern int main(void);
|
||||
|
||||
#if defined BOOTUP_SMP_ENABLED
|
||||
EXTERN_C void _secondary_initialize(void) __attribute__ ((noreturn,section(".text.boot")));
|
||||
EXTERN_C void _secondary_ipi_trap(void) __attribute__ ((naked,noreturn,section(".text.boot")));
|
||||
EXTERN_C void _tx_thread_smp_initialize_wait(void) __attribute__ ((noreturn));
|
||||
|
||||
void _secondary_initialize(void) {
|
||||
csr_write_mtvec((uint_xlen_t)_secondary_ipi_trap);
|
||||
csr_set_bits_mie(MIE_MSI_BIT_MASK);
|
||||
csr_set_bits_mstatus(MSTATUS_MIE_BIT_MASK);
|
||||
|
||||
__asm__ volatile ("wfi");
|
||||
|
||||
csr_clr_bits_mstatus(MSTATUS_MIE_BIT_MASK);
|
||||
|
||||
_tx_thread_smp_initialize_wait();
|
||||
}
|
||||
|
||||
void _secondary_ipi_trap(void) {
|
||||
#if __riscv_xlen == 64
|
||||
__asm__ volatile ("addi sp, sp, -16;"
|
||||
"sd ra, 8(sp);"
|
||||
"call bootup_ipi_clear_handler;"
|
||||
"ld ra, 8(sp);"
|
||||
"addi sp, sp, 16;"
|
||||
"mret");
|
||||
#else
|
||||
__asm__ volatile ("addi sp, sp, -8;"
|
||||
"sw ra, 4(sp);"
|
||||
"call bootup_ipi_clear_handler;"
|
||||
"lw ra, 4(sp);"
|
||||
"addi sp, sp, 8;"
|
||||
"mret");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void bootup_wake_secondary_cores(void) {
|
||||
for (UINT core = 1; core < TX_THREAD_SMP_MAX_CORES; ++core) {
|
||||
send_ipi(core);
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((used)) void bootup_ipi_clear_handler(void) {
|
||||
set_aclint_msip(aclint, csr_read_mhartid(), 0);
|
||||
}
|
||||
#ifdef __THREAD_LOCAL_STORAGE
|
||||
EXTERN_C void _set_tls(uint8_t*) __attribute__ ((noreturn,section(".text.boot")));
|
||||
#endif
|
||||
|
||||
// The linker script will place this in the reset entry point.
|
||||
@@ -133,11 +87,7 @@ void _start(void) {
|
||||
"j 1b;"
|
||||
"2:;"
|
||||
"beqz t0, 3f;"
|
||||
#ifdef BOOTUP_SMP_ENABLED
|
||||
"jal zero, _secondary_initialize;"
|
||||
#else
|
||||
"jal zero, _secondary_sleep_forever;"
|
||||
#endif
|
||||
"3:;"
|
||||
"jal zero, _initialize;"
|
||||
: /* output: none %0 */
|
||||
@@ -163,9 +113,7 @@ void _initialize(void) {
|
||||
++entry) {
|
||||
(*entry)();
|
||||
}
|
||||
#ifdef BOOTUP_SMP_ENABLED
|
||||
bootup_wake_secondary_cores();
|
||||
#endif
|
||||
#ifdef __THREAD_LOCAL_STORAGE
|
||||
_set_tls(__tls_base)
|
||||
#endif
|
||||
@@ -179,7 +127,8 @@ void _initialize(void) {
|
||||
_exit(rc);
|
||||
}
|
||||
|
||||
void _secondary_sleep_forever(void) {
|
||||
void _secondary_initialize(void) {
|
||||
// sleep forever
|
||||
csr_clr_bits_mie(MIE_MTI_BIT_MASK);
|
||||
csr_clr_bits_mstatus(MSTATUS_MIE_BIT_MASK);
|
||||
while (1) {
|
||||
@@ -187,6 +136,9 @@ void _secondary_sleep_forever(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void bootup_wake_secondary_cores(void) {
|
||||
}
|
||||
|
||||
// This should never be called. Report the exit code through HTIF and idle the CPU.
|
||||
void _exit(int exit_code) {
|
||||
uintptr_t htif_exit_code = (((uintptr_t)(unsigned int)exit_code) << 1) | 1u;
|
||||
@@ -197,4 +149,4 @@ void _exit(int exit_code) {
|
||||
while (1) {
|
||||
__asm__ volatile ("wfi");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include "riscv-traps.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <tx_api.h>
|
||||
#include <tx_port.h>
|
||||
|
||||
#if __riscv_xlen == 64
|
||||
#define INTERRUPT_BIT 0x8000000000000000ull
|
||||
@@ -16,7 +14,6 @@
|
||||
#define OS_IS_SOFT_INT(mcause) (mcause == (0x3 | INTERRUPT_BIT))
|
||||
#define OS_IS_EXT_INT(mcause) (mcause == (0xb | INTERRUPT_BIT))
|
||||
|
||||
extern void _tx_timer_interrupt(void);
|
||||
extern uintptr_t exception(uintptr_t mcause, uintptr_t mepc, uintptr_t mtval);
|
||||
|
||||
void (*irq_handler[__riscv_xlen])();
|
||||
@@ -33,23 +30,6 @@ void trap_handler(uintptr_t mcause, uintptr_t mepc, uintptr_t mtval) {
|
||||
if(OS_IS_INTERRUPT(mcause)) {
|
||||
unsigned irq_id = mcause&(__riscv_xlen-1);
|
||||
switch(irq_id){
|
||||
case RISCV_INT_MTI:
|
||||
#ifdef NX_DEBUG
|
||||
printf("Timer interrupt being handled (pc=%lx)\n", mepc);
|
||||
#endif
|
||||
hwtimer_handler();
|
||||
_tx_timer_interrupt();
|
||||
break;
|
||||
#ifdef TX_THREAD_SMP_INTER_CORE_INTERRUPT
|
||||
case RISCV_INT_MSI:
|
||||
set_aclint_msip(aclint, csr_read_mhartid(), 0);
|
||||
break;
|
||||
#endif
|
||||
case RISCV_INT_MEI:
|
||||
puts("[INTERRUPT]: handler ext irq error!\n");
|
||||
while(1)
|
||||
;
|
||||
break;
|
||||
default:
|
||||
if(irq_handler[irq_id])
|
||||
irq_handler[irq_id]();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
target_sources(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
# {{BEGIN_TARGET_SOURCES}}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/mnrs_network_driver.c
|
||||
# {{END_TARGET_SOURCES}}
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/inc
|
||||
)
|
||||
@@ -136,9 +136,8 @@
|
||||
/* Configuration options for IPv6 */
|
||||
|
||||
/* Disable IPv6 processing in NetX Duo. */
|
||||
/*
|
||||
|
||||
#define NX_DISABLE_IPV6
|
||||
*/
|
||||
|
||||
/* Define the number of entries in IPv6 address pool. */
|
||||
/*
|
||||
@@ -1,8 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern void uart_putc(char c);
|
||||
extern int uart_getc(void);
|
||||
#include "board.h"
|
||||
|
||||
static int
|
||||
board_putc(char c, FILE *file)
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#required for tests to hook into the ISR path
|
||||
if(NOT DEFINED THREADX_LOW_LEVEL_INIT_SOURCE)
|
||||
set(THREADX_LOW_LEVEL_INIT_SOURCE
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_low_level.c)
|
||||
endif()
|
||||
|
||||
target_sources(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
# {{BEGIN_TARGET_SOURCES}}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_low_level.S
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/trap_entry.S
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE}
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_restore.S
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_context_save.S
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/tx_thread_interrupt_control.S
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
/* Yes, include the user defines in tx_user.h. The defines in this file may
|
||||
alternately be defined on the command line. */
|
||||
|
||||
#include "nx_user.h"
|
||||
#include "tx_user.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -7,12 +7,9 @@
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
**************************************************************************/
|
||||
|
||||
#include "csr.h"
|
||||
#include "tx_port.h"
|
||||
|
||||
.section .text
|
||||
.align 4
|
||||
#include "tx_port.h"
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@@ -89,75 +86,4 @@
|
||||
trap_handler:
|
||||
1:
|
||||
j 1b
|
||||
.section .text
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_initialize_low_level RISC-V64/GNU */
|
||||
/* 6.2.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is responsible for any low-level processor */
|
||||
/* initialization, including setting up interrupt vectors, setting */
|
||||
/* up a periodic timer interrupt source, saving the system stack */
|
||||
/* pointer for use in ISR processing later, and finding the first */
|
||||
/* available RAM memory address for tx_application_define. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _tx_initialize_kernel_enter ThreadX entry function */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 03-08-2023 Scott Larson Initial Version 6.2.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* VOID _tx_initialize_low_level(VOID)
|
||||
*/
|
||||
.global _tx_initialize_low_level
|
||||
.weak _tx_initialize_low_level
|
||||
.extern __heap_start
|
||||
.extern board_init
|
||||
_tx_initialize_low_level:
|
||||
STORE sp, _tx_thread_system_stack_ptr, t0 // Save system stack pointer
|
||||
|
||||
la t0, __heap_start // Pickup first free address
|
||||
STORE t0, _tx_initialize_unused_memory, t1 // Save unused memory address
|
||||
li t0, MSTATUS_MIE
|
||||
csrrc zero, mstatus, t0 // clear MSTATUS_MIE bit
|
||||
li t0, (MSTATUS_MPP_M | MSTATUS_MPIE )
|
||||
csrrs zero, mstatus, t0 // set MSTATUS_MPP, MPIE bit
|
||||
li t0, (MIE_MTIE | MIE_MSIE | MIE_MEIE)
|
||||
csrrs zero, mie, t0 // set mie
|
||||
#ifdef __riscv_flen
|
||||
li t0, MSTATUS_FS
|
||||
csrrs zero, mstatus, t0 // set MSTATUS_FS bit to open f/d isa in riscv
|
||||
fscsr x0
|
||||
#endif
|
||||
addi sp, sp, -8
|
||||
STORE ra, 0(sp)
|
||||
call board_init
|
||||
LOAD ra, 0(sp)
|
||||
addi sp, sp, 8
|
||||
la t0, trap_entry
|
||||
csrw mtvec, t0
|
||||
ret
|
||||
.section .text
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
#include "board.h"
|
||||
#include "csr.h"
|
||||
#include "hwtimer.h"
|
||||
#include "riscv-traps.h"
|
||||
#include "tx_port.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern CHAR __heap_start;
|
||||
extern void trap_entry(void);
|
||||
extern void _tx_timer_interrupt(void);
|
||||
|
||||
extern ULONG* _tx_thread_system_stack_ptr;
|
||||
extern ULONG* _tx_initialize_unused_memory;
|
||||
|
||||
void handle_RISCV_INT_MTI(void)
|
||||
{
|
||||
hwtimer_handler();
|
||||
_tx_timer_interrupt();
|
||||
}
|
||||
void handle_RISCV_INT_MEI()
|
||||
{
|
||||
puts("[INTERRUPT]: handler ext irq error!\n");
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
VOID _tx_initialize_low_level(VOID)
|
||||
{
|
||||
_tx_thread_system_stack_ptr = (VOID*)(ULONG)riscv_get_sp();
|
||||
_tx_initialize_unused_memory = (VOID*)&__heap_start;
|
||||
|
||||
// disable interrupts
|
||||
asm volatile("csrrc zero, mstatus, %0" : : "r"(MSTATUS_MIE));
|
||||
// set previous interrupt enable and previous priv mode to be set when executing "mret"
|
||||
asm volatile("csrrs zero, mstatus, %0" : : "r"(MSTATUS_MPP_M | MSTATUS_MPIE));
|
||||
// enable timer, software and external interrupts
|
||||
asm volatile("csrrs zero, mie, %0" : : "r"(MIE_MTIE | MIE_MSIE | MIE_MEIE));
|
||||
|
||||
#ifdef __riscv_flen
|
||||
// enable f extension and reset state
|
||||
asm volatile("csrrs zero, mstatus, %0" : : "r"(MSTATUS_FS));
|
||||
asm volatile("fscsr x0");
|
||||
#endif
|
||||
|
||||
board_init();
|
||||
register_irq_handler(RISCV_INT_MTI, handle_RISCV_INT_MTI);
|
||||
register_irq_handler(RISCV_INT_MEI, handle_RISCV_INT_MEI);
|
||||
|
||||
asm volatile("csrw mtvec, %0" : : "r"((uintptr_t)trap_entry));
|
||||
}
|
||||
@@ -10,8 +10,16 @@ set(THREADX_SMP_CUSTOM_INC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/inc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../moonlight/inc # needed for Moonlight SMP support headers
|
||||
)
|
||||
|
||||
#required for tests to hook into the ISR path
|
||||
if(NOT DEFINED THREADX_LOW_LEVEL_INIT_SOURCE)
|
||||
set(THREADX_LOW_LEVEL_INIT_SOURCE
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/tx_initialize_low_level.c)
|
||||
endif()
|
||||
|
||||
set(THREADX_SMP_CUSTOM_SRC
|
||||
src/tx_initialize_low_level.S
|
||||
src/trap_entry.S
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE}
|
||||
src/tx_thread_context_restore.S
|
||||
src/tx_thread_context_save.S
|
||||
src/tx_thread_interrupt_control.S
|
||||
|
||||
+10
-85
@@ -7,12 +7,9 @@
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
**************************************************************************/
|
||||
|
||||
#include "csr.h"
|
||||
#include "tx_port.h"
|
||||
|
||||
.section .text
|
||||
.align 4
|
||||
#include "tx_port.h"
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@@ -73,92 +70,20 @@
|
||||
|
||||
STORE x1, 28*REGBYTES(sp) // Store RA, 28*REGBYTES(because call will override ra [ra is a calle register in riscv])
|
||||
|
||||
call _tx_thread_context_save
|
||||
call _tx_thread_context_save
|
||||
|
||||
csrr a0, mcause
|
||||
csrr a1, mepc
|
||||
csrr a2, mtval
|
||||
addi sp, sp, -8
|
||||
STORE ra, 0(sp)
|
||||
call trap_handler
|
||||
LOAD ra, 0(sp)
|
||||
addi sp, sp, 8
|
||||
STORE ra, 0(sp)
|
||||
call trap_handler
|
||||
LOAD ra, 0(sp)
|
||||
addi sp, sp, 8
|
||||
call _tx_thread_context_restore
|
||||
// it will nerver return
|
||||
.weak trap_handler
|
||||
trap_handler:
|
||||
1:
|
||||
j 1b
|
||||
|
||||
.section .text
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_initialize_low_level RISC-V64/GNU */
|
||||
/* 6.2.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is responsible for any low-level processor */
|
||||
/* initialization, including setting up interrupt vectors, setting */
|
||||
/* up a periodic timer interrupt source, saving the system stack */
|
||||
/* pointer for use in ISR processing later, and finding the first */
|
||||
/* available RAM memory address for tx_application_define. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* _tx_initialize_kernel_enter ThreadX entry function */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 03-08-2023 Scott Larson Initial Version 6.2.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* VOID _tx_initialize_low_level(VOID)
|
||||
*/
|
||||
.global _tx_initialize_low_level
|
||||
.weak _tx_initialize_low_level
|
||||
.extern __heap_start
|
||||
.extern board_init
|
||||
_tx_initialize_low_level:
|
||||
STORE sp, _tx_thread_system_stack_ptr, t0 // Save system stack pointer
|
||||
|
||||
la t0, __heap_start // Pickup first free address
|
||||
STORE t0, _tx_initialize_unused_memory, t1 // Save unused memory address
|
||||
li t0, MSTATUS_MIE
|
||||
csrrc zero, mstatus, t0 // clear MSTATUS_MIE bit
|
||||
li t0, (MSTATUS_MPP_M | MSTATUS_MPIE )
|
||||
csrrs zero, mstatus, t0 // set MSTATUS_MPP, MPIE bit
|
||||
li t0, (MIE_MTIE | MIE_MSIE | MIE_MEIE)
|
||||
csrrs zero, mie, t0 // set mie
|
||||
#ifdef __riscv_flen
|
||||
li t0, MSTATUS_FS
|
||||
csrrs zero, mstatus, t0 // set MSTATUS_FS bit to open f/d isa in riscv
|
||||
fscsr x0
|
||||
#endif
|
||||
addi sp, sp, -8
|
||||
STORE ra, 0(sp)
|
||||
call board_init
|
||||
LOAD ra, 0(sp)
|
||||
addi sp, sp, 8
|
||||
la t0, trap_entry
|
||||
csrw mtvec, t0
|
||||
ret
|
||||
trap_handler:
|
||||
1:
|
||||
j 1b
|
||||
.section .text
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
#include "aclint.h"
|
||||
#include "aclint_ipi.h"
|
||||
#include "board.h"
|
||||
#include "csr.h"
|
||||
#include "hwtimer.h"
|
||||
#include "riscv-csr.h"
|
||||
#include "riscv-traps.h"
|
||||
#include "tx_port.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern CHAR __heap_start;
|
||||
extern void trap_entry(void);
|
||||
extern void _tx_timer_interrupt(void);
|
||||
|
||||
extern ULONG* _tx_thread_system_stack_ptr;
|
||||
extern ULONG* _tx_initialize_unused_memory;
|
||||
extern void _tx_thread_smp_initialize_wait(void) __attribute__((noreturn));
|
||||
|
||||
void handle_RISCV_INT_MTI(void)
|
||||
{
|
||||
hwtimer_handler();
|
||||
_tx_timer_interrupt();
|
||||
}
|
||||
|
||||
void handle_RISCV_INT_MEI()
|
||||
{
|
||||
puts("[INTERRUPT]: handler ext irq error!\n");
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef TX_THREAD_SMP_INTER_CORE_INTERRUPT
|
||||
void handle_RISCV_INT_MSI()
|
||||
{
|
||||
set_aclint_msip(aclint, csr_read_mhartid(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void __attribute__((used)) bootup_ipi_clear_handler(void)
|
||||
{
|
||||
set_aclint_msip(aclint, csr_read_mhartid(), 0);
|
||||
}
|
||||
|
||||
void _secondary_ipi_trap(void) __attribute__((naked, noreturn, section(".text.boot")));
|
||||
void _secondary_initialize(void) __attribute__((noreturn, section(".text.boot")));
|
||||
void bootup_wake_secondary_cores(void);
|
||||
|
||||
void _secondary_initialize(void)
|
||||
{
|
||||
csr_write_mtvec((uint_xlen_t)_secondary_ipi_trap);
|
||||
csr_set_bits_mie(MIE_MSI_BIT_MASK);
|
||||
csr_set_bits_mstatus(MSTATUS_MIE_BIT_MASK);
|
||||
|
||||
__asm__ volatile("wfi");
|
||||
|
||||
csr_clr_bits_mstatus(MSTATUS_MIE_BIT_MASK);
|
||||
|
||||
_tx_thread_smp_initialize_wait();
|
||||
}
|
||||
|
||||
void _secondary_ipi_trap(void)
|
||||
{
|
||||
#if __riscv_xlen == 64
|
||||
__asm__ volatile("addi sp, sp, -16;"
|
||||
"sd ra, 8(sp);"
|
||||
"call bootup_ipi_clear_handler;"
|
||||
"ld ra, 8(sp);"
|
||||
"addi sp, sp, 16;"
|
||||
"mret");
|
||||
#else
|
||||
__asm__ volatile("addi sp, sp, -8;"
|
||||
"sw ra, 4(sp);"
|
||||
"call bootup_ipi_clear_handler;"
|
||||
"lw ra, 4(sp);"
|
||||
"addi sp, sp, 8;"
|
||||
"mret");
|
||||
#endif
|
||||
}
|
||||
|
||||
void bootup_wake_secondary_cores(void)
|
||||
{
|
||||
for (UINT core = 1; core < TX_THREAD_SMP_MAX_CORES; ++core) {
|
||||
send_ipi(core);
|
||||
}
|
||||
}
|
||||
|
||||
VOID _tx_initialize_low_level(VOID)
|
||||
{
|
||||
_tx_thread_system_stack_ptr = (VOID*)(ULONG)riscv_get_sp();
|
||||
_tx_initialize_unused_memory = (VOID*)&__heap_start;
|
||||
|
||||
// disable interrupts
|
||||
asm volatile("csrrc zero, mstatus, %0" : : "r"(MSTATUS_MIE));
|
||||
// set previous interrupt enable and previous priv mode to be set when executing "mret"
|
||||
asm volatile("csrrs zero, mstatus, %0" : : "r"(MSTATUS_MPP_M | MSTATUS_MPIE));
|
||||
// enable timer, software and external interrupts
|
||||
asm volatile("csrrs zero, mie, %0" : : "r"(MIE_MTIE | MIE_MSIE | MIE_MEIE));
|
||||
|
||||
#ifdef __riscv_flen
|
||||
// enable f extension and reset state
|
||||
asm volatile("csrrs zero, mstatus, %0" : : "r"(MSTATUS_FS));
|
||||
asm volatile("fscsr x0");
|
||||
#endif
|
||||
|
||||
board_init();
|
||||
register_irq_handler(RISCV_INT_MTI, handle_RISCV_INT_MTI);
|
||||
register_irq_handler(RISCV_INT_MEI, handle_RISCV_INT_MEI);
|
||||
#ifdef TX_THREAD_SMP_INTER_CORE_INTERRUPT
|
||||
register_irq_handler(RISCV_INT_MSI, handle_RISCV_INT_MSI);
|
||||
#endif
|
||||
asm volatile("csrw mtvec, %0" : : "r"((uintptr_t)trap_entry));
|
||||
}
|
||||
@@ -184,6 +184,9 @@ void tx_application_define(void* first_unused_memory)
|
||||
|
||||
/* Release the block back to the pool. */
|
||||
tx_block_release(pointer);
|
||||
|
||||
/* Enable tracing */
|
||||
tx_trace_enable((void*)0x31000000, 0x100000, 256);
|
||||
}
|
||||
|
||||
/* Define the test threads. */
|
||||
|
||||
+18
-28
@@ -37,32 +37,32 @@ set(__THREAD_LOCAL_STORAGE OFF)
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/third-party/picolibc ${CMAKE_BINARY_DIR}/picolibc)
|
||||
target_link_libraries(c PUBLIC gcc)
|
||||
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/port/threadx_smp ${CMAKE_BINARY_DIR}/port/threadx_smp)
|
||||
target_link_libraries(threadx_smp PUBLIC c)
|
||||
target_compile_definitions(threadx_smp PUBLIC TX_REGRESSION_TEST TX_THREAD_SMP_ONLY_CORE_0_DEFAULT TX_SMP_NOT_POSSIBLE)
|
||||
|
||||
set(MOONLIGHT_TRAP_SOURCE_INPUT ${THREADX4TGFS_ROOT}/port/moonlight/src/trap_non_vectored.c)
|
||||
set(MOONLIGHT_TRAP_SOURCE ${CMAKE_BINARY_DIR}/generated/trap_non_vectored.c)
|
||||
add_custom_command(
|
||||
OUTPUT ${MOONLIGHT_TRAP_SOURCE}
|
||||
set(THREADX_LOW_LEVEL_INIT_SOURCE_INPUT
|
||||
${THREADX4TGFS_ROOT}/port/threadx_smp/src/tx_initialize_low_level.c)
|
||||
set(THREADX_LOW_LEVEL_INIT_SOURCE
|
||||
${CMAKE_BINARY_DIR}/generated/tx_initialize_low_level.c)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE_INPUT}
|
||||
${THREADX4TGFS_ROOT}/test/threadx/generate_trap_file.sh)
|
||||
execute_process(
|
||||
COMMAND bash ${THREADX4TGFS_ROOT}/test/threadx/generate_trap_file.sh
|
||||
${MOONLIGHT_TRAP_SOURCE_INPUT}
|
||||
${MOONLIGHT_TRAP_SOURCE}
|
||||
DEPENDS ${MOONLIGHT_TRAP_SOURCE_INPUT}
|
||||
${THREADX4TGFS_ROOT}/test/threadx/generate_trap_file.sh
|
||||
VERBATIM
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE_INPUT}
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE}
|
||||
RESULT_VARIABLE THREADX_LOW_LEVEL_INIT_GENERATE_RESULT
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
add_custom_target(threadx_regression_generated_trap DEPENDS ${MOONLIGHT_TRAP_SOURCE})
|
||||
set_source_files_properties(${MOONLIGHT_TRAP_SOURCE} PROPERTIES GENERATED TRUE)
|
||||
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/port/moonlight ${CMAKE_BINARY_DIR}/port/moonlight)
|
||||
add_dependencies(moonlight_platform_common_smp threadx_regression_generated_trap)
|
||||
target_sources(c PRIVATE ${THREADX4TGFS_ROOT}/port/picolibc/port.c)
|
||||
target_link_libraries(c PUBLIC moonlight gcc)
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/port/threadx_smp ${CMAKE_BINARY_DIR}/port/threadx_smp)
|
||||
target_link_libraries(threadx_smp PUBLIC moonlight c)
|
||||
target_compile_definitions(threadx_smp PUBLIC TX_REGRESSION_TEST TX_THREAD_SMP_ONLY_CORE_0_DEFAULT TX_SMP_NOT_POSSIBLE)
|
||||
|
||||
function(setup_target TARGET)
|
||||
set(options)
|
||||
set(oneValueArgs PLATFORM_TARGET)
|
||||
set(multiValueArgs LIBRARIES SOURCES)
|
||||
cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
cmake_parse_arguments(ST "${options}" "" "${multiValueArgs}" ${ARGN})
|
||||
if(ST_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "setup_target(${TARGET} ...): unknown args: ${ST_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
@@ -71,11 +71,6 @@ function(setup_target TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
if(ST_PLATFORM_TARGET)
|
||||
target_add_moonlight_platform(${TARGET} PLATFORM_TARGET ${ST_PLATFORM_TARGET})
|
||||
else()
|
||||
target_add_moonlight_platform(${TARGET})
|
||||
endif()
|
||||
|
||||
if(ST_SOURCES)
|
||||
target_sources(${TARGET} PRIVATE ${ST_SOURCES})
|
||||
@@ -86,10 +81,6 @@ function(setup_target TARGET)
|
||||
endif()
|
||||
|
||||
target_link_options(${TARGET} PRIVATE
|
||||
-nostartfiles
|
||||
-nostdlib
|
||||
-T ${THREADX4TGFS_ROOT}/src/${TARGET_MEM}.lds
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=${CMAKE_BINARY_DIR}/${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
@@ -246,7 +237,6 @@ function(add_threadx_regression_test TEST_SOURCE)
|
||||
|
||||
setup_target(
|
||||
${TEST_NAME}
|
||||
PLATFORM_TARGET moonlight_platform_common_smp
|
||||
LIBRARIES ${test_libraries}
|
||||
SOURCES ${TEST_SOURCE}
|
||||
)
|
||||
|
||||
+151
-159
@@ -37,33 +37,34 @@ set(__THREAD_LOCAL_STORAGE OFF)
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/third-party/picolibc ${CMAKE_BINARY_DIR}/picolibc)
|
||||
target_link_libraries(c PUBLIC gcc)
|
||||
|
||||
set(THREADX_CUSTOM_PORT ${THREADX4TGFS_ROOT}/port/threadx)
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/third-party/threadx ${CMAKE_BINARY_DIR}/threadx)
|
||||
target_link_libraries(threadx PUBLIC c)
|
||||
target_compile_definitions(threadx PUBLIC TX_REGRESSION_TEST)
|
||||
|
||||
set(MOONLIGHT_TRAP_SOURCE_INPUT ${THREADX4TGFS_ROOT}/port/moonlight/src/trap_non_vectored.c)
|
||||
set(MOONLIGHT_TRAP_SOURCE ${CMAKE_BINARY_DIR}/generated/trap_non_vectored.c)
|
||||
add_custom_command(
|
||||
OUTPUT ${MOONLIGHT_TRAP_SOURCE}
|
||||
set(THREADX_LOW_LEVEL_INIT_SOURCE_INPUT
|
||||
${THREADX4TGFS_ROOT}/port/threadx/src/tx_initialize_low_level.c)
|
||||
set(THREADX_LOW_LEVEL_INIT_SOURCE
|
||||
${CMAKE_BINARY_DIR}/generated/tx_initialize_low_level.c)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE_INPUT}
|
||||
${CMAKE_CURRENT_LIST_DIR}/generate_trap_file.sh)
|
||||
execute_process(
|
||||
COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/generate_trap_file.sh
|
||||
${MOONLIGHT_TRAP_SOURCE_INPUT}
|
||||
${MOONLIGHT_TRAP_SOURCE}
|
||||
DEPENDS ${MOONLIGHT_TRAP_SOURCE_INPUT}
|
||||
${CMAKE_CURRENT_LIST_DIR}/generate_trap_file.sh
|
||||
VERBATIM
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE_INPUT}
|
||||
${THREADX_LOW_LEVEL_INIT_SOURCE}
|
||||
RESULT_VARIABLE THREADX_LOW_LEVEL_INIT_GENERATE_RESULT
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
add_custom_target(threadx_regression_generated_trap DEPENDS ${MOONLIGHT_TRAP_SOURCE})
|
||||
set_source_files_properties(${MOONLIGHT_TRAP_SOURCE} PROPERTIES GENERATED TRUE)
|
||||
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/port/moonlight ${CMAKE_BINARY_DIR}/port/moonlight)
|
||||
add_dependencies(moonlight_platform_common threadx_regression_generated_trap)
|
||||
target_sources(c PRIVATE ${THREADX4TGFS_ROOT}/port/picolibc/port.c)
|
||||
target_link_libraries(c PUBLIC moonlight gcc)
|
||||
|
||||
set(THREADX_CUSTOM_PORT ${THREADX4TGFS_ROOT}/port/threadx)
|
||||
add_subdirectory(${THREADX4TGFS_ROOT}/third-party/threadx ${CMAKE_BINARY_DIR}/threadx)
|
||||
target_link_libraries(threadx PUBLIC moonlight c)
|
||||
target_compile_definitions(threadx PUBLIC TX_REGRESSION_TEST)
|
||||
|
||||
function(setup_target TARGET)
|
||||
set(options)
|
||||
set(oneValueArgs PLATFORM_TARGET)
|
||||
set(multiValueArgs LIBRARIES SOURCES)
|
||||
cmake_parse_arguments(ST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
cmake_parse_arguments(ST "${options}" "" "${multiValueArgs}" ${ARGN})
|
||||
if(ST_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "setup_target(${TARGET} ...): unknown args: ${ST_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
@@ -72,11 +73,6 @@ function(setup_target TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
if(ST_PLATFORM_TARGET)
|
||||
target_add_moonlight_platform(${TARGET} PLATFORM_TARGET ${ST_PLATFORM_TARGET})
|
||||
else()
|
||||
target_add_moonlight_platform(${TARGET})
|
||||
endif()
|
||||
|
||||
if(ST_SOURCES)
|
||||
target_sources(${TARGET} PRIVATE ${ST_SOURCES})
|
||||
@@ -87,10 +83,6 @@ function(setup_target TARGET)
|
||||
endif()
|
||||
|
||||
target_link_options(${TARGET} PRIVATE
|
||||
-nostartfiles
|
||||
-nostdlib
|
||||
-T ${THREADX4TGFS_ROOT}/src/${TARGET_MEM}.lds
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=${CMAKE_BINARY_DIR}/${TARGET}.map)
|
||||
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
@@ -101,161 +93,161 @@ function(setup_target TARGET)
|
||||
endfunction()
|
||||
|
||||
set(TX_REGRESSION_DIR
|
||||
${THREADX4TGFS_ROOT}/third-party/threadx/test/tx/regression
|
||||
${THREADX4TGFS_ROOT}/third-party/threadx/test/tx/regression
|
||||
)
|
||||
set(TX_CMAKE_DIR
|
||||
${THREADX4TGFS_ROOT}/third-party/threadx/test/tx/cmake
|
||||
${THREADX4TGFS_ROOT}/third-party/threadx/test/tx/cmake
|
||||
)
|
||||
|
||||
set(TX_REGRESSION_CASES
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_error_detection_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_prioritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_prioritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_thread_contention_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_isr_set_clear_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_isr_wait_abort_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_single_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_consume_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_different_bits_consume_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_different_bits_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_interrupt_control_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_nested_priority_inheritance_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_no_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_priority_inheritance_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_proritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_eight_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_four_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_one_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_sixteen_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_two_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_max_message_size_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_empty_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_flush_no_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_flush_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_front_send_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_full_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_prioritize.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_ceiling_put_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_non_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_prioritize.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_basic_execution_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_basic_time_slice_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_completed_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_create_preemption_threshold_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_delayed_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multi_level_preemption_threshold_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_non_current_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_sleep_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_time_slice_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_preemptable_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_preemption_change_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_priority_change.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_relinquish_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_reset_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_sleep_non_clear_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_sleep_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_suspend_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_sleep_for_100ticks_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_sleep_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_stack_checking_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_terminate_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_time_slice_change_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_wait_abort_and_isr_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_wait_abort_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_time_get_set_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_activate_deactivate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_deactivate_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_large_timer_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_multiple_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_multiple_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_simple_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_trace_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_initialize_kernel_setup_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_error_detection_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_prioritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_block_memory_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_prioritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_thread_contention_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_byte_memory_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_isr_set_clear_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_isr_wait_abort_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_single_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_consume_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_different_bits_consume_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_different_bits_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_event_flag_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_interrupt_control_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_nested_priority_inheritance_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_no_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_priority_inheritance_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_proritize_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_mutex_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_eight_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_four_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_one_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_sixteen_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_two_word_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_basic_max_message_size_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_empty_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_flush_no_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_flush_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_front_send_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_full_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_prioritize.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_suspension_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_queue_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_ceiling_put_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_non_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_preemption_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_prioritize.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_thread_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_semaphore_timeout_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_basic_execution_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_basic_time_slice_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_completed_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_create_preemption_threshold_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_delayed_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multi_level_preemption_threshold_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_non_current_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_sleep_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_multiple_time_slice_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_preemptable_suspension_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_preemption_change_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_priority_change.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_relinquish_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_reset_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_sleep_non_clear_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_sleep_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_simple_suspend_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_sleep_for_100ticks_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_sleep_terminate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_stack_checking_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_terminate_delete_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_time_slice_change_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_wait_abort_and_isr_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_thread_wait_abort_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_time_get_set_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_activate_deactivate_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_deactivate_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_information_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_large_timer_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_multiple_accuracy_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_multiple_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_timer_simple_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_trace_basic_test.c
|
||||
${TX_REGRESSION_DIR}/threadx_initialize_kernel_setup_test.c
|
||||
)
|
||||
|
||||
set(TX_REGRESSION_TARGETS)
|
||||
|
||||
add_library(
|
||||
threadx_regression_support STATIC
|
||||
${TX_REGRESSION_DIR}/testcontrol.c
|
||||
${TX_CMAKE_DIR}/samples/fake.c
|
||||
threadx_regression_support STATIC
|
||||
${TX_REGRESSION_DIR}/testcontrol.c
|
||||
${TX_CMAKE_DIR}/samples/fake.c
|
||||
)
|
||||
target_link_libraries(threadx_regression_support PUBLIC threadx c)
|
||||
target_compile_definitions(
|
||||
threadx_regression_support
|
||||
PUBLIC
|
||||
TX_REGRESSION_TEST
|
||||
CTEST
|
||||
BATCH_TEST
|
||||
TEST_STACK_SIZE_PRINTF=4096
|
||||
threadx_regression_support
|
||||
PUBLIC
|
||||
TX_REGRESSION_TEST
|
||||
CTEST
|
||||
BATCH_TEST
|
||||
TEST_STACK_SIZE_PRINTF=4096
|
||||
)
|
||||
|
||||
function(add_threadx_regression_test TEST_SOURCE)
|
||||
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
|
||||
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
|
||||
|
||||
if(TEST_NAME STREQUAL "threadx_initialize_kernel_setup_test")
|
||||
set(test_libraries threadx)
|
||||
else()
|
||||
set(test_libraries threadx_regression_support)
|
||||
endif()
|
||||
if(TEST_NAME STREQUAL "threadx_initialize_kernel_setup_test")
|
||||
set(test_libraries threadx)
|
||||
else()
|
||||
set(test_libraries threadx_regression_support)
|
||||
endif()
|
||||
|
||||
setup_target(
|
||||
${TEST_NAME}
|
||||
LIBRARIES ${test_libraries}
|
||||
SOURCES ${TEST_SOURCE}
|
||||
)
|
||||
setup_target(
|
||||
${TEST_NAME}
|
||||
LIBRARIES ${test_libraries}
|
||||
SOURCES ${TEST_SOURCE}
|
||||
)
|
||||
|
||||
list(APPEND TX_REGRESSION_TARGETS ${TEST_NAME})
|
||||
set(TX_REGRESSION_TARGETS ${TX_REGRESSION_TARGETS} PARENT_SCOPE)
|
||||
list(APPEND TX_REGRESSION_TARGETS ${TEST_NAME})
|
||||
set(TX_REGRESSION_TARGETS ${TX_REGRESSION_TARGETS} PARENT_SCOPE)
|
||||
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND ${THREADX_TEST_SIMULATOR}
|
||||
--isa=${THREADX_TEST_ISA}
|
||||
-f $<TARGET_FILE:${TEST_NAME}>
|
||||
-m 60s
|
||||
)
|
||||
set_tests_properties(${TEST_NAME} PROPERTIES TIMEOUT 60)
|
||||
add_test(
|
||||
NAME ${TEST_NAME}
|
||||
COMMAND ${THREADX_TEST_SIMULATOR}
|
||||
--isa=${THREADX_TEST_ISA}
|
||||
-f $<TARGET_FILE:${TEST_NAME}>
|
||||
-m 60s
|
||||
)
|
||||
set_tests_properties(${TEST_NAME} PROPERTIES TIMEOUT 60)
|
||||
endfunction()
|
||||
|
||||
foreach(test_case ${TX_REGRESSION_CASES})
|
||||
add_threadx_regression_test(${test_case})
|
||||
add_threadx_regression_test(${test_case})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(
|
||||
threadx_regression_build
|
||||
DEPENDS ${TX_REGRESSION_TARGETS}
|
||||
threadx_regression_build
|
||||
DEPENDS ${TX_REGRESSION_TARGETS}
|
||||
)
|
||||
|
||||
@@ -12,7 +12,7 @@ tmp1="${dst}.tmp1"
|
||||
|
||||
line=$(grep -n -F "$extern_anchor" "$src" | head -n 1 | cut -d: -f1)
|
||||
if [ -z "$line" ]; then
|
||||
echo "failed to find _tx_timer_interrupt declaration anchor in trap source" >&2
|
||||
echo "failed to find _tx_timer_interrupt declaration anchor in input source" >&2
|
||||
exit 1
|
||||
fi
|
||||
sed "${line}a\\
|
||||
@@ -20,7 +20,7 @@ void test_interrupt_dispatch(void) __attribute__((weak));\nvoid test_interrupt_d
|
||||
|
||||
line=$(grep -n -F "$call_anchor" "$tmp1" | head -n 1 | cut -d: -f1)
|
||||
if [ -z "$line" ]; then
|
||||
echo "failed to find _tx_timer_interrupt call anchor in trap source" >&2
|
||||
echo "failed to find _tx_timer_interrupt call anchor in input source" >&2
|
||||
rm -f "$tmp1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user