summaryrefslogtreecommitdiff
path: root/ports_arch/ARMv7-M/threadx/gnu
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-10-02 10:42:44 -0400
committerGitHub <[email protected]>2026-10-02 10:42:44 -0400
commit93387b0a60382a29579bbad5045c68328e3751df (patch)
tree42be790d602cb76f55090e5a7c418df7ea2b3428 /ports_arch/ARMv7-M/threadx/gnu
parent44d7c95c582d415c4ad84527180b29c93c3bf664 (diff)
parent28281cd5647d4671236ca08d19bd18ed15b2265a (diff)
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'ports_arch/ARMv7-M/threadx/gnu')
-rw-r--r--ports_arch/ARMv7-M/threadx/gnu/CMakeLists.txt4
-rw-r--r--ports_arch/ARMv7-M/threadx/gnu/example_build/tx_initialize_low_level.S17
-rw-r--r--ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_schedule.S13
-rw-r--r--ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_system_return.S6
4 files changed, 25 insertions, 15 deletions
diff --git a/ports_arch/ARMv7-M/threadx/gnu/CMakeLists.txt b/ports_arch/ARMv7-M/threadx/gnu/CMakeLists.txt
index ab9464d2..4abc1c06 100644
--- a/ports_arch/ARMv7-M/threadx/gnu/CMakeLists.txt
+++ b/ports_arch/ARMv7-M/threadx/gnu/CMakeLists.txt
@@ -13,6 +13,8 @@ target_sources(${PROJECT_NAME} PRIVATE
# {{END_TARGET_SOURCES}}
)
-target_include_directories(${PROJECT_NAME} PUBLIC
+target_include_directories(${PROJECT_NAME}
+ SYSTEM
+ PUBLIC
${CMAKE_CURRENT_LIST_DIR}/inc
)
diff --git a/ports_arch/ARMv7-M/threadx/gnu/example_build/tx_initialize_low_level.S b/ports_arch/ARMv7-M/threadx/gnu/example_build/tx_initialize_low_level.S
index 8fce83db..a8bb445b 100644
--- a/ports_arch/ARMv7-M/threadx/gnu/example_build/tx_initialize_low_level.S
+++ b/ports_arch/ARMv7-M/threadx/gnu/example_build/tx_initialize_low_level.S
@@ -8,6 +8,7 @@
*
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
/**************************************************************************/
@@ -20,12 +21,10 @@
/**************************************************************************/
/**************************************************************************/
- .global _tx_thread_system_stack_ptr
.global _tx_initialize_unused_memory
.global __RAM_segment_used_end__
.global _tx_timer_interrupt
.global __main
- .global _vectors
.global __tx_NMIHandler // NMI
.global __tx_BadHandler // HardFault
.global __tx_SVCallHandler // SVCall
@@ -90,20 +89,12 @@ _tx_initialize_low_level:
ADD r1, r1, #4 //
STR r1, [r0] // Setup first unused memory pointer
- /* Setup Vector Table Offset Register. */
- MOV r0, #0xE000E000 // Build address of NVIC registers
- LDR r1, =_vectors // Pickup address of vector table
- STR r1, [r0, #0xD08] // Set vector table address
-
- /* Set system stack pointer from vector value. */
- LDR r0, =_tx_thread_system_stack_ptr // Build address of system stack pointer
- LDR r1, =_vectors // Pickup address of vector table
- LDR r1, [r1] // Pickup reset stack pointer
- STR r1, [r0] // Save system stack pointer
-
#ifndef TX_NO_TIMER
/* Configure SysTick. */
MOV r0, #0xE000E000 // Build address of NVIC registers
+ MOV r1, #0 // Build value for SysTick reset
+ STR r1, [r0, #0x10] // Reset SysTick Control
+ STR r1, [r0, #0x18] // Reset SysTick Counter Value
LDR r1, =SYSTICK_CYCLES
STR r1, [r0, #0x14] // Setup SysTick Reload Value
MOV r1, #0x7 // Build SysTick Control Enable Value
diff --git a/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_schedule.S b/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_schedule.S
index 65c5ad50..182eb81a 100644
--- a/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_schedule.S
+++ b/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_schedule.S
@@ -8,6 +8,7 @@
*
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
/**************************************************************************/
@@ -137,7 +138,7 @@ __tx_ts_handler:
BL _tx_execution_thread_exit // Call the thread exit function
POP {r0, lr} // Recover LR
#ifdef TX_PORT_USE_BASEPRI
- MOV r0, 0 // Disable BASEPRI masking (enable interrupts)
+ MOV r0, #0 // Disable BASEPRI masking (enable interrupts)
MSR BASEPRI, r0
#else
CPSIE i // Enable interrupts
@@ -265,9 +266,19 @@ __tx_ts_wait:
#endif
#ifdef TX_ENABLE_WFI
+#ifdef TX_PORT_USE_BASEPRI
+ CPSID i // Mask every interrupt with PRIMASK, which WFI ignores
+ MOV r1, #0 // Clear BASEPRI so that an interrupt masked by it
+ MSR BASEPRI, r1 // is still able to wake the processor
+#endif
DSB // Ensure no outstanding memory transactions
WFI // Wait for interrupt
ISB // Ensure pipeline is flushed
+#ifdef TX_PORT_USE_BASEPRI
+ LDR r1, =TX_PORT_BASEPRI // Restore the BASEPRI mask
+ MSR BASEPRI, r1
+ CPSIE i // Clear PRIMASK; a pending interrupt is taken here
+#endif
#endif
#ifdef TX_LOW_POWER
diff --git a/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_system_return.S b/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_system_return.S
index 8b681747..ab050566 100644
--- a/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_system_return.S
+++ b/ports_arch/ARMv7-M/threadx/gnu/src/tx_thread_system_return.S
@@ -9,6 +9,8 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Portions of this file were generated with AI assistance.
+
/**************************************************************************/
/**************************************************************************/
@@ -73,6 +75,8 @@ _tx_thread_system_return:
MOV r0, #0x10000000 // Load PENDSVSET bit
MOV r1, #0xE000E000 // Load NVIC base
STR r0, [r1, #0xD04] // Set PENDSVBIT in ICSR
+ DSB #0xF // Ensure memory access is complete
+ ISB #0xF // Flush pipeline
MRS r0, IPSR // Pickup IPSR
CMP r0, #0 // Is it a thread returning?
BNE _isr_context // If ISR, skip interrupt enable
@@ -81,10 +85,12 @@ _tx_thread_system_return:
MOV r0, #0
MSR BASEPRI, r0 // Enable interrupts
MSR BASEPRI, r1 // Restore original interrupt posture
+ ISB #0xF // Flush pipeline
#else
MRS r1, PRIMASK // Thread context returning, pickup PRIMASK
CPSIE i // Enable interrupts
MSR PRIMASK, r1 // Restore original interrupt posture
+ ISB #0xF // Flush pipeline
#endif
_isr_context:
BX lr // Return to caller