1
0
mirror of https://github.com/azure-rtos/threadx synced 2025-01-16 07:42:57 +08:00

patch from ST patch 87f130e.diff.

This commit is contained in:
Yajun Xia 2023-11-30 14:38:21 +08:00
parent 776ea213ce
commit 2ef4ac0cb0
13 changed files with 173 additions and 208 deletions

View File

@ -23,6 +23,13 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
#ifdef TX_ENABLE_FIQ_SUPPORT
DISABLE_INTS = 0xC0 // Disable IRQ/FIQ interrupts
#else
@ -31,11 +38,6 @@ DISABLE_INTS = 0x80 // Disable IRQ interrupts
MODE_MASK = 0x1F // Mode mask
FIQ_MODE_BITS = 0x11 // FIQ mode bits
/* No 16-bit Thumb mode veneer code is needed for _tx_thread_fiq_nesting_end
since it will never be called 16-bit mode. */
.arm
.text
.align 2
/**************************************************************************/
@ -90,6 +92,9 @@ FIQ_MODE_BITS = 0x11 // FIQ mode bits
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_fiq_nesting_end
.type _tx_thread_fiq_nesting_end,function
_tx_thread_fiq_nesting_end:
@ -103,8 +108,4 @@ _tx_thread_fiq_nesting_end:
ORR r0, r0, #FIQ_MODE_BITS // Build IRQ mode CPSR
MSR CPSR_c, r0 // Reenter IRQ mode
#ifdef __THUMB_INTERWORK
BX r3 // Return to caller
#else
MOV pc, r3 // Return to caller
#endif

View File

@ -1,15 +1,30 @@
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
/* .text is used instead of .section .text so it works with arm-aout too. */
.text
.code 32
.align 0
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _mainCRTStartup
_mainCRTStartup:
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _start
_start:
#if !defined(ARM_MODE)
.thumb_func
#endif
.global start
start:
_start:
_mainCRTStartup:
/* Start by setting up a stack */
/* Set up the stack pointer to a fixed value */
@ -69,15 +84,7 @@ _mainCRTStartup:
.word _fini
#endif */
/* Return ... */
#ifdef __APCS_26__
movs pc, lr
#else
#ifdef __THUMB_INTERWORK
bx lr
#else
mov pc, lr
#endif
#endif
.global _fini
.type _fini,function

View File

@ -23,7 +23,12 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
SVC_MODE = 0xD3 // Disable IRQ/FIQ SVC mode
IRQ_MODE = 0xD2 // Disable IRQ/FIQ IRQ mode
@ -48,22 +53,7 @@ SYS_STACK_SIZE = 1024 // System stack size
.global enableCaches
.global init_private_timer
.global start_private_timer
/* Define the 16-bit Thumb mode veneer for _tx_initialize_low_level for
applications calling this function from to 16-bit Thumb mode. */
.text
.align 2
.thumb
.global $_tx_initialize_low_level
.type $_tx_initialize_low_level,function
$_tx_initialize_low_level:
BX pc // Switch to 32-bit mode
NOP //
.arm
STMFD sp!, {lr} // Save return address
BL _tx_initialize_low_level // Call _tx_initialize_low_level function
LDMFD sp!, {lr} // Recover saved return address
BX lr // Return to 16-bit caller
.text
.align 2
@ -113,6 +103,9 @@ $_tx_initialize_low_level:
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_initialize_low_level
.type _tx_initialize_low_level,function
_tx_initialize_low_level:
@ -201,34 +194,48 @@ _stack_error_loop:
BL start_private_timer
POP {lr}
#ifdef __THUMB_INTERWORK
BX lr // Return to caller
#else
MOV pc, lr // Return to caller
#endif
/* Define shells for each of the interrupt vectors. */
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_undefined
__tx_undefined:
B __tx_undefined // Undefined handler
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_swi_interrupt
__tx_swi_interrupt:
B __tx_swi_interrupt // Software interrupt handler
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_prefetch_handler
__tx_prefetch_handler:
B __tx_prefetch_handler // Prefetch exception handler
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_abort_handler
__tx_abort_handler:
B __tx_abort_handler // Abort exception handler
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_reserved_handler
__tx_reserved_handler:
B __tx_reserved_handler // Reserved exception handler
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_irq_handler
.global __tx_irq_processing_return
__tx_irq_handler:
@ -302,6 +309,9 @@ by_pass_timer_interrupt:
#ifdef TX_ENABLE_FIQ_SUPPORT
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_fiq_handler
.global __tx_fiq_processing_return
__tx_fiq_handler:
@ -336,6 +346,9 @@ __tx_fiq_processing_return:
#else
#if !defined(ARM_MODE)
.thumb_func
#endif
.global __tx_fiq_handler
__tx_fiq_handler:
B __tx_fiq_handler // FIQ interrupt handler

View File

@ -23,6 +23,13 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
#ifdef TX_ENABLE_FIQ_SUPPORT
DISABLE_INTS = 0xC0 // Disable IRQ/FIQ interrupts
#else
@ -31,11 +38,6 @@ DISABLE_INTS = 0x80 // Disable IRQ interrupts
MODE_MASK = 0x1F // Mode mask
FIQ_MODE_BITS = 0x11 // FIQ mode bits
/* No 16-bit Thumb mode veneer code is needed for _tx_thread_fiq_nesting_end
since it will never be called 16-bit mode. */
.arm
.text
.align 2
/**************************************************************************/
@ -90,6 +92,9 @@ FIQ_MODE_BITS = 0x11 // FIQ mode bits
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_fiq_nesting_end
.type _tx_thread_fiq_nesting_end,function
_tx_thread_fiq_nesting_end:
@ -103,8 +108,4 @@ _tx_thread_fiq_nesting_end:
ORR r0, r0, #FIQ_MODE_BITS // Build IRQ mode CPSR
MSR CPSR_c, r0 // Reenter IRQ mode
#ifdef __THUMB_INTERWORK
BX r3 // Return to caller
#else
MOV pc, r3 // Return to caller
#endif

View File

@ -23,15 +23,17 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
FIQ_DISABLE = 0x40 // FIQ disable bit
MODE_MASK = 0x1F // Mode mask
SYS_MODE_BITS = 0x1F // System mode bits
/* No 16-bit Thumb mode veneer code is needed for _tx_thread_fiq_nesting_start
since it will never be called 16-bit mode. */
.arm
.text
.align 2
/**************************************************************************/
@ -83,6 +85,9 @@ SYS_MODE_BITS = 0x1F // System mode bits
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_fiq_nesting_start
.type _tx_thread_fiq_nesting_start,function
_tx_thread_fiq_nesting_start:
@ -95,8 +100,4 @@ _tx_thread_fiq_nesting_start:
// and push r1 just to keep 8-byte alignment
BIC r0, r0, #FIQ_DISABLE // Build enable FIQ CPSR
MSR CPSR_c, r0 // Enter system mode
#ifdef __THUMB_INTERWORK
BX r3 // Return to caller
#else
MOV pc, r3 // Return to caller
#endif

View File

@ -23,24 +23,14 @@
#include "tx_user.h"
#endif
INT_MASK = 0x03F
/* Define the 16-bit Thumb mode veneer for _tx_thread_interrupt_control for
applications calling this function from to 16-bit Thumb mode. */
.text
.align 2
.global $_tx_thread_interrupt_control
$_tx_thread_interrupt_control:
.thumb
BX pc // Switch to 32-bit mode
NOP //
.syntax unified
#if defined(ARM_MODE)
.arm
STMFD sp!, {lr} // Save return address
BL _tx_thread_interrupt_control // Call _tx_thread_interrupt_control function
LDMFD sp!, {lr} // Recover saved return address
BX lr // Return to 16-bit caller
#else
.thumb
#endif
INT_MASK = 0x03F
.text
@ -88,6 +78,9 @@ $_tx_thread_interrupt_control:
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_interrupt_control
.type _tx_thread_interrupt_control,function
_tx_thread_interrupt_control:
@ -103,8 +96,4 @@ _tx_thread_interrupt_control:
MSR CPSR_c, r1 // Setup new CPSR
BIC r0, r3, r2 // Return previous interrupt mask
#ifdef __THUMB_INTERWORK
BX lr // Return to caller
#else
MOV pc, lr // Return to caller
#endif

View File

@ -23,22 +23,11 @@
#include "tx_user.h"
#endif
/* Define the 16-bit Thumb mode veneer for _tx_thread_interrupt_disable for
applications calling this function from to 16-bit Thumb mode. */
.text
.align 2
.global $_tx_thread_interrupt_disable
$_tx_thread_interrupt_disable:
.thumb
BX pc // Switch to 32-bit mode
NOP //
#if defined(ARM_MODE)
.arm
STMFD sp!, {lr} // Save return address
BL _tx_thread_interrupt_disable // Call _tx_thread_interrupt_disable function
LDMFD sp!, {lr} // Recover saved return address
BX lr // Return to 16-bit caller
#else
.thumb
#endif
.text
.align 2
@ -84,6 +73,9 @@ $_tx_thread_interrupt_disable:
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_interrupt_disable
.type _tx_thread_interrupt_disable,function
_tx_thread_interrupt_disable:
@ -100,8 +92,4 @@ _tx_thread_interrupt_disable:
CPSID i // Disable IRQ
#endif
#ifdef __THUMB_INTERWORK
BX lr // Return to caller
#else
MOV pc, lr // Return to caller
#endif

View File

@ -23,22 +23,17 @@
#include "tx_user.h"
#endif
/* Define the 16-bit Thumb mode veneer for _tx_thread_interrupt_restore for
applications calling this function from to 16-bit Thumb mode. */
.text
.align 2
.global $_tx_thread_interrupt_restore
$_tx_thread_interrupt_restore:
.thumb
BX pc // Switch to 32-bit mode
NOP //
.syntax unified
#if defined(ARM_MODE)
.arm
STMFD sp!, {lr} // Save return address
BL _tx_thread_interrupt_restore // Call _tx_thread_interrupt_restore function
LDMFD sp!, {lr} // Recover saved return address
BX lr // Return to 16-bit caller
#else
.thumb
#endif
IRQ_MASK = 0x080
#ifdef TX_ENABLE_FIQ_SUPPORT
FIQ_MASK = 0x040
#endif
.text
.align 2
@ -85,15 +80,22 @@ $_tx_thread_interrupt_restore:
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_interrupt_restore
.type _tx_thread_interrupt_restore,function
_tx_thread_interrupt_restore:
/* Apply the new interrupt posture. */
MSR CPSR_c, r0 // Setup new CPSR
#ifdef __THUMB_INTERWORK
BX lr // Return to caller
#else
MOV pc, lr // Return to caller
TST r0, #IRQ_MASK
BNE no_irq
CPSIE i
no_irq:
#ifdef TX_ENABLE_FIQ_SUPPORT
TST r0, #FIQ_MASK
BNE no_fiq
CPSIE f
no_fiq:
#endif
BX lr // Return to caller

View File

@ -23,6 +23,13 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
#ifdef TX_ENABLE_FIQ_SUPPORT
DISABLE_INTS = 0xC0 // Disable IRQ/FIQ interrupts
#else
@ -31,11 +38,6 @@ DISABLE_INTS = 0x80 // Disable IRQ interrupts
MODE_MASK = 0x1F // Mode mask
IRQ_MODE_BITS = 0x12 // IRQ mode bits
/* No 16-bit Thumb mode veneer code is needed for _tx_thread_irq_nesting_end
since it will never be called 16-bit mode. */
.arm
.text
.align 2
/**************************************************************************/
@ -90,6 +92,9 @@ IRQ_MODE_BITS = 0x12 // IRQ mode bits
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_irq_nesting_end
.type _tx_thread_irq_nesting_end,function
_tx_thread_irq_nesting_end:
@ -102,8 +107,4 @@ _tx_thread_irq_nesting_end:
BIC r0, r0, #MODE_MASK // Clear mode bits
ORR r0, r0, #IRQ_MODE_BITS // Build IRQ mode CPSR
MSR CPSR_c, r0 // Reenter IRQ mode
#ifdef __THUMB_INTERWORK
BX r3 // Return to caller
#else
MOV pc, r3 // Return to caller
#endif

View File

@ -23,15 +23,17 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
IRQ_DISABLE = 0x80 // IRQ disable bit
MODE_MASK = 0x1F // Mode mask
SYS_MODE_BITS = 0x1F // System mode bits
/* No 16-bit Thumb mode veneer code is needed for _tx_thread_irq_nesting_start
since it will never be called 16-bit mode. */
.arm
.text
.align 2
/**************************************************************************/
@ -83,6 +85,9 @@ SYS_MODE_BITS = 0x1F // System mode bits
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_irq_nesting_start
.type _tx_thread_irq_nesting_start,function
_tx_thread_irq_nesting_start:
@ -95,8 +100,4 @@ _tx_thread_irq_nesting_start:
// and push r1 just to keep 8-byte alignment
BIC r0, r0, #IRQ_DISABLE // Build enable IRQ CPSR
MSR CPSR_c, r0 // Enter system mode
#ifdef __THUMB_INTERWORK
BX r3 // Return to caller
#else
MOV pc, r3 // Return to caller
#endif

View File

@ -23,29 +23,17 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
.global _tx_thread_execute_ptr
.global _tx_thread_current_ptr
.global _tx_timer_time_slice
/* Define the 16-bit Thumb mode veneer for _tx_thread_schedule for
applications calling this function from to 16-bit Thumb mode. */
.text
.align 2
.global $_tx_thread_schedule
.type $_tx_thread_schedule,function
$_tx_thread_schedule:
.thumb
BX pc // Switch to 32-bit mode
NOP //
.arm
STMFD sp!, {lr} // Save return address
BL _tx_thread_schedule // Call _tx_thread_schedule function
LDMFD sp!, {lr} // Recover saved return address
BX lr // Return to 16-bit caller
.text
.align 2
/**************************************************************************/
@ -97,6 +85,9 @@ $_tx_thread_schedule:
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_schedule
.type _tx_thread_schedule,function
_tx_thread_schedule:
@ -187,14 +178,13 @@ _tx_skip_solicited_vfp_restore:
#endif
MSR CPSR_cxsf, r5 // Recover CPSR
LDMIA sp!, {r4-r11, lr} // Return to thread synchronously
#ifdef __THUMB_INTERWORK
BX lr // Return to caller
#else
MOV pc, lr // Return to caller
#endif
#ifdef TX_ENABLE_VFP_SUPPORT
#if !defined(ARM_MODE)
.thumb_func
#endif
.global tx_thread_vfp_enable
.type tx_thread_vfp_enable,function
tx_thread_vfp_enable:
@ -214,6 +204,9 @@ __tx_no_thread_to_enable:
MSR CPSR_cxsf, r2 // Recover CPSR
BX LR // Return to caller
#if !defined(ARM_MODE)
.thumb_func
#endif
.global tx_thread_vfp_disable
.type tx_thread_vfp_disable,function
tx_thread_vfp_disable:

View File

@ -23,7 +23,12 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
SVC_MODE = 0x13 // SVC mode
#ifdef TX_ENABLE_FIQ_SUPPORT
@ -32,25 +37,6 @@ CPSR_MASK = 0xDF // Mask initial CPSR, IRQ & FIQ
CPSR_MASK = 0x9F // Mask initial CPSR, IRQ interrupts enabled
#endif
/* Define the 16-bit Thumb mode veneer for _tx_thread_stack_build for
applications calling this function from to 16-bit Thumb mode. */
.text
.align 2
.thumb
.global $_tx_thread_stack_build
.type $_tx_thread_stack_build,function
$_tx_thread_stack_build:
BX pc // Switch to 32-bit mode
NOP //
.arm
STMFD sp!, {lr} // Save return address
BL _tx_thread_stack_build // Call _tx_thread_stack_build function
LDMFD sp!, {lr} // Recover saved return address
BX lr // Return to 16-bit caller
.text
.align 2
/**************************************************************************/
@ -98,6 +84,9 @@ $_tx_thread_stack_build:
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_thread_stack_build
.type _tx_thread_stack_build,function
_tx_thread_stack_build:
@ -164,8 +153,4 @@ _tx_thread_stack_build:
STR r2, [r0, #8] // Save stack pointer in thread's
// control block
#ifdef __THUMB_INTERWORK
BX lr // Return to caller
#else
MOV pc, lr // Return to caller
#endif

View File

@ -23,8 +23,12 @@
#include "tx_user.h"
#endif
.syntax unified
#if defined(ARM_MODE)
.arm
#else
.thumb
#endif
/* Define Assembly language external references... */
@ -37,26 +41,6 @@
.global _tx_timer_expired
.global _tx_thread_time_slice
/* Define the 16-bit Thumb mode veneer for _tx_timer_interrupt for
applications calling this function from to 16-bit Thumb mode. */
.text
.align 2
.thumb
.global $_tx_timer_interrupt
.type $_tx_timer_interrupt,function
$_tx_timer_interrupt:
BX pc // Switch to 32-bit mode
NOP //
.arm
STMFD sp!, {lr} // Save return address
BL _tx_timer_interrupt // Call _tx_timer_interrupt function
LDMFD sp!, {lr} // Recover saved return address
BX lr // Return to 16-bit caller
.text
.align 2
/**************************************************************************/
@ -106,6 +90,9 @@ $_tx_timer_interrupt:
/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
#if !defined(ARM_MODE)
.thumb_func
#endif
.global _tx_timer_interrupt
.type _tx_timer_interrupt,function
_tx_timer_interrupt:
@ -230,8 +217,4 @@ __tx_timer_not_ts_expiration:
__tx_timer_nothing_expired:
#ifdef __THUMB_INTERWORK
BX lr // Return to caller
#else
MOV pc, lr // Return to caller
#endif