mirror of
https://github.com/eclipse-threadx/threadx.git
synced 2026-09-24 08:45:25 +08:00
Release 6.1.8
This commit is contained in:
+5
-1
@@ -21,7 +21,11 @@ add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
|
||||
set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
|
||||
|
||||
# Pick up the port specific variables and apply them
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
|
||||
if(DEFINED THREADX_CUSTOM_PORT)
|
||||
add_subdirectory(${THREADX_CUSTOM_PORT} threadx_port)
|
||||
else()
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/ports/${THREADX_ARCH}/${THREADX_TOOLCHAIN})
|
||||
endif()
|
||||
|
||||
# Pick up the common stuff
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
|
||||
|
||||
@@ -17,7 +17,7 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
set(CMAKE_C_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} ${SPEC_FLAGS} -fdata-sections -ffunction-sections -mlong-calls" CACHE INTERNAL "c compiler flags")
|
||||
set(CMAKE_CXX_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -fdata-sections -ffunction-sections -fno-rtti -fno-exceptions -mlong-calls" CACHE INTERNAL "cxx compiler flags")
|
||||
set(CMAKE_ASM_FLAGS "${MCPU_FLAGS} -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")
|
||||
set(CMAKE_ASM_FLAGS "${MCPU_FLAGS} ${VFP_FLAGS} -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${MCPU_FLAGS} ${LD_FLAGS} -Wl,--gc-sections" CACHE INTERNAL "exe link flags")
|
||||
|
||||
SET(CMAKE_C_FLAGS_DEBUG "-Og -g -ggdb3" CACHE INTERNAL "c debug compiler flags")
|
||||
|
||||
+5
-2
@@ -26,7 +26,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_api.h PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.8 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -72,6 +72,9 @@
|
||||
/* 06-02-2021 Yuxin Zhou Modified comment(s), added */
|
||||
/* Execution Profile support, */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* 08-02-2021 Scott Larson Modified comment(s), and */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.1.8 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -104,7 +107,7 @@ extern "C" {
|
||||
#define AZURE_RTOS_THREADX
|
||||
#define THREADX_MAJOR_VERSION 6
|
||||
#define THREADX_MINOR_VERSION 1
|
||||
#define THREADX_PATCH_VERSION 7
|
||||
#define THREADX_PATCH_VERSION 8
|
||||
|
||||
/* Define the following symbol for backward compatibility */
|
||||
#define EL_PRODUCT_THREADX
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_create PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.8 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -79,14 +79,15 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* 09-30-2020 William E. Lamie Modified comment(s), and */
|
||||
/* changed stack calculations */
|
||||
/* to use ALIGN_TYPE integers, */
|
||||
/* resulting in version 6.1 */
|
||||
/* 06-02-2021 William E. Lamie Modified comment(s), and */
|
||||
/* 06-02-2021 William E. Lamie Modified comment(s), and */
|
||||
/* supported TX_MISRA_ENABLE, */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* 08-02-2021 Scott Larson Removed unneeded cast, */
|
||||
/* resulting in version 6.1.8 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, VOID (*entry_function)(ULONG id), ULONG entry_input,
|
||||
@@ -128,7 +129,7 @@ ALIGN_TYPE updated_stack_start;
|
||||
#else
|
||||
new_stack_start = TX_POINTER_TO_ALIGN_TYPE_CONVERT(stack_start);
|
||||
#endif /* TX_MISRA_ENABLE */
|
||||
updated_stack_start = ((((ULONG) new_stack_start) + ((sizeof(ULONG)) - ((ULONG) 1)) ) & (~((sizeof(ULONG)) - ((ULONG) 1))));
|
||||
updated_stack_start = (((new_stack_start) + ((sizeof(ULONG)) - ((ULONG) 1)) ) & (~((sizeof(ULONG)) - ((ULONG) 1))));
|
||||
|
||||
/* Determine if the starting stack address is different. */
|
||||
if (new_stack_start != updated_stack_start)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_api.h PORTABLE SMP */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.8 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -61,6 +61,9 @@
|
||||
/* 06-02-2021 Scott Larson Added options for multiple */
|
||||
/* block pool search & delay, */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* 08-02-2021 Scott Larson Modified comment(s), and */
|
||||
/* update patch number, */
|
||||
/* resulting in version 6.1.8 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -109,7 +112,7 @@ extern "C" {
|
||||
#define AZURE_RTOS_THREADX
|
||||
#define THREADX_MAJOR_VERSION 6
|
||||
#define THREADX_MINOR_VERSION 1
|
||||
#define THREADX_PATCH_VERSION 7
|
||||
#define THREADX_PATCH_VERSION 8
|
||||
|
||||
/* Define the following symbol for backward compatibility */
|
||||
#define EL_PRODUCT_THREADX
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_create PORTABLE SMP */
|
||||
/* 6.1.3 */
|
||||
/* 6.1.8 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -80,9 +80,11 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 William E. Lamie Initial Version 6.1 */
|
||||
/* 12-31-2020 Andres Mlinar Modified comment(s), */
|
||||
/* 09-30-2020 William E. Lamie Initial Version 6.1 */
|
||||
/* 12-31-2020 Andres Mlinar Modified comment(s), */
|
||||
/* resulting in version 6.1.3 */
|
||||
/* 08-02-2021 Scott Larson Removed unneeded cast, */
|
||||
/* resulting in version 6.1.8 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr,
|
||||
@@ -120,7 +122,7 @@ ALIGN_TYPE updated_stack_start;
|
||||
|
||||
/* Ensure the starting stack address is evenly aligned. */
|
||||
new_stack_start = TX_POINTER_TO_ALIGN_TYPE_CONVERT(stack_start);
|
||||
updated_stack_start = ((((ULONG) new_stack_start) + ((sizeof(ULONG)) - ((ULONG) 1)) ) & (~((sizeof(ULONG)) - ((ULONG) 1))));
|
||||
updated_stack_start = (((new_stack_start) + ((sizeof(ULONG)) - ((ULONG) 1)) ) & (~((sizeof(ULONG)) - ((ULONG) 1))));
|
||||
|
||||
/* Determine if the starting stack address is different. */
|
||||
if (new_stack_start != updated_stack_start)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB |
@@ -236,10 +236,14 @@ __tx_IntHandler
|
||||
; VOID InterruptHandler (VOID)
|
||||
; {
|
||||
PUSH {r0, lr}
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
; /* Do interrupt handler work here */
|
||||
; /* .... */
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
@@ -253,7 +257,13 @@ SysTick_Handler
|
||||
; {
|
||||
;
|
||||
PUSH {r0, lr}
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
|
||||
@@ -159,12 +159,12 @@ SysTick_Handler:
|
||||
@ {
|
||||
@
|
||||
PUSH {r0, lr}
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_enter @ Call the ISR enter function
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_exit @ Call the ISR exit function
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
|
||||
@@ -135,55 +135,95 @@ _tx_initialize_low_level:
|
||||
@
|
||||
LDR r0, =0xE000E000 @ Build address of NVIC registers
|
||||
LDR r1, =SYSTICK_CYCLES
|
||||
STR r1, [r0, #0x14] @ Setup SysTick Reload Value
|
||||
LDR r1, =0x7 @ Build SysTick Control Enable Value
|
||||
STR r1, [r0, #0x10] @ Setup SysTick Control
|
||||
@
|
||||
@ /* Configure handler priorities. */
|
||||
@
|
||||
LDR r1, =0x00000000 @ Rsrv, UsgF, BusF, MemM
|
||||
LDR r0, =0xE000E000 @ Build address of NVIC registers
|
||||
LDR r2, =0xD18 @
|
||||
ADD r0, r0, r2 @
|
||||
STR r1, [r0] @ Setup System Handlers 4-7 Priority Registers
|
||||
LDR r1, =0xFF000000 @ SVCl, Rsrv, Rsrv, Rsrv
|
||||
LDR r0, =0xE000E000 @ Build address of NVIC registers
|
||||
LDR r2, =0xD1C @
|
||||
ADD r0, r0, r2 @
|
||||
STR r1, [r0] @ Setup System Handlers 8-11 Priority Registers
|
||||
@ Note: SVC must be lowest priority, which is 0xFF
|
||||
LDR r1, =0x40FF0000 @ SysT, PnSV, Rsrv, DbgM
|
||||
LDR r0, =0xE000E000 @ Build address of NVIC registers
|
||||
LDR r2, =0xD20 @
|
||||
ADD r0, r0, r2 @
|
||||
STR r1, [r0] @ Setup System Handlers 12-15 Priority Registers
|
||||
@ Note: PnSV must be lowest priority, which is 0xFF
|
||||
|
||||
@
|
||||
@ /* Return to caller. */
|
||||
@
|
||||
BX lr
|
||||
@}
|
||||
@
|
||||
@ /* System Tick timer interrupt handler */
|
||||
STR r1, [r0, #0x14] // Setup SysTick Reload Value
|
||||
LDR r1, =0x7 // Build SysTick Control Enable Value
|
||||
STR r1, [r0, #0x10] // Setup SysTick Control
|
||||
|
||||
/* Configure handler priorities. */
|
||||
|
||||
LDR r1, =0x00000000 // Rsrv, UsgF, BusF, MemM
|
||||
LDR r0, =0xE000E000 // Build address of NVIC registers
|
||||
LDR r2, =0xD18 //
|
||||
ADD r0, r0, r2 //
|
||||
STR r1, [r0] // Setup System Handlers 4-7 Priority Registers
|
||||
LDR r1, =0xFF000000 // SVCl, Rsrv, Rsrv, Rsrv
|
||||
LDR r0, =0xE000E000 // Build address of NVIC registers
|
||||
LDR r2, =0xD1C //
|
||||
ADD r0, r0, r2 //
|
||||
STR r1, [r0] // Setup System Handlers 8-11 Priority Registers
|
||||
// Note: SVC must be lowest priority, which is 0xFF
|
||||
LDR r1, =0x40FF0000 // SysT, PnSV, Rsrv, DbgM
|
||||
LDR r0, =0xE000E000 // Build address of NVIC registers
|
||||
LDR r2, =0xD20 //
|
||||
ADD r0, r0, r2 //
|
||||
STR r1, [r0] // Setup System Handlers 12-15 Priority Registers
|
||||
// Note: PnSV must be lowest priority, which is 0xFF
|
||||
|
||||
/* Return to caller. */
|
||||
BX lr
|
||||
// }
|
||||
|
||||
/* Define shells for each of the unused vectors. */
|
||||
.global __tx_BadHandler
|
||||
.thumb_func
|
||||
__tx_BadHandler:
|
||||
B __tx_BadHandler
|
||||
|
||||
/* added to catch the hardfault */
|
||||
.global __tx_HardfaultHandler
|
||||
.thumb_func
|
||||
__tx_HardfaultHandler:
|
||||
B __tx_HardfaultHandler
|
||||
|
||||
/* Generic interrupt handler template */
|
||||
.global __tx_IntHandler
|
||||
.thumb_func
|
||||
__tx_IntHandler:
|
||||
// VOID InterruptHandler (VOID)
|
||||
// {
|
||||
PUSH {r0, lr}
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
/* Do interrupt handler work here */
|
||||
/* BL <your C Function>.... */
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
// }
|
||||
|
||||
/* System Tick timer interrupt handler */
|
||||
.global __tx_SysTickHandler
|
||||
.global SysTick_Handler
|
||||
.thumb_func
|
||||
__tx_SysTickHandler:
|
||||
.thumb_func
|
||||
SysTick_Handler:
|
||||
@ VOID SysTick_Handler (VOID)
|
||||
@ {
|
||||
@
|
||||
// VOID SysTick_Handler (VOID)
|
||||
// {
|
||||
PUSH {r0, lr}
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_enter @ Call the ISR enter function
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_exit @ Call the ISR exit function
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
@ }
|
||||
// }
|
||||
|
||||
/* NMI, DBG handlers */
|
||||
.global __tx_NMIHandler
|
||||
.thumb_func
|
||||
__tx_NMIHandler:
|
||||
B __tx_NMIHandler
|
||||
|
||||
.global __tx_DBGHandler
|
||||
.thumb_func
|
||||
__tx_DBGHandler:
|
||||
B __tx_DBGHandler
|
||||
|
||||
@@ -166,12 +166,12 @@ SysTick_Handler:
|
||||
; {
|
||||
;
|
||||
PUSH {r0, lr}
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_enter ; Call the ISR enter function
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#ifdef TX_ENABLE_EXECUTION_CHANGE_NOTIFY
|
||||
BL _tx_execution_isr_exit ; Call the ISR exit function
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
|
||||
@@ -236,10 +236,14 @@ __tx_IntHandler
|
||||
; VOID InterruptHandler (VOID)
|
||||
; {
|
||||
PUSH {r0, lr}
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
; /* Do interrupt handler work here */
|
||||
; /* .... */
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
@@ -253,7 +257,13 @@ SysTick_Handler
|
||||
; {
|
||||
;
|
||||
PUSH {r0, lr}
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
|
||||
@@ -29,13 +29,12 @@ SYSTICK_CYCLES = ((SYSTEM_CLOCK / 100) -1)
|
||||
STACK_SIZE = 0x00000400
|
||||
HEAP_SIZE = 0x00000000
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_initialize_low_level Cortex-M23/AC6 */
|
||||
/* 6.1 */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
@@ -88,16 +87,15 @@ _tx_initialize_low_level:
|
||||
/* Set base of available memory to end of non-initialised RAM area. */
|
||||
LDR r0, =_tx_initialize_unused_memory // Build address of unused memory pointer
|
||||
LDR r1, =Image$$ARM_LIB_STACK$$ZI$$Limit // Build first free address
|
||||
ADDS r1, r1, #4 //
|
||||
ADDS r1, r1, #4 //
|
||||
STR r1, [r0] // Setup first unused memory pointer
|
||||
|
||||
/* Setup Vector Table Offset Register. */
|
||||
LDR r0, =0xE000ED08 // Build address of NVIC registers
|
||||
LDR r1, =__Vectors // Pickup address of vector table
|
||||
STR r1, [r0] // Set vector table address
|
||||
STR r1, [r0] // Set vector table address
|
||||
|
||||
// /* Enable the cycle count register. */
|
||||
//
|
||||
/* Enable the cycle count register. */
|
||||
// LDR r0, =0xE0001000 // Build address of DWT register
|
||||
// LDR r1, [r0] // Pickup the current value
|
||||
// ORR r1, r1, #1 // Set the CYCCNTENA bit
|
||||
@@ -165,10 +163,14 @@ __tx_IntHandler:
|
||||
// VOID InterruptHandler (VOID)
|
||||
// {
|
||||
PUSH {r0,lr} // Save LR (and dummy r0 to maintain stack alignment)
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
/* Do interrupt handler work here */
|
||||
/* .... */
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
@@ -186,7 +188,13 @@ SysTick_Handler:
|
||||
// VOID TimerInterruptHandler (VOID)
|
||||
// {
|
||||
PUSH {r0,lr} // Save LR (and dummy r0 to maintain stack alignment)
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
|
||||
@@ -91,6 +91,12 @@ typedef short SHORT;
|
||||
typedef unsigned short USHORT;
|
||||
#define ULONG64_DEFINED
|
||||
|
||||
/* This port overrides tx_thread_stack_error_notify with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_NOTIFY
|
||||
|
||||
/* This port overrides tx_thread_stack_error_handler with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_HANDLER
|
||||
|
||||
/* Function prototypes for this port. */
|
||||
struct TX_THREAD_STRUCT;
|
||||
UINT _txe_thread_secure_stack_allocate(struct TX_THREAD_STRUCT *thread_ptr, ULONG stack_size);
|
||||
@@ -98,12 +104,6 @@ UINT _txe_thread_secure_stack_free(struct TX_THREAD_STRUCT *thread_ptr);
|
||||
UINT _tx_thread_secure_stack_allocate(struct TX_THREAD_STRUCT *tx_thread, ULONG stack_size);
|
||||
UINT _tx_thread_secure_stack_free(struct TX_THREAD_STRUCT *tx_thread);
|
||||
|
||||
/* This port overrides tx_thread_stack_error_notify with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_NOTIFY
|
||||
|
||||
/* This port overrides tx_thread_stack_error_handler with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_HANDLER
|
||||
|
||||
/* This hardware has stack checking that we take advantage of - do NOT define. */
|
||||
#ifdef TX_ENABLE_STACK_CHECKING
|
||||
#error "Do not define TX_ENABLE_STACK_CHECKING"
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_secure_interface.h Cortex-M23 */
|
||||
/* 6.1 */
|
||||
/* tx_secure_interface.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
@@ -51,9 +51,10 @@
|
||||
|
||||
/* Define internal secure thread stack function prototypes. */
|
||||
|
||||
extern void _tx_thread_secure_stack_initialize(void);
|
||||
extern UINT _tx_thread_secure_mode_stack_initialize(void);
|
||||
extern UINT _tx_thread_secure_mode_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size);
|
||||
extern UINT _tx_thread_secure_mode_stack_free(TX_THREAD *thread_ptr);
|
||||
extern void _tx_thread_secure_stack_initialize(void);
|
||||
extern void _tx_thread_secure_stack_context_save(TX_THREAD *thread_ptr);
|
||||
extern void _tx_thread_secure_stack_context_restore(TX_THREAD *thread_ptr);
|
||||
|
||||
|
||||
@@ -19,11 +19,10 @@
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
.global _tx_execution_isr_exit
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@@ -48,11 +47,11 @@
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* [_tx_execution_isr_exit] Execution profiling ISR exit */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* None */
|
||||
/* ISRs Interrupt Service Routines */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
.global _tx_execution_isr_enter
|
||||
#endif
|
||||
/**************************************************************************/
|
||||
@@ -48,11 +47,11 @@
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* [_tx_execution_isr_enter] Execution profiling ISR enter */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* None */
|
||||
/* ISRs */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
@@ -72,15 +71,13 @@
|
||||
.type _tx_thread_context_save, function
|
||||
_tx_thread_context_save:
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the ISR enter function to indicate an ISR is starting. */
|
||||
PUSH {r0, lr} // Save return address
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
POP {r0, lr} // Recover return address
|
||||
#endif
|
||||
|
||||
/* Context is already saved - just return. */
|
||||
|
||||
BX lr
|
||||
// }
|
||||
.end
|
||||
|
||||
@@ -68,11 +68,9 @@
|
||||
.thumb_func
|
||||
.type _tx_thread_interrupt_control, function
|
||||
_tx_thread_interrupt_control:
|
||||
|
||||
/* Pickup current interrupt lockout posture. */
|
||||
MRS r1, PRIMASK
|
||||
MSR PRIMASK, r0
|
||||
MOV r0, r1
|
||||
BX lr
|
||||
MRS r1, PRIMASK // Pickup current interrupt lockout
|
||||
MSR PRIMASK, r0 // Apply the new interrupt lockout
|
||||
MOV r0, r1 // Transfer old to return register
|
||||
BX lr // Return to caller
|
||||
// }
|
||||
.end
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* old_posture Old interrupt lockout posture */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* old_posture Old interrupt lockout posture */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
@@ -59,7 +59,7 @@
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_interrupt_disable(UINT new_posture)
|
||||
// UINT _tx_thread_interrupt_disable(VOID)
|
||||
// {
|
||||
.section .text
|
||||
.balign 4
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* previous_posture Previous interrupt posture */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* previous_posture Previous interrupt posture */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
@@ -59,7 +59,7 @@
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_thread_interrupt_restore(UINT new_posture)
|
||||
// VOID _tx_thread_interrupt_restore(UINT previous_posture)
|
||||
// {
|
||||
.section .text
|
||||
.balign 4
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
.global _tx_execution_thread_enter
|
||||
.global _tx_execution_thread_exit
|
||||
#endif
|
||||
@@ -94,7 +94,6 @@ _tx_thread_schedule:
|
||||
CPSIE i
|
||||
|
||||
/* Enter the scheduler for the first time. */
|
||||
|
||||
LDR r0, =0x10000000 // Load PENDSVSET bit
|
||||
LDR r1, =0xE000ED04 // Load ICSR address
|
||||
STR r0, [r1] // Set PENDSVBIT in ICSR
|
||||
@@ -108,7 +107,7 @@ __tx_wait_here:
|
||||
// }
|
||||
|
||||
/* Generic context switching PendSV handler. */
|
||||
|
||||
|
||||
.section .text
|
||||
.balign 4
|
||||
.syntax unified
|
||||
@@ -120,7 +119,7 @@ __tx_wait_here:
|
||||
PendSV_Handler:
|
||||
__tx_ts_handler:
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the thread exit function to indicate the thread is no longer executing. */
|
||||
CPSID i // Disable interrupts
|
||||
PUSH {r0, lr} // Save LR (and r0 just for alignment)
|
||||
@@ -129,11 +128,9 @@ __tx_ts_handler:
|
||||
MOV lr, r1 //
|
||||
CPSIE i // Enable interrupts
|
||||
#endif
|
||||
|
||||
MOVW r0, #:lower16:_tx_thread_current_ptr // Build current thread pointer address
|
||||
MOVT r0, #:upper16:_tx_thread_current_ptr
|
||||
MOVW r2, #:lower16:_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
MOVT r2, #:upper16:_tx_thread_execute_ptr
|
||||
|
||||
LDR r0, =_tx_thread_current_ptr // Build current thread pointer address
|
||||
LDR r2, =_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
MOVW r3, #0 // Build NULL value
|
||||
LDR r1, [r0] // Pickup current thread pointer
|
||||
|
||||
@@ -146,27 +143,27 @@ __tx_ts_handler:
|
||||
STR r3, [r0] // Set _tx_thread_current_ptr to NULL
|
||||
MRS r3, PSP // Pickup PSP pointer (thread's stack pointer)
|
||||
SUBS r3, r3, #16 // Allocate stack space
|
||||
STM r3!, {r4-r7} // Save its remaining registers (M3 Instruction: STMDB r12!, {r4-r11})
|
||||
MOV r4, r8 //
|
||||
MOV r5, r9 //
|
||||
MOV r6, r10 //
|
||||
MOV r7, r11 //
|
||||
STM r3!, {r4-r7} // Save r4-r7 (M4 Instruction: STMDB r12!, {r4-r11})
|
||||
MOV r4, r8 // Copy r8-r11 to multisave registers
|
||||
MOV r5, r9
|
||||
MOV r6, r10
|
||||
MOV r7, r11
|
||||
SUBS r3, r3, #32 // Allocate stack space
|
||||
STM r3!, {r4-r7} //
|
||||
STM r3!, {r4-r7} // Save r8-r11
|
||||
SUBS r3, r3, #20 // Allocate stack space
|
||||
MOV r5, lr //
|
||||
STR r5, [r3] // Save LR on the stack
|
||||
MOV r5, lr // Copy lr to saveable register
|
||||
STR r5, [r3] // Save lr on the stack
|
||||
STR r3, [r1, #8] // Save the thread stack pointer
|
||||
|
||||
|
||||
#if (!defined(TX_SINGLE_MODE_SECURE) && !defined(TX_SINGLE_MODE_NON_SECURE))
|
||||
// Save secure context
|
||||
LDR r5, =0x90 // Secure stack index offset
|
||||
LDR r5, [r1, r5] // Load secure stack index
|
||||
CBZ r5, _skip_secure_save // Skip save if there is no secure context
|
||||
PUSH {r0, r1, r2, r3} // Save scratch registers
|
||||
PUSH {r0-r3} // Save scratch registers
|
||||
MOV r0, r1 // Move thread ptr to r0
|
||||
BL _tx_thread_secure_stack_context_save // Save secure stack
|
||||
POP {r0, r1, r2, r3} // Restore secure registers
|
||||
POP {r0-r3} // Restore secure registers
|
||||
_skip_secure_save:
|
||||
#endif
|
||||
|
||||
@@ -204,8 +201,7 @@ __tx_ts_new:
|
||||
|
||||
__tx_ts_restore:
|
||||
LDR r7, [r1, #4] // Pickup the current thread run count
|
||||
MOVW r4, #:lower16:_tx_timer_time_slice // Build address of time-slice variable
|
||||
MOVT r4, #:upper16:_tx_timer_time_slice
|
||||
LDR r4, =_tx_timer_time_slice // Build address of time-slice variable
|
||||
LDR r5, [r1, #24] // Pickup thread's current time-slice
|
||||
ADDS r7, r7, #1 // Increment the thread run count
|
||||
STR r7, [r1, #4] // Store the new run count
|
||||
@@ -214,7 +210,7 @@ __tx_ts_restore:
|
||||
|
||||
STR r5, [r4] // Setup global time-slice
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the thread entry function to indicate the thread is executing. */
|
||||
PUSH {r0, r1} // Save r0 and r1
|
||||
BL _tx_execution_thread_enter // Call the thread execution enter function
|
||||
@@ -243,15 +239,14 @@ _skip_secure_restore:
|
||||
LDR r5, [r3] // Recover saved LR
|
||||
ADDS r3, r3, #4 // Position past LR
|
||||
MOV lr, r5 // Restore LR
|
||||
LDM r3!, {r4-r7} // Recover thread's registers (r4-r11)
|
||||
MOV r11, r7 //
|
||||
MOV r10, r6 //
|
||||
MOV r9, r5 //
|
||||
MOV r8, r4 //
|
||||
LDM r3!, {r4-r7} //
|
||||
LDM r3!, {r4-r7} // Recover thread's registers (r8-r11)
|
||||
MOV r11, r7
|
||||
MOV r10, r6
|
||||
MOV r9, r5
|
||||
MOV r8, r4
|
||||
LDM r3!, {r4-r7} // Recover thread's registers (r4-r7)
|
||||
MSR PSP, r3 // Setup the thread's stack pointer
|
||||
|
||||
/* Return to thread. */
|
||||
BX lr // Return to thread!
|
||||
|
||||
/* The following is the idle wait processing... in this case, no threads are ready for execution and the
|
||||
@@ -295,6 +290,7 @@ __tx_ts_ready:
|
||||
/* Re-enable interrupts and restore new thread. */
|
||||
CPSIE i // Enable interrupts
|
||||
B __tx_ts_restore // Restore the thread
|
||||
// }
|
||||
|
||||
|
||||
#if (!defined(TX_SINGLE_MODE_SECURE) && !defined(TX_SINGLE_MODE_NON_SECURE))
|
||||
@@ -307,27 +303,27 @@ __tx_ts_ready:
|
||||
.thumb_func
|
||||
.type SVC_Handler, function
|
||||
SVC_Handler:
|
||||
MOVW r0, #4
|
||||
MOV r1, lr
|
||||
TST r1, r0 // Determine return stack from EXC_RETURN bit 2
|
||||
BEQ _tx_get_msp
|
||||
MRS r0, PSP // Get PSP if return stack is PSP
|
||||
B _tx_got_sp
|
||||
_tx_get_msp:
|
||||
MRS r0, MSP // Get MSP if return stack is MSP
|
||||
_tx_got_sp:
|
||||
LDR r1, [r0, #24] // Load saved PC from stack
|
||||
SUBS r1, r1, #2 // Calculate SVC number address
|
||||
LDRB r1, [r1] // Load SVC number
|
||||
MOV r0, lr
|
||||
MOVS r1, #0x04
|
||||
TST r1, r0 // Determine return stack from EXC_RETURN bit 2
|
||||
BEQ _tx_load_msp
|
||||
MRS r0, PSP // Get PSP if return stack is PSP
|
||||
B _tx_get_svc
|
||||
_tx_load_msp:
|
||||
MRS r0, MSP // Get MSP if return stack is MSP
|
||||
_tx_get_svc:
|
||||
LDR r1, [r0,#24] // Load saved PC from stack
|
||||
LDR r3, =-2
|
||||
LDRB r1, [r1,r3] // Load SVC number
|
||||
|
||||
CMP r1, #1 // Is it a secure stack allocate request?
|
||||
BEQ _tx_svc_secure_alloc // Yes, go there
|
||||
CMP r1, #1 // Is it a secure stack allocate request?
|
||||
BEQ _tx_svc_secure_alloc // Yes, go there
|
||||
|
||||
CMP r1, #2 // Is it a secure stack free request?
|
||||
BEQ _tx_svc_secure_free // Yes, go there
|
||||
CMP r1, #2 // Is it a secure stack free request?
|
||||
BEQ _tx_svc_secure_free // Yes, go there
|
||||
|
||||
CMP r1, #3 // Is it a secure stack init request?
|
||||
BEQ _tx_svc_secure_init // Yes, go there
|
||||
CMP r1, #3 // Is it a secure stack init request?
|
||||
BEQ _tx_svc_secure_init // Yes, go there
|
||||
|
||||
// Unknown SVC argument - just return
|
||||
BX lr
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
#include "ARMCM23_TZ.h" /* For intrinsic functions. */
|
||||
#include "cmsis_compiler.h" /* For intrinsic functions. */
|
||||
#include "tx_secure_interface.h" /* Interface for NS code. */
|
||||
|
||||
/* Minimum size of secure stack. */
|
||||
@@ -308,7 +308,7 @@ UINT _tx_thread_secure_mode_stack_free(TX_THREAD *thread_ptr)
|
||||
{
|
||||
UINT status;
|
||||
TX_THREAD_SECURE_STACK_INFO *info_ptr;
|
||||
|
||||
|
||||
status = TX_SUCCESS;
|
||||
|
||||
/* Pickup stack info from thread. */
|
||||
@@ -393,7 +393,7 @@ void _tx_thread_secure_stack_context_save(TX_THREAD *thread_ptr)
|
||||
{
|
||||
TX_THREAD_SECURE_STACK_INFO *info_ptr;
|
||||
ULONG sp;
|
||||
|
||||
|
||||
/* This function should be called from scheduler only. */
|
||||
if (__get_IPSR() == 0)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_secure_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size)
|
||||
@@ -66,7 +66,7 @@
|
||||
.balign 4
|
||||
.syntax unified
|
||||
.eabi_attribute Tag_ABI_align_preserved, 1
|
||||
.global _tx_thread_secure_stack_allocate
|
||||
.global _tx_thread_secure_stack_allocate
|
||||
.thumb_func
|
||||
.type _tx_thread_secure_stack_allocate, function
|
||||
_tx_thread_secure_stack_allocate:
|
||||
@@ -78,7 +78,6 @@ _tx_thread_secure_stack_allocate:
|
||||
BEQ _alloc_return_interrupt_enabled
|
||||
CPSID i // Otherwise, disable interrupts
|
||||
#else
|
||||
// Executing in single mode - this function is not needed.
|
||||
MOVS r0, #0xFF // Feature not enabled
|
||||
#endif
|
||||
_alloc_return_interrupt_enabled:
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_secure_stack_free(TX_THREAD *thread_ptr)
|
||||
@@ -64,7 +64,7 @@
|
||||
.balign 4
|
||||
.syntax unified
|
||||
.eabi_attribute Tag_ABI_align_preserved, 1
|
||||
.global _tx_thread_secure_stack_free
|
||||
.global _tx_thread_secure_stack_free
|
||||
.thumb_func
|
||||
.type _tx_thread_secure_stack_free, function
|
||||
_tx_thread_secure_stack_free:
|
||||
@@ -76,7 +76,6 @@ _tx_thread_secure_stack_free:
|
||||
BEQ _free_return_interrupt_enabled
|
||||
CPSID i // Otherwise, disable interrupts
|
||||
#else
|
||||
// Executing in single mode - this function is not needed.
|
||||
MOVS r0, #0xFF // Feature not enabled
|
||||
#endif
|
||||
_free_return_interrupt_enabled:
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID))
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
.thumb_func
|
||||
.type _tx_thread_system_return, function
|
||||
_tx_thread_system_return:
|
||||
/* Return to real scheduler via PendSV. Note that this routine is often
|
||||
/* Return to real scheduler via PendSV. Note that this routine is often
|
||||
replaced with in-line assembly in tx_port.h to improved performance. */
|
||||
|
||||
LDR r0, =0x10000000 // Load PENDSVSET bit
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
/* This function processes the hardware timer interrupt. This */
|
||||
/* processing includes incrementing the system clock and checking for */
|
||||
/* time slice and/or timer expiration. If either is found, the */
|
||||
/* interrupt context save/restore functions are called along with the */
|
||||
/* expiration functions. */
|
||||
/* expiration functions are called. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
@@ -63,8 +62,8 @@
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* VOID _tx_timer_interrupt(VOID)
|
||||
{ */
|
||||
// VOID _tx_timer_interrupt(VOID)
|
||||
// {
|
||||
.section .text
|
||||
.balign 4
|
||||
.syntax unified
|
||||
@@ -80,8 +79,7 @@ _tx_timer_interrupt:
|
||||
/* Increment the system clock. */
|
||||
// _tx_timer_system_clock++;
|
||||
|
||||
MOVW r1, #:lower16:_tx_timer_system_clock // Pickup address of system clock
|
||||
MOVT r1, #:upper16:_tx_timer_system_clock
|
||||
LDR r1, =_tx_timer_system_clock // Pickup address of system clock
|
||||
LDR r0, [r1, #0] // Pickup system clock
|
||||
ADDS r0, r0, #1 // Increment system clock
|
||||
STR r0, [r1, #0] // Store new system clock
|
||||
@@ -90,28 +88,27 @@ _tx_timer_interrupt:
|
||||
// if (_tx_timer_time_slice)
|
||||
// {
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_time_slice // Pickup address of time-slice
|
||||
MOVT r3, #:upper16:_tx_timer_time_slice
|
||||
LDR r3, =_tx_timer_time_slice // Pickup address of time-slice
|
||||
LDR r2, [r3, #0] // Pickup time-slice
|
||||
CBZ r2, __tx_timer_no_time_slice // Is it non-active?
|
||||
CBZ r2, __tx_timer_no_time_slice // Is it non-active?
|
||||
// Yes, skip time-slice processing
|
||||
|
||||
/* Decrement the time_slice. */
|
||||
// _tx_timer_time_slice--;
|
||||
/* Decrement the time_slice. */
|
||||
// _tx_timer_time_slice--;
|
||||
|
||||
SUBS r2, r2, #1 // Decrement the time-slice
|
||||
STR r2, [r3, #0] // Store new time-slice value
|
||||
|
||||
/* Check for expiration. */
|
||||
// if (__tx_timer_time_slice == 0)
|
||||
/* Check for expiration. */
|
||||
// if (__tx_timer_time_slice == 0)
|
||||
|
||||
CBNZ r2, __tx_timer_no_time_slice // Has it expired?
|
||||
// No, skip expiration processing
|
||||
|
||||
/* Set the time-slice expired flag. */
|
||||
// _tx_timer_expired_time_slice = TX_TRUE;
|
||||
/* Set the time-slice expired flag. */
|
||||
// _tx_timer_expired_time_slice = TX_TRUE;
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired_time_slice // Pickup address of expired flag
|
||||
MOVT r3, #:upper16:_tx_timer_expired_time_slice
|
||||
LDR r3, =_tx_timer_expired_time_slice // Pickup address of expired flag
|
||||
MOVW r0, #1 // Build expired value
|
||||
STR r0, [r3, #0] // Set time-slice expiration flag
|
||||
|
||||
@@ -123,18 +120,16 @@ __tx_timer_no_time_slice:
|
||||
// if (*_tx_timer_current_ptr)
|
||||
// {
|
||||
|
||||
MOVW r1, #:lower16:_tx_timer_current_ptr // Pickup current timer pointer address
|
||||
MOVT r1, #:upper16:_tx_timer_current_ptr
|
||||
LDR r1, =_tx_timer_current_ptr // Pickup current timer pointer address
|
||||
LDR r0, [r1, #0] // Pickup current timer
|
||||
LDR r2, [r0, #0] // Pickup timer list entry
|
||||
CBZ r2, __tx_timer_no_timer // Is there anything in the list?
|
||||
// No, just increment the timer
|
||||
|
||||
/* Set expiration flag. */
|
||||
// _tx_timer_expired = TX_TRUE;
|
||||
/* Set expiration flag. */
|
||||
// _tx_timer_expired = TX_TRUE;
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired // Pickup expiration flag address
|
||||
MOVT r3, #:upper16:_tx_timer_expired
|
||||
LDR r3, =_tx_timer_expired // Pickup expiration flag address
|
||||
MOVW r2, #1 // Build expired value
|
||||
STR r2, [r3, #0] // Set expired flag
|
||||
B __tx_timer_done // Finished timer processing
|
||||
@@ -144,25 +139,23 @@ __tx_timer_no_time_slice:
|
||||
// {
|
||||
__tx_timer_no_timer:
|
||||
|
||||
/* No timer expired, increment the timer pointer. */
|
||||
// _tx_timer_current_ptr++;
|
||||
/* No timer expired, increment the timer pointer. */
|
||||
// _tx_timer_current_ptr++;
|
||||
|
||||
ADDS r0, r0, #4 // Move to next timer
|
||||
|
||||
/* Check for wrap-around. */
|
||||
// if (_tx_timer_current_ptr == _tx_timer_list_end)
|
||||
/* Check for wrap-around. */
|
||||
// if (_tx_timer_current_ptr == _tx_timer_list_end)
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_list_end // Pickup addr of timer list end
|
||||
MOVT r3, #:upper16:_tx_timer_list_end
|
||||
LDR r3, =_tx_timer_list_end // Pickup addr of timer list end
|
||||
LDR r2, [r3, #0] // Pickup list end
|
||||
CMP r0, r2 // Are we at list end?
|
||||
BNE __tx_timer_skip_wrap // No, skip wrap-around logic
|
||||
|
||||
/* Wrap to beginning of list. */
|
||||
// _tx_timer_current_ptr = _tx_timer_list_start;
|
||||
/* Wrap to beginning of list. */
|
||||
// _tx_timer_current_ptr = _tx_timer_list_start;
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_list_start // Pickup addr of timer list start
|
||||
MOVT r3, #:upper16:_tx_timer_list_start
|
||||
LDR r3, =_tx_timer_list_start // Pickup addr of timer list start
|
||||
LDR r0, [r3, #0] // Set current pointer to list start
|
||||
|
||||
__tx_timer_skip_wrap:
|
||||
@@ -172,18 +165,15 @@ __tx_timer_skip_wrap:
|
||||
|
||||
__tx_timer_done:
|
||||
|
||||
|
||||
/* See if anything has expired. */
|
||||
// if ((_tx_timer_expired_time_slice) || (_tx_timer_expired))
|
||||
// {
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired_time_slice // Pickup addr of expired flag
|
||||
MOVT r3, #:upper16:_tx_timer_expired_time_slice
|
||||
LDR r3, =_tx_timer_expired_time_slice // Pickup addr of expired flag
|
||||
LDR r2, [r3, #0] // Pickup time-slice expired flag
|
||||
CBNZ r2, __tx_something_expired // Did a time-slice expire?
|
||||
// If non-zero, time-slice expired
|
||||
MOVW r1, #:lower16:_tx_timer_expired // Pickup addr of other expired flag
|
||||
MOVT r1, #:upper16:_tx_timer_expired
|
||||
LDR r1, =_tx_timer_expired // Pickup addr of other expired flag
|
||||
LDR r0, [r1, #0] // Pickup timer expired flag
|
||||
CBZ r0, __tx_timer_nothing_expired // Did a timer expire?
|
||||
// No, nothing expired
|
||||
@@ -197,14 +187,13 @@ __tx_something_expired:
|
||||
// if (_tx_timer_expired)
|
||||
// {
|
||||
|
||||
MOVW r1, #:lower16:_tx_timer_expired // Pickup addr of expired flag
|
||||
MOVT r1, #:upper16:_tx_timer_expired
|
||||
LDR r1, =_tx_timer_expired // Pickup addr of expired flag
|
||||
LDR r0, [r1, #0] // Pickup timer expired flag
|
||||
CBZ r0, __tx_timer_dont_activate // Check for timer expiration
|
||||
// If not set, skip timer activation
|
||||
|
||||
/* Process timer expiration. */
|
||||
// _tx_timer_expiration_process();
|
||||
/* Process timer expiration. */
|
||||
// _tx_timer_expiration_process();
|
||||
|
||||
BL _tx_timer_expiration_process // Call the timer expiration handling routine
|
||||
|
||||
@@ -215,28 +204,21 @@ __tx_timer_dont_activate:
|
||||
// if (_tx_timer_expired_time_slice)
|
||||
// {
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired_time_slice // Pickup addr of time-slice expired
|
||||
MOVT r3, #:upper16:_tx_timer_expired_time_slice
|
||||
LDR r3, =_tx_timer_expired_time_slice // Pickup addr of time-slice expired
|
||||
LDR r2, [r3, #0] // Pickup the actual flag
|
||||
CBZ r2, __tx_timer_not_ts_expiration // See if the flag is set
|
||||
// No, skip time-slice processing
|
||||
|
||||
/* Time slice interrupted thread. */
|
||||
// _tx_thread_time_slice();
|
||||
/* Time slice interrupted thread. */
|
||||
// _tx_thread_time_slice();
|
||||
|
||||
BL _tx_thread_time_slice // Call time-slice processing
|
||||
MOVW r0, #:lower16:_tx_thread_preempt_disable // Build address of preempt disable flag
|
||||
MOVT r0, #:upper16:_tx_thread_preempt_disable
|
||||
|
||||
LDR r0, =_tx_thread_preempt_disable // Build address of preempt disable flag
|
||||
LDR r1, [r0] // Is the preempt disable flag set?
|
||||
CBNZ r1, __tx_timer_skip_time_slice // Yes, skip the PendSV logic
|
||||
MOVW r0, #:lower16:_tx_thread_current_ptr // Build current thread pointer address
|
||||
MOVT r0, #:upper16:_tx_thread_current_ptr
|
||||
|
||||
LDR r0, =_tx_thread_current_ptr // Build current thread pointer address
|
||||
LDR r1, [r0] // Pickup the current thread pointer
|
||||
MOVW r2, #:lower16:_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
MOVT r2, #:upper16:_tx_thread_execute_ptr
|
||||
|
||||
LDR r2, =_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
LDR r3, [r2] // Pickup the execute thread pointer
|
||||
LDR r0, =0xE000ED04 // Build address of control register
|
||||
LDR r2, =0x10000000 // Build value for PendSV bit
|
||||
@@ -248,8 +230,8 @@ __tx_timer_skip_time_slice:
|
||||
|
||||
__tx_timer_not_ts_expiration:
|
||||
|
||||
POP {r0, r1} // Recover lr register (r0 is just there for
|
||||
MOV lr, r1 // the 8-byte stack alignment
|
||||
POP {r0, r1} // Recover lr register (r0 is just there for
|
||||
MOV lr, r1 // the 8-byte stack alignment
|
||||
|
||||
// }
|
||||
|
||||
@@ -257,6 +239,5 @@ __tx_timer_nothing_expired:
|
||||
|
||||
DSB // Complete all memory access
|
||||
BX lr // Return to caller
|
||||
|
||||
// }
|
||||
.end
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_secure_interface.h Cortex-M23 */
|
||||
/* 6.1 */
|
||||
/* tx_secure_interface.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
@@ -51,9 +51,10 @@
|
||||
|
||||
/* Define internal secure thread stack function prototypes. */
|
||||
|
||||
extern void _tx_thread_secure_stack_initialize(void);
|
||||
extern UINT _tx_thread_secure_mode_stack_initialize(void);
|
||||
extern UINT _tx_thread_secure_mode_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size);
|
||||
extern UINT _tx_thread_secure_mode_stack_free(TX_THREAD *thread_ptr);
|
||||
extern void _tx_thread_secure_stack_initialize(void);
|
||||
extern void _tx_thread_secure_stack_context_save(TX_THREAD *thread_ptr);
|
||||
extern void _tx_thread_secure_stack_context_restore(TX_THREAD *thread_ptr);
|
||||
|
||||
|
||||
@@ -29,13 +29,12 @@ SYSTICK_CYCLES = ((SYSTEM_CLOCK / 100) -1)
|
||||
STACK_SIZE = 0x00000400
|
||||
HEAP_SIZE = 0x00000000
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_initialize_low_level Cortex-M23/GNU */
|
||||
/* 6.1 */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
@@ -165,10 +164,14 @@ __tx_IntHandler:
|
||||
// VOID InterruptHandler (VOID)
|
||||
// {
|
||||
PUSH {r0,lr} // Save LR (and dummy r0 to maintain stack alignment)
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
/* Do interrupt handler work here */
|
||||
/* .... */
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
@@ -186,7 +189,13 @@ SysTick_Handler:
|
||||
// VOID TimerInterruptHandler (VOID)
|
||||
// {
|
||||
PUSH {r0,lr} // Save LR (and dummy r0 to maintain stack alignment)
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
|
||||
@@ -19,11 +19,10 @@
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
.global _tx_execution_isr_exit
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@@ -48,11 +47,11 @@
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* [_tx_execution_isr_exit] Execution profiling ISR exit */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* None */
|
||||
/* ISRs Interrupt Service Routines */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
.global _tx_execution_isr_enter
|
||||
#endif
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
@@ -45,11 +47,11 @@
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* [_tx_execution_isr_enter] Execution profiling ISR enter */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* None */
|
||||
/* ISRs */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
@@ -69,15 +71,13 @@
|
||||
.type _tx_thread_context_save, function
|
||||
_tx_thread_context_save:
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the ISR enter function to indicate an ISR is starting. */
|
||||
PUSH {r0, lr} // Save return address
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
POP {r0, lr} // Recover return address
|
||||
#endif
|
||||
|
||||
/* Context is already saved - just return. */
|
||||
|
||||
BX lr
|
||||
// }
|
||||
.end
|
||||
|
||||
@@ -68,11 +68,9 @@
|
||||
.thumb_func
|
||||
.type _tx_thread_interrupt_control, function
|
||||
_tx_thread_interrupt_control:
|
||||
|
||||
/* Pickup current interrupt lockout posture. */
|
||||
MRS r1, PRIMASK
|
||||
MSR PRIMASK, r0
|
||||
MOV r0, r1
|
||||
BX lr
|
||||
MRS r1, PRIMASK // Pickup current interrupt lockout
|
||||
MSR PRIMASK, r0 // Apply the new interrupt lockout
|
||||
MOV r0, r1 // Transfer old to return register
|
||||
BX lr // Return to caller
|
||||
// }
|
||||
.end
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* old_posture Old interrupt lockout posture */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* old_posture Old interrupt lockout posture */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
@@ -59,7 +59,7 @@
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_interrupt_disable(UINT new_posture)
|
||||
// UINT _tx_thread_interrupt_disable(VOID)
|
||||
// {
|
||||
.section .text
|
||||
.balign 4
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* previous_posture Previous interrupt posture */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* previous_posture Previous interrupt posture */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
@@ -59,7 +59,7 @@
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_thread_interrupt_restore(UINT new_posture)
|
||||
// VOID _tx_thread_interrupt_restore(UINT previous_posture)
|
||||
// {
|
||||
.section .text
|
||||
.balign 4
|
||||
|
||||
@@ -90,7 +90,6 @@ _tx_thread_schedule:
|
||||
CPSIE i
|
||||
|
||||
/* Enter the scheduler for the first time. */
|
||||
|
||||
LDR r0, =0x10000000 // Load PENDSVSET bit
|
||||
LDR r1, =0xE000ED04 // Load ICSR address
|
||||
STR r0, [r1] // Set PENDSVBIT in ICSR
|
||||
@@ -104,7 +103,7 @@ __tx_wait_here:
|
||||
// }
|
||||
|
||||
/* Generic context switching PendSV handler. */
|
||||
|
||||
|
||||
.section .text
|
||||
.balign 4
|
||||
.syntax unified
|
||||
@@ -116,7 +115,7 @@ __tx_wait_here:
|
||||
PendSV_Handler:
|
||||
__tx_ts_handler:
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the thread exit function to indicate the thread is no longer executing. */
|
||||
CPSID i // Disable interrupts
|
||||
PUSH {r0, lr} // Save LR (and r0 just for alignment)
|
||||
@@ -125,11 +124,9 @@ __tx_ts_handler:
|
||||
MOV lr, r1 //
|
||||
CPSIE i // Enable interrupts
|
||||
#endif
|
||||
|
||||
MOVW r0, #:lower16:_tx_thread_current_ptr // Build current thread pointer address
|
||||
MOVT r0, #:upper16:_tx_thread_current_ptr
|
||||
MOVW r2, #:lower16:_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
MOVT r2, #:upper16:_tx_thread_execute_ptr
|
||||
|
||||
LDR r0, =_tx_thread_current_ptr // Build current thread pointer address
|
||||
LDR r2, =_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
MOVW r3, #0 // Build NULL value
|
||||
LDR r1, [r0] // Pickup current thread pointer
|
||||
|
||||
@@ -142,27 +139,27 @@ __tx_ts_handler:
|
||||
STR r3, [r0] // Set _tx_thread_current_ptr to NULL
|
||||
MRS r3, PSP // Pickup PSP pointer (thread's stack pointer)
|
||||
SUBS r3, r3, #16 // Allocate stack space
|
||||
STM r3!, {r4-r7} // Save its remaining registers (M3 Instruction: STMDB r12!, {r4-r11})
|
||||
MOV r4, r8 //
|
||||
MOV r5, r9 //
|
||||
MOV r6, r10 //
|
||||
MOV r7, r11 //
|
||||
STM r3!, {r4-r7} // Save r4-r7 (M4 Instruction: STMDB r12!, {r4-r11})
|
||||
MOV r4, r8 // Copy r8-r11 to multisave registers
|
||||
MOV r5, r9
|
||||
MOV r6, r10
|
||||
MOV r7, r11
|
||||
SUBS r3, r3, #32 // Allocate stack space
|
||||
STM r3!, {r4-r7} //
|
||||
STM r3!, {r4-r7} // Save r8-r11
|
||||
SUBS r3, r3, #20 // Allocate stack space
|
||||
MOV r5, lr //
|
||||
STR r5, [r3] // Save LR on the stack
|
||||
MOV r5, lr // Copy lr to saveable register
|
||||
STR r5, [r3] // Save lr on the stack
|
||||
STR r3, [r1, #8] // Save the thread stack pointer
|
||||
|
||||
|
||||
#if (!defined(TX_SINGLE_MODE_SECURE) && !defined(TX_SINGLE_MODE_NON_SECURE))
|
||||
// Save secure context
|
||||
LDR r5, =0x90 // Secure stack index offset
|
||||
LDR r5, [r1, r5] // Load secure stack index
|
||||
CBZ r5, _skip_secure_save // Skip save if there is no secure context
|
||||
PUSH {r0, r1, r2, r3} // Save scratch registers
|
||||
PUSH {r0-r3} // Save scratch registers
|
||||
MOV r0, r1 // Move thread ptr to r0
|
||||
BL _tx_thread_secure_stack_context_save // Save secure stack
|
||||
POP {r0, r1, r2, r3} // Restore secure registers
|
||||
POP {r0-r3} // Restore secure registers
|
||||
_skip_secure_save:
|
||||
#endif
|
||||
|
||||
@@ -200,8 +197,7 @@ __tx_ts_new:
|
||||
|
||||
__tx_ts_restore:
|
||||
LDR r7, [r1, #4] // Pickup the current thread run count
|
||||
MOVW r4, #:lower16:_tx_timer_time_slice // Build address of time-slice variable
|
||||
MOVT r4, #:upper16:_tx_timer_time_slice
|
||||
LDR r4, =_tx_timer_time_slice // Build address of time-slice variable
|
||||
LDR r5, [r1, #24] // Pickup thread's current time-slice
|
||||
ADDS r7, r7, #1 // Increment the thread run count
|
||||
STR r7, [r1, #4] // Store the new run count
|
||||
@@ -210,7 +206,7 @@ __tx_ts_restore:
|
||||
|
||||
STR r5, [r4] // Setup global time-slice
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the thread entry function to indicate the thread is executing. */
|
||||
PUSH {r0, r1} // Save r0 and r1
|
||||
BL _tx_execution_thread_enter // Call the thread execution enter function
|
||||
@@ -239,15 +235,14 @@ _skip_secure_restore:
|
||||
LDR r5, [r3] // Recover saved LR
|
||||
ADDS r3, r3, #4 // Position past LR
|
||||
MOV lr, r5 // Restore LR
|
||||
LDM r3!, {r4-r7} // Recover thread's registers (r4-r11)
|
||||
MOV r11, r7 //
|
||||
MOV r10, r6 //
|
||||
MOV r9, r5 //
|
||||
MOV r8, r4 //
|
||||
LDM r3!, {r4-r7} //
|
||||
LDM r3!, {r4-r7} // Recover thread's registers (r8-r11)
|
||||
MOV r11, r7
|
||||
MOV r10, r6
|
||||
MOV r9, r5
|
||||
MOV r8, r4
|
||||
LDM r3!, {r4-r7} // Recover thread's registers (r4-r7)
|
||||
MSR PSP, r3 // Setup the thread's stack pointer
|
||||
|
||||
/* Return to thread. */
|
||||
BX lr // Return to thread!
|
||||
|
||||
/* The following is the idle wait processing... in this case, no threads are ready for execution and the
|
||||
@@ -291,6 +286,7 @@ __tx_ts_ready:
|
||||
/* Re-enable interrupts and restore new thread. */
|
||||
CPSIE i // Enable interrupts
|
||||
B __tx_ts_restore // Restore the thread
|
||||
// }
|
||||
|
||||
|
||||
#if (!defined(TX_SINGLE_MODE_SECURE) && !defined(TX_SINGLE_MODE_NON_SECURE))
|
||||
@@ -303,27 +299,27 @@ __tx_ts_ready:
|
||||
.thumb_func
|
||||
.type SVC_Handler, function
|
||||
SVC_Handler:
|
||||
MOVW r0, #4
|
||||
MOV r1, lr
|
||||
TST r1, r0 // Determine return stack from EXC_RETURN bit 2
|
||||
BEQ _tx_get_msp
|
||||
MRS r0, PSP // Get PSP if return stack is PSP
|
||||
B _tx_got_sp
|
||||
_tx_get_msp:
|
||||
MRS r0, MSP // Get MSP if return stack is MSP
|
||||
_tx_got_sp:
|
||||
LDR r1, [r0, #24] // Load saved PC from stack
|
||||
SUBS r1, r1, #2 // Calculate SVC number address
|
||||
LDRB r1, [r1] // Load SVC number
|
||||
MOV r0, lr
|
||||
MOVS r1, #0x04
|
||||
TST r1, r0 // Determine return stack from EXC_RETURN bit 2
|
||||
BEQ _tx_load_msp
|
||||
MRS r0, PSP // Get PSP if return stack is PSP
|
||||
B _tx_get_svc
|
||||
_tx_load_msp:
|
||||
MRS r0, MSP // Get MSP if return stack is MSP
|
||||
_tx_get_svc:
|
||||
LDR r1, [r0,#24] // Load saved PC from stack
|
||||
LDR r3, =-2
|
||||
LDRB r1, [r1,r3] // Load SVC number
|
||||
|
||||
CMP r1, #1 // Is it a secure stack allocate request?
|
||||
BEQ _tx_svc_secure_alloc // Yes, go there
|
||||
CMP r1, #1 // Is it a secure stack allocate request?
|
||||
BEQ _tx_svc_secure_alloc // Yes, go there
|
||||
|
||||
CMP r1, #2 // Is it a secure stack free request?
|
||||
BEQ _tx_svc_secure_free // Yes, go there
|
||||
CMP r1, #2 // Is it a secure stack free request?
|
||||
BEQ _tx_svc_secure_free // Yes, go there
|
||||
|
||||
CMP r1, #3 // Is it a secure stack init request?
|
||||
BEQ _tx_svc_secure_init // Yes, go there
|
||||
CMP r1, #3 // Is it a secure stack init request?
|
||||
BEQ _tx_svc_secure_init // Yes, go there
|
||||
|
||||
// Unknown SVC argument - just return
|
||||
BX lr
|
||||
|
||||
@@ -105,6 +105,7 @@ UINT _tx_thread_secure_mode_stack_initialize(void)
|
||||
{
|
||||
UINT status;
|
||||
ULONG control;
|
||||
ULONG ipsr;
|
||||
|
||||
/* Make sure function is called from interrupt (threads should not call). */
|
||||
asm volatile("MRS %0, IPSR" : "=r" (ipsr)); /* Get IPSR register. */
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_secure_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size)
|
||||
@@ -78,7 +78,6 @@ _tx_thread_secure_stack_allocate:
|
||||
BEQ _alloc_return_interrupt_enabled
|
||||
CPSID i // Otherwise, disable interrupts
|
||||
#else
|
||||
// Executing in single mode - this function is not needed.
|
||||
MOVS r0, #0xFF // Feature not enabled
|
||||
#endif
|
||||
_alloc_return_interrupt_enabled:
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_secure_stack_free(TX_THREAD *thread_ptr)
|
||||
@@ -76,7 +76,6 @@ _tx_thread_secure_stack_free:
|
||||
BEQ _free_return_interrupt_enabled
|
||||
CPSID i // Otherwise, disable interrupts
|
||||
#else
|
||||
// Executing in single mode - this function is not needed.
|
||||
MOVS r0, #0xFF // Feature not enabled
|
||||
#endif
|
||||
_free_return_interrupt_enabled:
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID))
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
.thumb_func
|
||||
.type _tx_thread_system_return, function
|
||||
_tx_thread_system_return:
|
||||
/* Return to real scheduler via PendSV. Note that this routine is often
|
||||
/* Return to real scheduler via PendSV. Note that this routine is often
|
||||
replaced with in-line assembly in tx_port.h to improved performance. */
|
||||
|
||||
LDR r0, =0x10000000 // Load PENDSVSET bit
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
/* This function processes the hardware timer interrupt. This */
|
||||
/* processing includes incrementing the system clock and checking for */
|
||||
/* time slice and/or timer expiration. If either is found, the */
|
||||
/* interrupt context save/restore functions are called along with the */
|
||||
/* expiration functions. */
|
||||
/* expiration functions are called. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
@@ -63,8 +62,8 @@
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/* VOID _tx_timer_interrupt(VOID)
|
||||
{ */
|
||||
// VOID _tx_timer_interrupt(VOID)
|
||||
// {
|
||||
.section .text
|
||||
.balign 4
|
||||
.syntax unified
|
||||
@@ -80,8 +79,7 @@ _tx_timer_interrupt:
|
||||
/* Increment the system clock. */
|
||||
// _tx_timer_system_clock++;
|
||||
|
||||
MOVW r1, #:lower16:_tx_timer_system_clock // Pickup address of system clock
|
||||
MOVT r1, #:upper16:_tx_timer_system_clock
|
||||
LDR r1, =_tx_timer_system_clock // Pickup address of system clock
|
||||
LDR r0, [r1, #0] // Pickup system clock
|
||||
ADDS r0, r0, #1 // Increment system clock
|
||||
STR r0, [r1, #0] // Store new system clock
|
||||
@@ -90,28 +88,27 @@ _tx_timer_interrupt:
|
||||
// if (_tx_timer_time_slice)
|
||||
// {
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_time_slice // Pickup address of time-slice
|
||||
MOVT r3, #:upper16:_tx_timer_time_slice
|
||||
LDR r3, =_tx_timer_time_slice // Pickup address of time-slice
|
||||
LDR r2, [r3, #0] // Pickup time-slice
|
||||
CBZ r2, __tx_timer_no_time_slice // Is it non-active?
|
||||
CBZ r2, __tx_timer_no_time_slice // Is it non-active?
|
||||
// Yes, skip time-slice processing
|
||||
|
||||
/* Decrement the time_slice. */
|
||||
// _tx_timer_time_slice--;
|
||||
/* Decrement the time_slice. */
|
||||
// _tx_timer_time_slice--;
|
||||
|
||||
SUBS r2, r2, #1 // Decrement the time-slice
|
||||
STR r2, [r3, #0] // Store new time-slice value
|
||||
|
||||
/* Check for expiration. */
|
||||
// if (__tx_timer_time_slice == 0)
|
||||
/* Check for expiration. */
|
||||
// if (__tx_timer_time_slice == 0)
|
||||
|
||||
CBNZ r2, __tx_timer_no_time_slice // Has it expired?
|
||||
// No, skip expiration processing
|
||||
|
||||
/* Set the time-slice expired flag. */
|
||||
// _tx_timer_expired_time_slice = TX_TRUE;
|
||||
/* Set the time-slice expired flag. */
|
||||
// _tx_timer_expired_time_slice = TX_TRUE;
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired_time_slice // Pickup address of expired flag
|
||||
MOVT r3, #:upper16:_tx_timer_expired_time_slice
|
||||
LDR r3, =_tx_timer_expired_time_slice // Pickup address of expired flag
|
||||
MOVW r0, #1 // Build expired value
|
||||
STR r0, [r3, #0] // Set time-slice expiration flag
|
||||
|
||||
@@ -123,18 +120,16 @@ __tx_timer_no_time_slice:
|
||||
// if (*_tx_timer_current_ptr)
|
||||
// {
|
||||
|
||||
MOVW r1, #:lower16:_tx_timer_current_ptr // Pickup current timer pointer address
|
||||
MOVT r1, #:upper16:_tx_timer_current_ptr
|
||||
LDR r1, =_tx_timer_current_ptr // Pickup current timer pointer address
|
||||
LDR r0, [r1, #0] // Pickup current timer
|
||||
LDR r2, [r0, #0] // Pickup timer list entry
|
||||
CBZ r2, __tx_timer_no_timer // Is there anything in the list?
|
||||
// No, just increment the timer
|
||||
|
||||
/* Set expiration flag. */
|
||||
// _tx_timer_expired = TX_TRUE;
|
||||
/* Set expiration flag. */
|
||||
// _tx_timer_expired = TX_TRUE;
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired // Pickup expiration flag address
|
||||
MOVT r3, #:upper16:_tx_timer_expired
|
||||
LDR r3, =_tx_timer_expired // Pickup expiration flag address
|
||||
MOVW r2, #1 // Build expired value
|
||||
STR r2, [r3, #0] // Set expired flag
|
||||
B __tx_timer_done // Finished timer processing
|
||||
@@ -144,25 +139,23 @@ __tx_timer_no_time_slice:
|
||||
// {
|
||||
__tx_timer_no_timer:
|
||||
|
||||
/* No timer expired, increment the timer pointer. */
|
||||
// _tx_timer_current_ptr++;
|
||||
/* No timer expired, increment the timer pointer. */
|
||||
// _tx_timer_current_ptr++;
|
||||
|
||||
ADDS r0, r0, #4 // Move to next timer
|
||||
|
||||
/* Check for wrap-around. */
|
||||
// if (_tx_timer_current_ptr == _tx_timer_list_end)
|
||||
/* Check for wrap-around. */
|
||||
// if (_tx_timer_current_ptr == _tx_timer_list_end)
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_list_end // Pickup addr of timer list end
|
||||
MOVT r3, #:upper16:_tx_timer_list_end
|
||||
LDR r3, =_tx_timer_list_end // Pickup addr of timer list end
|
||||
LDR r2, [r3, #0] // Pickup list end
|
||||
CMP r0, r2 // Are we at list end?
|
||||
BNE __tx_timer_skip_wrap // No, skip wrap-around logic
|
||||
|
||||
/* Wrap to beginning of list. */
|
||||
// _tx_timer_current_ptr = _tx_timer_list_start;
|
||||
/* Wrap to beginning of list. */
|
||||
// _tx_timer_current_ptr = _tx_timer_list_start;
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_list_start // Pickup addr of timer list start
|
||||
MOVT r3, #:upper16:_tx_timer_list_start
|
||||
LDR r3, =_tx_timer_list_start // Pickup addr of timer list start
|
||||
LDR r0, [r3, #0] // Set current pointer to list start
|
||||
|
||||
__tx_timer_skip_wrap:
|
||||
@@ -172,18 +165,15 @@ __tx_timer_skip_wrap:
|
||||
|
||||
__tx_timer_done:
|
||||
|
||||
|
||||
/* See if anything has expired. */
|
||||
// if ((_tx_timer_expired_time_slice) || (_tx_timer_expired))
|
||||
// {
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired_time_slice // Pickup addr of expired flag
|
||||
MOVT r3, #:upper16:_tx_timer_expired_time_slice
|
||||
LDR r3, =_tx_timer_expired_time_slice // Pickup addr of expired flag
|
||||
LDR r2, [r3, #0] // Pickup time-slice expired flag
|
||||
CBNZ r2, __tx_something_expired // Did a time-slice expire?
|
||||
// If non-zero, time-slice expired
|
||||
MOVW r1, #:lower16:_tx_timer_expired // Pickup addr of other expired flag
|
||||
MOVT r1, #:upper16:_tx_timer_expired
|
||||
LDR r1, =_tx_timer_expired // Pickup addr of other expired flag
|
||||
LDR r0, [r1, #0] // Pickup timer expired flag
|
||||
CBZ r0, __tx_timer_nothing_expired // Did a timer expire?
|
||||
// No, nothing expired
|
||||
@@ -197,14 +187,13 @@ __tx_something_expired:
|
||||
// if (_tx_timer_expired)
|
||||
// {
|
||||
|
||||
MOVW r1, #:lower16:_tx_timer_expired // Pickup addr of expired flag
|
||||
MOVT r1, #:upper16:_tx_timer_expired
|
||||
LDR r1, =_tx_timer_expired // Pickup addr of expired flag
|
||||
LDR r0, [r1, #0] // Pickup timer expired flag
|
||||
CBZ r0, __tx_timer_dont_activate // Check for timer expiration
|
||||
// If not set, skip timer activation
|
||||
|
||||
/* Process timer expiration. */
|
||||
// _tx_timer_expiration_process();
|
||||
/* Process timer expiration. */
|
||||
// _tx_timer_expiration_process();
|
||||
|
||||
BL _tx_timer_expiration_process // Call the timer expiration handling routine
|
||||
|
||||
@@ -215,28 +204,21 @@ __tx_timer_dont_activate:
|
||||
// if (_tx_timer_expired_time_slice)
|
||||
// {
|
||||
|
||||
MOVW r3, #:lower16:_tx_timer_expired_time_slice // Pickup addr of time-slice expired
|
||||
MOVT r3, #:upper16:_tx_timer_expired_time_slice
|
||||
LDR r3, =_tx_timer_expired_time_slice // Pickup addr of time-slice expired
|
||||
LDR r2, [r3, #0] // Pickup the actual flag
|
||||
CBZ r2, __tx_timer_not_ts_expiration // See if the flag is set
|
||||
// No, skip time-slice processing
|
||||
|
||||
/* Time slice interrupted thread. */
|
||||
// _tx_thread_time_slice();
|
||||
/* Time slice interrupted thread. */
|
||||
// _tx_thread_time_slice();
|
||||
|
||||
BL _tx_thread_time_slice // Call time-slice processing
|
||||
MOVW r0, #:lower16:_tx_thread_preempt_disable // Build address of preempt disable flag
|
||||
MOVT r0, #:upper16:_tx_thread_preempt_disable
|
||||
|
||||
LDR r0, =_tx_thread_preempt_disable // Build address of preempt disable flag
|
||||
LDR r1, [r0] // Is the preempt disable flag set?
|
||||
CBNZ r1, __tx_timer_skip_time_slice // Yes, skip the PendSV logic
|
||||
MOVW r0, #:lower16:_tx_thread_current_ptr // Build current thread pointer address
|
||||
MOVT r0, #:upper16:_tx_thread_current_ptr
|
||||
|
||||
LDR r0, =_tx_thread_current_ptr // Build current thread pointer address
|
||||
LDR r1, [r0] // Pickup the current thread pointer
|
||||
MOVW r2, #:lower16:_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
MOVT r2, #:upper16:_tx_thread_execute_ptr
|
||||
|
||||
LDR r2, =_tx_thread_execute_ptr // Build execute thread pointer address
|
||||
LDR r3, [r2] // Pickup the execute thread pointer
|
||||
LDR r0, =0xE000ED04 // Build address of control register
|
||||
LDR r2, =0x10000000 // Build value for PendSV bit
|
||||
@@ -248,8 +230,8 @@ __tx_timer_skip_time_slice:
|
||||
|
||||
__tx_timer_not_ts_expiration:
|
||||
|
||||
POP {r0, r1} // Recover lr register (r0 is just there for
|
||||
MOV lr, r1 // the 8-byte stack alignment
|
||||
POP {r0, r1} // Recover lr register (r0 is just there for
|
||||
MOV lr, r1 // the 8-byte stack alignment
|
||||
|
||||
// }
|
||||
|
||||
@@ -257,6 +239,5 @@ __tx_timer_nothing_expired:
|
||||
|
||||
DSB // Complete all memory access
|
||||
BX lr // Return to caller
|
||||
|
||||
// }
|
||||
.end
|
||||
|
||||
@@ -94,6 +94,12 @@ typedef short SHORT;
|
||||
typedef unsigned short USHORT;
|
||||
#define ULONG64_DEFINED
|
||||
|
||||
/* This port overrides tx_thread_stack_error_notify with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_NOTIFY
|
||||
|
||||
/* This port overrides tx_thread_stack_error_handler with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_HANDLER
|
||||
|
||||
/* Function prototypes for this port. */
|
||||
struct TX_THREAD_STRUCT;
|
||||
UINT _txe_thread_secure_stack_allocate(struct TX_THREAD_STRUCT *thread_ptr, ULONG stack_size);
|
||||
@@ -101,12 +107,6 @@ UINT _txe_thread_secure_stack_free(struct TX_THREAD_STRUCT *thread_ptr);
|
||||
UINT _tx_thread_secure_stack_allocate(struct TX_THREAD_STRUCT *tx_thread, ULONG stack_size);
|
||||
UINT _tx_thread_secure_stack_free(struct TX_THREAD_STRUCT *tx_thread);
|
||||
|
||||
/* This port overrides tx_thread_stack_error_notify with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_NOTIFY
|
||||
|
||||
/* This port overrides tx_thread_stack_error_handler with an architecture specific version */
|
||||
#define TX_PORT_THREAD_STACK_ERROR_HANDLER
|
||||
|
||||
/* This hardware has stack checking that we take advantage of - do NOT define. */
|
||||
#ifdef TX_ENABLE_STACK_CHECKING
|
||||
#error "Do not define TX_ENABLE_STACK_CHECKING"
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
/* */
|
||||
/* COMPONENT DEFINITION RELEASE */
|
||||
/* */
|
||||
/* tx_secure_interface.h Cortex-M23 */
|
||||
/* 6.1 */
|
||||
/* tx_secure_interface.h PORTABLE C */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
@@ -51,9 +51,10 @@
|
||||
|
||||
/* Define internal secure thread stack function prototypes. */
|
||||
|
||||
extern void _tx_thread_secure_stack_initialize(void);
|
||||
extern UINT _tx_thread_secure_mode_stack_initialize(void);
|
||||
extern UINT _tx_thread_secure_mode_stack_allocate(TX_THREAD *thread_ptr, ULONG stack_size);
|
||||
extern UINT _tx_thread_secure_mode_stack_free(TX_THREAD *thread_ptr);
|
||||
extern void _tx_thread_secure_stack_initialize(void);
|
||||
extern void _tx_thread_secure_stack_context_save(TX_THREAD *thread_ptr);
|
||||
extern void _tx_thread_secure_stack_context_restore(TX_THREAD *thread_ptr);
|
||||
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
;/* */
|
||||
;/* This software is licensed under the Microsoft Software License */
|
||||
;/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
;/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
;/* and in the root directory of this software. */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;/** */
|
||||
;/** ThreadX Component */
|
||||
;/** */
|
||||
;/** Initialize */
|
||||
;/** */
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Initialize */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
EXTERN _tx_thread_system_stack_ptr
|
||||
EXTERN _tx_initialize_unused_memory
|
||||
EXTERN _tx_timer_interrupt
|
||||
@@ -28,135 +27,123 @@
|
||||
EXTERN __vector_table
|
||||
EXTERN _tx_thread_current_ptr
|
||||
EXTERN _tx_thread_stack_error_handler
|
||||
;
|
||||
;
|
||||
|
||||
SYSTEM_CLOCK EQU 96000000
|
||||
SYSTICK_CYCLES EQU ((SYSTEM_CLOCK / 100) -1)
|
||||
;
|
||||
;
|
||||
|
||||
RSEG FREE_MEM:DATA
|
||||
PUBLIC __tx_free_memory_start
|
||||
__tx_free_memory_start
|
||||
DS32 4
|
||||
;
|
||||
;
|
||||
|
||||
SECTION `.text`:CODE:NOROOT(2)
|
||||
THUMB
|
||||
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* FUNCTION RELEASE */
|
||||
;/* */
|
||||
;/* _tx_initialize_low_level Cortex-M23/IAR */
|
||||
;/* 6.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 */
|
||||
;/* */
|
||||
;/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;VOID _tx_initialize_low_level(VOID)
|
||||
;{
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_initialize_low_level Cortex-M23/IAR */
|
||||
/* 6.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 */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_initialize_low_level(VOID)
|
||||
// {
|
||||
PUBLIC _tx_initialize_low_level
|
||||
_tx_initialize_low_level:
|
||||
;
|
||||
; /* Disable interrupts during ThreadX initialization. */
|
||||
;
|
||||
|
||||
/* Disable interrupts during ThreadX initialization. */
|
||||
CPSID i
|
||||
;
|
||||
; /* Set base of available memory to end of non-initialised RAM area. */
|
||||
;
|
||||
LDR r0, =_tx_initialize_unused_memory ; Build address of unused memory pointer
|
||||
LDR r1, =__tx_free_memory_start ; Build first free address
|
||||
STR r1, [r0] ; Setup first unused memory pointer
|
||||
;
|
||||
; /* Setup Vector Table Offset Register. */
|
||||
;
|
||||
LDR r0, =0xE000ED08 ; Build address of NVIC registers
|
||||
LDR r1, =__vector_table ; Pickup address of vector table
|
||||
STR r1, [r0] ; Set vector table address
|
||||
;
|
||||
; /* Enable the cycle count register. */
|
||||
;
|
||||
; LDR r0, =0xE0001000 ; Build address of DWT register
|
||||
; LDR r1, [r0] ; Pickup the current value
|
||||
; ORR r1, r1, #1 ; Set the CYCCNTENA bit
|
||||
; STR r1, [r0] ; Enable the cycle count register
|
||||
;
|
||||
; /* Set system stack pointer from vector value. */
|
||||
;
|
||||
LDR r0, =_tx_thread_system_stack_ptr ; Build address of system stack pointer
|
||||
LDR r1, =__vector_table ; Pickup address of vector table
|
||||
LDR r1, [r1] ; Pickup reset stack pointer
|
||||
STR r1, [r0] ; Save system stack pointer
|
||||
;
|
||||
; /* Configure SysTick. */
|
||||
;
|
||||
LDR r0, =0xE000E000 ; Build address of NVIC registers
|
||||
|
||||
/* Set base of available memory to end of non-initialised RAM area. */
|
||||
LDR r0, =_tx_initialize_unused_memory // Build address of unused memory pointer
|
||||
LDR r1, =__tx_free_memory_start // Build first free address
|
||||
STR r1, [r0] // Setup first unused memory pointer
|
||||
|
||||
/* Setup Vector Table Offset Register. */
|
||||
LDR r0, =0xE000ED08 // Build address of NVIC registers
|
||||
LDR r1, =__vector_table // Pickup address of vector table
|
||||
STR r1, [r0] // Set vector table address
|
||||
|
||||
/* Enable the cycle count register. */
|
||||
// LDR r0, =0xE0001000 // Build address of DWT register
|
||||
// LDR r1, [r0] // Pickup the current value
|
||||
// ORR r1, r1, #1 // Set the CYCCNTENA bit
|
||||
// STR r1, [r0] // Enable the cycle count register
|
||||
|
||||
/* Set system stack pointer from vector value. */
|
||||
LDR r0, =_tx_thread_system_stack_ptr // Build address of system stack pointer
|
||||
LDR r1, =__vector_table // Pickup address of vector table
|
||||
LDR r1, [r1] // Pickup reset stack pointer
|
||||
STR r1, [r0] // Save system stack pointer
|
||||
|
||||
/* Configure SysTick. */
|
||||
LDR r0, =0xE000E000 // Build address of NVIC registers
|
||||
LDR r1, =SYSTICK_CYCLES
|
||||
STR r1, [r0, #0x14] ; Setup SysTick Reload Value
|
||||
MOV r1, #0x7 ; Build SysTick Control Enable Value
|
||||
STR r1, [r0, #0x10] ; Setup SysTick Control
|
||||
;
|
||||
; /* Configure handler priorities. */
|
||||
;
|
||||
LDR r1, =0x00000000 ; Rsrv, UsgF, BusF, MemM
|
||||
LDR r0, =0xE000E000 ; Build address of NVIC registers
|
||||
LDR r2, =0xD18 ;
|
||||
ADD r0, r0, r2 ;
|
||||
STR r1, [r0] ; Setup System Handlers 4-7 Priority Registers
|
||||
STR r1, [r0, #0x14] // Setup SysTick Reload Value
|
||||
MOV r1, #0x7 // Build SysTick Control Enable Value
|
||||
STR r1, [r0, #0x10] // Setup SysTick Control
|
||||
|
||||
LDR r1, =0xFF000000 ; SVCl, Rsrv, Rsrv, Rsrv
|
||||
LDR r0, =0xE000E000 ; Build address of NVIC registers
|
||||
LDR r2, =0xD1C ;
|
||||
ADD r0, r0, r2 ;
|
||||
STR r1, [r0] ; Setup System Handlers 8-11 Priority Registers
|
||||
; Note: SVC must be lowest priority, which is 0xFF
|
||||
/* Configure handler priorities. */
|
||||
LDR r1, =0x00000000 // Rsrv, UsgF, BusF, MemM
|
||||
LDR r0, =0xE000E000 // Build address of NVIC registers
|
||||
LDR r2, =0xD18 //
|
||||
ADD r0, r0, r2 //
|
||||
STR r1, [r0] // Setup System Handlers 4-7 Priority Registers
|
||||
|
||||
LDR r1, =0x40FF0000 ; SysT, PnSV, Rsrv, DbgM
|
||||
LDR r0, =0xE000E000 ; Build address of NVIC registers
|
||||
LDR r2, =0xD20 ;
|
||||
ADD r0, r0, r2 ;
|
||||
STR r1, [r0] ; Setup System Handlers 12-15 Priority Registers
|
||||
; Note: PnSV must be lowest priority, which is 0xFF
|
||||
;
|
||||
; /* Return to caller. */
|
||||
;
|
||||
LDR r1, =0xFF000000 // SVCl, Rsrv, Rsrv, Rsrv
|
||||
LDR r0, =0xE000E000 // Build address of NVIC registers
|
||||
LDR r2, =0xD1C //
|
||||
ADD r0, r0, r2 //
|
||||
STR r1, [r0] // Setup System Handlers 8-11 Priority Registers
|
||||
// Note: SVC must be lowest priority, which is 0xFF
|
||||
|
||||
LDR r1, =0x40FF0000 // SysT, PnSV, Rsrv, DbgM
|
||||
LDR r0, =0xE000E000 // Build address of NVIC registers
|
||||
LDR r2, =0xD20 //
|
||||
ADD r0, r0, r2 //
|
||||
STR r1, [r0] // Setup System Handlers 12-15 Priority Registers
|
||||
// Note: PnSV must be lowest priority, which is 0xFF
|
||||
|
||||
/* Return to caller. */
|
||||
BX lr
|
||||
;}
|
||||
;
|
||||
;
|
||||
;/* Define shells for each of the unused vectors. */
|
||||
;
|
||||
// }
|
||||
|
||||
|
||||
/* Define shells for each of the unused vectors. */
|
||||
|
||||
PUBLIC __tx_BadHandler
|
||||
__tx_BadHandler:
|
||||
B __tx_BadHandler
|
||||
@@ -164,40 +151,48 @@ __tx_BadHandler:
|
||||
|
||||
PUBLIC __tx_IntHandler
|
||||
__tx_IntHandler:
|
||||
; VOID InterruptHandler (VOID)
|
||||
; {
|
||||
PUSH {r0, lr} ; Save LR (and dummy r0 to maintain stack alignment)
|
||||
|
||||
; /* Do interrupt handler work here */
|
||||
; /* .... */
|
||||
|
||||
// VOID InterruptHandler (VOID)
|
||||
// {
|
||||
PUSH {r0,lr} // Save LR (and dummy r0 to maintain stack alignment)
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
/* Do interrupt handler work here */
|
||||
/* .... */
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
; }
|
||||
// }
|
||||
|
||||
|
||||
PUBLIC __tx_SysTickHandler
|
||||
PUBLIC SysTick_Handler
|
||||
SysTick_Handler:
|
||||
__tx_SysTickHandler:
|
||||
; VOID TimerInterruptHandler (VOID)
|
||||
; {
|
||||
;
|
||||
PUSH {r0, lr} ; Save LR (and dummy r0 to maintain stack alignment)
|
||||
// VOID TimerInterruptHandler (VOID)
|
||||
// {
|
||||
PUSH {r0,lr} // Save LR (and dummy r0 to maintain stack alignment)
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
#endif
|
||||
BL _tx_timer_interrupt
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
#endif
|
||||
POP {r0, r1}
|
||||
MOV lr, r1
|
||||
BX lr
|
||||
; }
|
||||
|
||||
// }
|
||||
|
||||
PUBLIC HardFault_Handler
|
||||
HardFault_Handler:
|
||||
; A stack overflow will trigger a hardfault.
|
||||
; There is no CFSR in M23, so we will not try to
|
||||
; determine if the fault is caused by a stack overflow
|
||||
; or some other condition.
|
||||
// A stack overflow will trigger a hardfault.
|
||||
// There is no CFSR in M23, so we will not try to
|
||||
// determine if the fault is caused by a stack overflow
|
||||
// or some other condition.
|
||||
B HardFault_Handler
|
||||
|
||||
|
||||
|
||||
@@ -1,71 +1,71 @@
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
;/* */
|
||||
;/* This software is licensed under the Microsoft Software License */
|
||||
;/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
;/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
;/* and in the root directory of this software. */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;/** */
|
||||
;/** ThreadX Component */
|
||||
;/** */
|
||||
;/** Thread */
|
||||
;/** */
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Thread */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
EXTERN _tx_execution_isr_exit
|
||||
SECTION `.text`:CODE:NOROOT(2)
|
||||
THUMB
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* FUNCTION RELEASE */
|
||||
;/* */
|
||||
;/* _tx_thread_context_restore Cortex-M23/IAR */
|
||||
;/* 6.1 */
|
||||
;/* AUTHOR */
|
||||
;/* */
|
||||
;/* Scott Larson, Microsoft Corporation */
|
||||
;/* */
|
||||
;/* DESCRIPTION */
|
||||
;/* */
|
||||
;/* This function is not needed for Cortex-M. */
|
||||
;/* */
|
||||
;/* INPUT */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* OUTPUT */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLS */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLED BY */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* RELEASE HISTORY */
|
||||
;/* */
|
||||
;/* DATE NAME DESCRIPTION */
|
||||
;/* */
|
||||
;/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;VOID _tx_thread_context_restore(VOID)
|
||||
;{
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_context_restore Cortex-M23/IAR */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is not needed for Cortex-M. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [_tx_execution_isr_exit] Execution profiling ISR exit */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* ISRs Interrupt Service Routines */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_thread_context_restore(VOID)
|
||||
// {
|
||||
PUBLIC _tx_thread_context_restore
|
||||
_tx_thread_context_restore:
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the ISR exit function to indicate an ISR is complete. */
|
||||
PUSH {r0, lr} // Save return address
|
||||
BL _tx_execution_isr_exit // Call the ISR exit function
|
||||
@@ -73,5 +73,5 @@ _tx_thread_context_restore:
|
||||
#endif
|
||||
|
||||
BX lr
|
||||
;}
|
||||
// }
|
||||
END
|
||||
|
||||
@@ -1,79 +1,77 @@
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
;/* */
|
||||
;/* This software is licensed under the Microsoft Software License */
|
||||
;/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
;/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
;/* and in the root directory of this software. */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;/** */
|
||||
;/** ThreadX Component */
|
||||
;/** */
|
||||
;/** Thread */
|
||||
;/** */
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Thread */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
EXTERN _tx_execution_isr_enter
|
||||
SECTION `.text`:CODE:NOROOT(2)
|
||||
THUMB
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* FUNCTION RELEASE */
|
||||
;/* */
|
||||
;/* _tx_thread_context_save Cortex-M23/IAR */
|
||||
;/* 6.1 */
|
||||
;/* AUTHOR */
|
||||
;/* */
|
||||
;/* Scott Larson, Microsoft Corporation */
|
||||
;/* */
|
||||
;/* DESCRIPTION */
|
||||
;/* */
|
||||
;/* This function is not needed for Cortex-M. */
|
||||
;/* */
|
||||
;/* INPUT */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* OUTPUT */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLS */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLED BY */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* RELEASE HISTORY */
|
||||
;/* */
|
||||
;/* DATE NAME DESCRIPTION */
|
||||
;/* */
|
||||
;/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;VOID _tx_thread_context_save(VOID)
|
||||
;{
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_context_save Cortex-M23/IAR */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is not needed for Cortex-M. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* [_tx_execution_isr_enter] Execution profiling ISR enter */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* ISRs */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_thread_context_save(VOID)
|
||||
// {
|
||||
PUBLIC _tx_thread_context_save
|
||||
_tx_thread_context_save:
|
||||
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
#if (defined(TX_ENABLE_EXECUTION_CHANGE_NOTIFY) || defined(TX_EXECUTION_PROFILE_ENABLE))
|
||||
/* Call the ISR enter function to indicate an ISR is starting. */
|
||||
PUSH {r0, lr} // Save return address
|
||||
BL _tx_execution_isr_enter // Call the ISR enter function
|
||||
POP {r0, lr} // Recover return address
|
||||
#endif
|
||||
|
||||
/* Context is already saved - just return. */
|
||||
|
||||
BX lr
|
||||
;}
|
||||
// }
|
||||
END
|
||||
|
||||
@@ -1,77 +1,72 @@
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
;/* */
|
||||
;/* This software is licensed under the Microsoft Software License */
|
||||
;/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
;/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
;/* and in the root directory of this software. */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;/** */
|
||||
;/** ThreadX Component */
|
||||
;/** */
|
||||
;/** Thread */
|
||||
;/** */
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Thread */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
SECTION `.text`:CODE:NOROOT(2)
|
||||
THUMB
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* FUNCTION RELEASE */
|
||||
;/* */
|
||||
;/* _tx_thread_interrupt_control Cortex-M23/IAR */
|
||||
;/* 6.1 */
|
||||
;/* AUTHOR */
|
||||
;/* */
|
||||
;/* Scott Larson, Microsoft Corporation */
|
||||
;/* */
|
||||
;/* DESCRIPTION */
|
||||
;/* */
|
||||
;/* This function is responsible for changing the interrupt lockout */
|
||||
;/* posture of the system. */
|
||||
;/* */
|
||||
;/* INPUT */
|
||||
;/* */
|
||||
;/* new_posture New interrupt lockout posture */
|
||||
;/* */
|
||||
;/* OUTPUT */
|
||||
;/* */
|
||||
;/* old_posture Old interrupt lockout posture */
|
||||
;/* */
|
||||
;/* CALLS */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLED BY */
|
||||
;/* */
|
||||
;/* Application Code */
|
||||
;/* */
|
||||
;/* RELEASE HISTORY */
|
||||
;/* */
|
||||
;/* DATE NAME DESCRIPTION */
|
||||
;/* */
|
||||
;/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;UINT _tx_thread_interrupt_control(UINT new_posture)
|
||||
;{
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_interrupt_control Cortex-M23/IAR */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is responsible for changing the interrupt lockout */
|
||||
/* posture of the system. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* new_posture New interrupt lockout posture */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* old_posture Old interrupt lockout posture */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_interrupt_control(UINT new_posture)
|
||||
// {
|
||||
PUBLIC _tx_thread_interrupt_control
|
||||
_tx_thread_interrupt_control:
|
||||
;
|
||||
; /* Pickup current interrupt lockout posture. */
|
||||
;
|
||||
MRS r1, PRIMASK
|
||||
MSR PRIMASK, r0
|
||||
MOV r0, r1
|
||||
BX lr
|
||||
;
|
||||
;}
|
||||
MRS r1, PRIMASK // Pickup current interrupt lockout
|
||||
MSR PRIMASK, r0 // Apply the new interrupt lockout
|
||||
MOV r0, r1 // Transfer old to return register
|
||||
BX lr // Return to caller
|
||||
// }
|
||||
END
|
||||
|
||||
@@ -1,76 +1,72 @@
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
;/* */
|
||||
;/* This software is licensed under the Microsoft Software License */
|
||||
;/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
;/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
;/* and in the root directory of this software. */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;/** */
|
||||
;/** ThreadX Component */
|
||||
;/** */
|
||||
;/** Thread */
|
||||
;/** */
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Thread */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
SECTION `.text`:CODE:NOROOT(2)
|
||||
THUMB
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* FUNCTION RELEASE */
|
||||
;/* */
|
||||
;/* _tx_thread_interrupt_disable Cortex-M23/IAR */
|
||||
;/* 6.1 */
|
||||
;/* AUTHOR */
|
||||
;/* */
|
||||
;/* Scott Larson, Microsoft Corporation */
|
||||
;/* */
|
||||
;/* DESCRIPTION */
|
||||
;/* */
|
||||
;/* This function is responsible for disabling interrupts and returning */
|
||||
;/* the previous interrupt lockout posture. */
|
||||
;/* */
|
||||
;/* INPUT */
|
||||
;/* */
|
||||
;/* old_posture Old interrupt lockout posture */
|
||||
;/* */
|
||||
;/* OUTPUT */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLS */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLED BY */
|
||||
;/* */
|
||||
;/* Application Code */
|
||||
;/* */
|
||||
;/* RELEASE HISTORY */
|
||||
;/* */
|
||||
;/* DATE NAME DESCRIPTION */
|
||||
;/* */
|
||||
;/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;UINT _tx_thread_interrupt_disable(UINT new_posture)
|
||||
;{
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_interrupt_disable Cortex-M23/IAR */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is responsible for disabling interrupts and returning */
|
||||
/* the previous interrupt lockout posture. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* old_posture Old interrupt lockout posture */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// UINT _tx_thread_interrupt_disable(VOID)
|
||||
// {
|
||||
PUBLIC _tx_thread_interrupt_disable
|
||||
_tx_thread_interrupt_disable:
|
||||
;
|
||||
; /* Return current interrupt lockout posture. */
|
||||
;
|
||||
/* Return current interrupt lockout posture. */
|
||||
MRS r0, PRIMASK
|
||||
CPSID i
|
||||
BX lr
|
||||
;
|
||||
;}
|
||||
// }
|
||||
END
|
||||
|
||||
@@ -1,75 +1,71 @@
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
;/* */
|
||||
;/* This software is licensed under the Microsoft Software License */
|
||||
;/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
;/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
;/* and in the root directory of this software. */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;/** */
|
||||
;/** ThreadX Component */
|
||||
;/** */
|
||||
;/** Thread */
|
||||
;/** */
|
||||
;/**************************************************************************/
|
||||
;/**************************************************************************/
|
||||
;
|
||||
;
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Thread */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
SECTION `.text`:CODE:NOROOT(2)
|
||||
THUMB
|
||||
;/**************************************************************************/
|
||||
;/* */
|
||||
;/* FUNCTION RELEASE */
|
||||
;/* */
|
||||
;/* _tx_thread_interrupt_restore Cortex-M23/IAR */
|
||||
;/* 6.1 */
|
||||
;/* AUTHOR */
|
||||
;/* */
|
||||
;/* Scott Larson, Microsoft Corporation */
|
||||
;/* */
|
||||
;/* DESCRIPTION */
|
||||
;/* */
|
||||
;/* This function is responsible for restoring the previous */
|
||||
;/* interrupt lockout posture. */
|
||||
;/* */
|
||||
;/* INPUT */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* OUTPUT */
|
||||
;/* */
|
||||
;/* previous_posture Previous interrupt posture */
|
||||
;/* */
|
||||
;/* CALLS */
|
||||
;/* */
|
||||
;/* None */
|
||||
;/* */
|
||||
;/* CALLED BY */
|
||||
;/* */
|
||||
;/* Application Code */
|
||||
;/* */
|
||||
;/* RELEASE HISTORY */
|
||||
;/* */
|
||||
;/* DATE NAME DESCRIPTION */
|
||||
;/* */
|
||||
;/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
;/* */
|
||||
;/**************************************************************************/
|
||||
;VOID _tx_thread_interrupt_restore(UINT new_posture)
|
||||
;{
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_thread_interrupt_restore Cortex-M23/IAR */
|
||||
/* 6.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Scott Larson, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function is responsible for restoring the previous */
|
||||
/* interrupt lockout posture. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* previous_posture Previous interrupt posture */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 09-30-2020 Scott Larson Initial Version 6.1 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
// VOID _tx_thread_interrupt_restore(UINT previous_posture)
|
||||
// {
|
||||
PUBLIC _tx_thread_interrupt_restore
|
||||
_tx_thread_interrupt_restore:
|
||||
;
|
||||
; /* Restore previous interrupt lockout posture. */
|
||||
;
|
||||
/* Restore previous interrupt lockout posture. */
|
||||
MSR PRIMASK, r0
|
||||
BX lr
|
||||
;
|
||||
;}
|
||||
// }
|
||||
END
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user