summaryrefslogtreecommitdiff
path: root/ports/cortex_m0/gnu/src
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/cortex_m0/gnu/src
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/cortex_m0/gnu/src')
-rw-r--r--ports/cortex_m0/gnu/src/tx_thread_context_restore.S9
-rw-r--r--ports/cortex_m0/gnu/src/tx_thread_context_save.S9
-rw-r--r--ports/cortex_m0/gnu/src/tx_thread_schedule.S4
-rw-r--r--ports/cortex_m0/gnu/src/tx_thread_system_return.S7
4 files changed, 23 insertions, 6 deletions
diff --git a/ports/cortex_m0/gnu/src/tx_thread_context_restore.S b/ports/cortex_m0/gnu/src/tx_thread_context_restore.S
index 96854867..68fd5251 100644
--- a/ports/cortex_m0/gnu/src/tx_thread_context_restore.S
+++ b/ports/cortex_m0/gnu/src/tx_thread_context_restore.S
@@ -85,7 +85,14 @@ _tx_thread_context_restore:
/* 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
- POP {r0, lr} // Recover return address
+ POP {r0, r1} // Recover r0 and the return address
+ MOV lr, r1 // This core cannot POP into LR: the
+ // 16-bit Thumb POP takes r0-r7 and
+ // pc only. MOV to a high register
+ // is permitted, so restore LR from
+ // a scratch register. r1 is free --
+ // the BL above may clobber r0-r3,
+ // which is why r0 is saved at all.
#endif
BX lr
@}
diff --git a/ports/cortex_m0/gnu/src/tx_thread_context_save.S b/ports/cortex_m0/gnu/src/tx_thread_context_save.S
index 9866da13..e62a2871 100644
--- a/ports/cortex_m0/gnu/src/tx_thread_context_save.S
+++ b/ports/cortex_m0/gnu/src/tx_thread_context_save.S
@@ -76,7 +76,14 @@ _tx_thread_context_save:
/* 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
+ POP {r0, r1} // Recover r0 and the return address
+ MOV lr, r1 // This core cannot POP into LR: the
+ // 16-bit Thumb POP takes r0-r7 and
+ // pc only. MOV to a high register
+ // is permitted, so restore LR from
+ // a scratch register. r1 is free --
+ // the BL above may clobber r0-r3,
+ // which is why r0 is saved at all.
#endif
/* Context is already saved - just return. */
diff --git a/ports/cortex_m0/gnu/src/tx_thread_schedule.S b/ports/cortex_m0/gnu/src/tx_thread_schedule.S
index 21b6118a..787d4e10 100644
--- a/ports/cortex_m0/gnu/src/tx_thread_schedule.S
+++ b/ports/cortex_m0/gnu/src/tx_thread_schedule.S
@@ -95,8 +95,8 @@ _tx_thread_schedule:
@
@ /* Enter the scheduler for the first time. */
@
- LDR r0, =#0x10000000 @ Load PENDSVSET bit
- LDR r1, =#0xE000ED04 @ Load NVIC base
+ LDR r0, =0x10000000 @ Load PENDSVSET bit
+ LDR r1, =0xE000ED04 @ Load NVIC base
STR r0, [r1] @ Set PENDSVBIT in ICSR
DSB @ Complete all memory accesses
ISB @ Flush pipeline
diff --git a/ports/cortex_m0/gnu/src/tx_thread_system_return.S b/ports/cortex_m0/gnu/src/tx_thread_system_return.S
index 6019b299..b03e03ba 100644
--- a/ports/cortex_m0/gnu/src/tx_thread_system_return.S
+++ b/ports/cortex_m0/gnu/src/tx_thread_system_return.S
@@ -8,7 +8,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
-// Some portions generated by Gemini (Gemini 2.0 Flash).
+@ Portions of this file were generated with AI assistance.
/**************************************************************************/
@@ -26,7 +26,10 @@
#include "tx_user.h"
#endif
- .text 32
+@ Plain .text rather than a numbered subsection: with .text 32, clang places
+@ the constant pool for the LDR literals below outside the range a Thumb-1
+@ PC-relative load can reach. GNU as accepts either form.
+ .text
.align 4
.syntax unified
@/**************************************************************************/