Compare commits
24 Commits
a6a6a034d6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b8c72cd9d | |||
| 91632bcdee | |||
| 5b2da239d2 | |||
| 1165785154 | |||
| ba39d23a18 | |||
| d97e71ca83 | |||
| 4c15a3e15f | |||
| 68057507c9 | |||
| 32df317b38 | |||
| 12ae01cda2 | |||
| ff0f81e9c0 | |||
| f989e21bad | |||
| e3a7a9ccaf | |||
| c717297b30 | |||
| b16a0ed956 | |||
| 21f95341af | |||
| 86025e020d | |||
| 764ccd4a52 | |||
| 27438ef6a5 | |||
| f58aa42abd | |||
| ac1fb36e2c | |||
| c0386ea4a1 | |||
| ffc49bc6a9 | |||
| 8772df619f |
+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)
|
||||
|
||||
Vendored
+24
-21
@@ -1,5 +1,5 @@
|
||||
def suites = ['threadx', 'smp']
|
||||
def presets = ['Debug32', 'Release32']
|
||||
def presets = ['Debug32', 'Release32', 'MinSizeRel32','Debug', 'Release', 'MinSizeRel']
|
||||
def simulatorImageLatest = 'git.minres.com/here/here-vp:latest'
|
||||
def threadxTestSimulator = '/usr/local/bin/riscv-vp'
|
||||
|
||||
@@ -46,32 +46,35 @@ def resolveImageCommit(String image) {
|
||||
}
|
||||
|
||||
def runRegressionLane(String image, String simulatorPath, boolean allowFailure, List suiteNames, List presetNames) {
|
||||
def parallelTasks = [:]
|
||||
|
||||
for (String suite : suiteNames) {
|
||||
for (String preset : presetNames) {
|
||||
def suiteName = suite
|
||||
def presetName = preset
|
||||
def taskName = "${suiteName}-${presetName}"
|
||||
parallelTasks[taskName] = {
|
||||
if (allowFailure) {
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
|
||||
runOneRegression(suiteName, presetName, simulatorPath)
|
||||
}
|
||||
} else {
|
||||
runOneRegression(suiteName, presetName, simulatorPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
docker.image(image).inside {
|
||||
sh '''
|
||||
set -eu
|
||||
cmake --version
|
||||
ctest --version
|
||||
'''
|
||||
parallel parallelTasks
|
||||
|
||||
for (String suite : suiteNames) {
|
||||
def suiteName = suite
|
||||
def parallelTasks = [:]
|
||||
|
||||
for (String preset : presetNames) {
|
||||
def presetName = preset
|
||||
def taskName = "${suiteName}-${presetName}"
|
||||
parallelTasks[taskName] = {
|
||||
if (allowFailure) {
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
|
||||
runOneRegression(suiteName, presetName, simulatorPath)
|
||||
}
|
||||
} else {
|
||||
runOneRegression(suiteName, presetName, simulatorPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage("${suiteName} Suite") {
|
||||
parallel parallelTasks
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <picotls.h>
|
||||
#include <tx_port.h>
|
||||
#include <riscv-csr.h>
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C extern "C"
|
||||
@@ -45,11 +44,17 @@ 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_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);
|
||||
|
||||
#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.
|
||||
// It will be 'called' with no stack or C runtime configuration.
|
||||
// tp will not be initialized
|
||||
@@ -61,7 +66,7 @@ void _start(void) {
|
||||
// The 'norelax' option is critical here.
|
||||
// Without 'norelax' the global pointer will
|
||||
// be loaded relative to the global pointer!
|
||||
".option norelax;"
|
||||
".option norelax;"
|
||||
"la gp, __global_pointer$;"
|
||||
".option pop;"
|
||||
"la sp, _sp;"
|
||||
@@ -74,15 +79,16 @@ void _start(void) {
|
||||
"la t1, __stack_size;"
|
||||
"la sp, _sp;"
|
||||
// Loop incase M extension is not present
|
||||
"mv t2, t0;"
|
||||
"1:;"
|
||||
"beqz t0, 2f;"
|
||||
"beqz t2, 2f;"
|
||||
"sub sp, sp, t1;"
|
||||
"addi t0, t0, -1;"
|
||||
"addi t2, t2, -1;"
|
||||
"j 1b;"
|
||||
"2:;"
|
||||
#ifdef TX_THREAD_SMP_MAX_CORES
|
||||
"call _tx_thread_smp_initialize_wait;"
|
||||
#endif
|
||||
"beqz t0, 3f;"
|
||||
"jal zero, _secondary_initialize;"
|
||||
"3:;"
|
||||
"jal zero, _initialize;"
|
||||
: /* output: none %0 */
|
||||
: /* input: none */
|
||||
@@ -107,6 +113,7 @@ void _initialize(void) {
|
||||
++entry) {
|
||||
(*entry)();
|
||||
}
|
||||
bootup_wake_secondary_cores();
|
||||
#ifdef __THREAD_LOCAL_STORAGE
|
||||
_set_tls(__tls_base)
|
||||
#endif
|
||||
@@ -120,6 +127,18 @@ void _initialize(void) {
|
||||
_exit(rc);
|
||||
}
|
||||
|
||||
void _secondary_initialize(void) {
|
||||
// sleep forever
|
||||
csr_clr_bits_mie(MIE_MTI_BIT_MASK);
|
||||
csr_clr_bits_mstatus(MSTATUS_MIE_BIT_MASK);
|
||||
while (1) {
|
||||
__asm__ volatile ("wfi");
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -56,6 +56,9 @@
|
||||
|
||||
#include "nx_user.h"
|
||||
#endif
|
||||
#include "tx_port.h"
|
||||
typedef unsigned int UINT32;
|
||||
_Static_assert(sizeof(UINT32) == 4, "UINT32 must be 4 bytes");
|
||||
|
||||
/* Default to little endian, since this is what most RISC-V targets are. */
|
||||
|
||||
@@ -63,10 +66,10 @@
|
||||
|
||||
/* Define macros that swap the endian for little endian ports. */
|
||||
#ifdef NX_LITTLE_ENDIAN
|
||||
#define NX_CHANGE_ULONG_ENDIAN(arg) \
|
||||
#define NX_CHANGE_UINT32_ENDIAN(arg) \
|
||||
{ \
|
||||
ULONG _i; \
|
||||
ULONG _tmp; \
|
||||
UINT32 _i; \
|
||||
UINT32 _tmp; \
|
||||
_i = (UINT)arg; \
|
||||
/* _i = A, B, C, D */ \
|
||||
_tmp = _i ^ (((_i) >> 16) | (_i << 16)); \
|
||||
@@ -82,11 +85,11 @@
|
||||
#define NX_CHANGE_USHORT_ENDIAN(a) (a = (((a >> 8) | (a << 8)) & 0xFFFF))
|
||||
|
||||
#ifndef htonl
|
||||
#define htonl(val) NX_CHANGE_ULONG_ENDIAN(val)
|
||||
#define htonl(val) NX_CHANGE_UINT32_ENDIAN(val)
|
||||
#endif /* htonl */
|
||||
|
||||
#ifndef ntohl
|
||||
#define ntohl(val) NX_CHANGE_ULONG_ENDIAN(val)
|
||||
#define ntohl(val) NX_CHANGE_UINT32_ENDIAN(val)
|
||||
#endif /* ntohl */
|
||||
|
||||
#ifndef htons
|
||||
@@ -99,7 +102,7 @@
|
||||
|
||||
#else
|
||||
|
||||
#define NX_CHANGE_ULONG_ENDIAN(a)
|
||||
#define NX_CHANGE_UINT32_ENDIAN(a)
|
||||
#define NX_CHANGE_USHORT_ENDIAN(a)
|
||||
|
||||
#ifndef htons
|
||||
@@ -138,8 +138,7 @@
|
||||
/* Disable IPv6 processing in NetX Duo. */
|
||||
/*
|
||||
#define NX_DISABLE_IPV6
|
||||
*/
|
||||
|
||||
*/
|
||||
/* Define the number of entries in IPv6 address pool. */
|
||||
/*
|
||||
#ifdef NX_MAX_PHYSICAL_INTERFACES
|
||||
@@ -66,8 +66,8 @@ extern int register_irq_handler(unsigned irq_num, void (*handler)());
|
||||
/* For the ethernet driver, physical addresses are allocated starting
|
||||
at the preset value and then incremented before the next allocation. */
|
||||
// Locally Administered Addresses that can be assigned by network, range is 02-00-00 to 02-00-5E
|
||||
const ULONG mnrs_mac_address_msw = 0x0200;
|
||||
const ULONG mnrs_mac_address_lsw = 0x00334450;
|
||||
const UINT32 mnrs_mac_address_msw = 0x0200;
|
||||
const UINT32 mnrs_mac_address_lsw = 0x00334450;
|
||||
|
||||
/* Define driver prototypes. */
|
||||
VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr);
|
||||
@@ -81,8 +81,8 @@ static VOID _nx_mnrs_eth_recv_packet_eth1(VOID);
|
||||
#define NX_MNRS_DRIVER_MAX_MCAST_ADDRESSES 3
|
||||
typedef struct MAC_ADDRESS_STRUCT
|
||||
{
|
||||
ULONG nx_mac_address_msw;
|
||||
ULONG nx_mac_address_lsw;
|
||||
UINT32 nx_mac_address_msw;
|
||||
UINT32 nx_mac_address_lsw;
|
||||
} MAC_ADDRESS;
|
||||
|
||||
/* Define an application-specific data structure that holds internal
|
||||
@@ -173,7 +173,7 @@ VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr)
|
||||
UINT interface_index;
|
||||
USHORT ether_type;
|
||||
#ifndef NX_ENABLE_VLAN
|
||||
ULONG* ethernet_frame_ptr;
|
||||
UINT32* ethernet_frame_ptr;
|
||||
#endif /* NX_ENABLE_VLAN */
|
||||
|
||||
/* Setup the IP pointer from the driver request. */
|
||||
@@ -408,7 +408,7 @@ VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr)
|
||||
/* Setup the ethernet frame pointer to build the ethernet frame. Backup another 2
|
||||
bytes to get 32-bit word alignment. */
|
||||
/*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary */
|
||||
ethernet_frame_ptr = (ULONG*)(packet_ptr->nx_packet_prepend_ptr - 2);
|
||||
ethernet_frame_ptr = (UINT32*)(packet_ptr->nx_packet_prepend_ptr - 2);
|
||||
/* Build the ethernet frame. */
|
||||
*ethernet_frame_ptr = driver_req_ptr->nx_ip_driver_physical_address_msw;
|
||||
*(ethernet_frame_ptr + 1) = driver_req_ptr->nx_ip_driver_physical_address_lsw;
|
||||
@@ -416,10 +416,10 @@ VOID nx_mnrs_network_driver(NX_IP_DRIVER* driver_req_ptr)
|
||||
(interface_ptr->nx_interface_physical_address_lsw >> 16);
|
||||
*(ethernet_frame_ptr + 3) = (interface_ptr->nx_interface_physical_address_lsw << 16) | ether_type;
|
||||
/* Endian swapping if NX_LITTLE_ENDIAN is defined. */
|
||||
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr));
|
||||
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr + 1));
|
||||
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr + 2));
|
||||
NX_CHANGE_ULONG_ENDIAN(*(ethernet_frame_ptr + 3));
|
||||
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr));
|
||||
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr + 1));
|
||||
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr + 2));
|
||||
NX_CHANGE_UINT32_ENDIAN(*(ethernet_frame_ptr + 3));
|
||||
#endif /* NX_ENABLE_VLAN */
|
||||
#ifdef NX_DEBUG_PACKET
|
||||
printf("NetX MNRS ETH Driver Packet Send - %s\n", ip_ptr->nx_ip_name);
|
||||
@@ -840,11 +840,11 @@ void _nx_mnrs_network_driver_receive(NX_IP* ip_ptr, NX_PACKET* packet_ptr, UINT
|
||||
|
||||
UINT _nx_mnrs_eth_send_packet(NX_PACKET* packet_ptr, volatile ethmac_t* ethmac)
|
||||
{
|
||||
ULONG size = 0;
|
||||
UINT32 size = 0;
|
||||
UCHAR* data;
|
||||
UINT i;
|
||||
ULONG buffer;
|
||||
ULONG words;
|
||||
UINT32 buffer;
|
||||
UINT32 words;
|
||||
|
||||
/* Make sure the data length is less than MTU. */
|
||||
if (packet_ptr->nx_packet_length > NX_MAX_PACKET_SIZE)
|
||||
@@ -967,7 +967,7 @@ VOID _nx_mnrs_eth_recv_packet(UINT i)
|
||||
|
||||
VOID _nx_mnrs_eth_recv_packet_eth0(VOID)
|
||||
{
|
||||
ULONG old_threshold;
|
||||
UINT32 old_threshold;
|
||||
|
||||
if (get_ethmac_mac_ctrl_rx_pending(ethmac0))
|
||||
{
|
||||
@@ -986,7 +986,7 @@ VOID _nx_mnrs_eth_recv_packet_eth0(VOID)
|
||||
|
||||
VOID _nx_mnrs_eth_recv_packet_eth1(VOID)
|
||||
{
|
||||
ULONG old_threshold;
|
||||
UINT32 old_threshold;
|
||||
|
||||
if (get_ethmac_mac_ctrl_rx_pending(ethmac1))
|
||||
{
|
||||
@@ -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
|
||||
|
||||
@@ -93,7 +92,7 @@ typedef char CHAR;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
typedef int LONG;
|
||||
typedef long LONG;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned long long ULONG64;
|
||||
typedef short SHORT;
|
||||
|
||||
@@ -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 */
|
||||
@@ -90,74 +87,3 @@ 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
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
@@ -90,74 +87,3 @@ 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
|
||||
@@ -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));
|
||||
}
|
||||
+4
-4
@@ -137,11 +137,11 @@ void thread_0_entry(ULONG thread_input)
|
||||
|
||||
UINT status;
|
||||
NX_PACKET* my_packet;
|
||||
ULONG length;
|
||||
UINT32 length;
|
||||
|
||||
NXD_ADDRESS server_ipv4_address;
|
||||
NXD_ADDRESS peer_address;
|
||||
ULONG peer_port;
|
||||
UINT32 peer_port;
|
||||
|
||||
NX_PARAMETER_NOT_USED(thread_input);
|
||||
|
||||
@@ -259,7 +259,7 @@ void thread_1_entry(ULONG thread_input)
|
||||
|
||||
UINT status;
|
||||
NX_PACKET* packet_ptr;
|
||||
ULONG actual_status;
|
||||
UINT32 actual_status;
|
||||
|
||||
NX_PARAMETER_NOT_USED(thread_input);
|
||||
|
||||
@@ -331,7 +331,7 @@ void thread_1_entry(ULONG thread_input)
|
||||
else
|
||||
{
|
||||
char buffer[64];
|
||||
ULONG size;
|
||||
UINT32 size;
|
||||
nx_packet_data_extract_offset(packet_ptr, 0, buffer, 64, &size);
|
||||
buffer[size] = 0;
|
||||
printf("Received packet %lu with %s\n", thread_1_counter, buffer);
|
||||
|
||||
@@ -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
|
||||
|
||||
Vendored
+1
-1
Submodule third-party/netxduo updated: b54bf01801...949c0f235c
Reference in New Issue
Block a user