summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-06-22 08:07:16 -0400
committerGitHub <[email protected]>2026-06-22 08:07:16 -0400
commit32a68cc69ae87ece4d71f2426ca5725bcd3e3c64 (patch)
treea08794557812920ac6663c8d0ce53cf0e67dfb0c
parentb880ffeadab06d008529fad99bb50457af4d9d16 (diff)
Fixed private-timer timestamp issue in several ports (A5, A7, A9, R8) (#554)
* Fixed Cortex-A9 SMP time source Updated Cortex-A9 SMP timestamp reads to use the global timer low counter instead of the decrementing private timer counter. Applied the change to GNU and AC5 ports. * Fixed remaining Arm SMP time sources Updated Cortex-A5, Cortex-A7, and Cortex-R8 SMP timestamp hooks so execution profiling uses incrementing time sources instead of the decrementing private timer count register. Cortex-A5 and Cortex-R8 now read the global timer count low register, matching the Cortex-A9 fix. Cortex-A7 now reads the generic timer physical count register. --------- Co-authored-by: Codex <[email protected]>
-rw-r--r--ports_smp/cortex_a5_smp/ac5/src/tx_thread_smp_time_get.s5
-rw-r--r--ports_smp/cortex_a5_smp/gnu/src/tx_thread_smp_time_get.S5
-rw-r--r--ports_smp/cortex_a7_smp/ac5/src/tx_thread_smp_time_get.s6
-rw-r--r--ports_smp/cortex_a7_smp/gnu/src/tx_thread_smp_time_get.S6
-rw-r--r--ports_smp/cortex_a9_smp/ac5/src/tx_thread_smp_time_get.s5
-rw-r--r--ports_smp/cortex_a9_smp/gnu/src/tx_thread_smp_time_get.S6
-rw-r--r--ports_smp/cortex_r8_smp/ac5/src/tx_thread_smp_time_get.s3
7 files changed, 20 insertions, 16 deletions
diff --git a/ports_smp/cortex_a5_smp/ac5/src/tx_thread_smp_time_get.s b/ports_smp/cortex_a5_smp/ac5/src/tx_thread_smp_time_get.s
index a378060e..8c4b0971 100644
--- a/ports_smp/cortex_a5_smp/ac5/src/tx_thread_smp_time_get.s
+++ b/ports_smp/cortex_a5_smp/ac5/src/tx_thread_smp_time_get.s
@@ -1,5 +1,6 @@
;/***************************************************************************
; * Copyright (c) 2024 Microsoft Corporation
+; * Copyright (c) 2026-present Eclipse ThreadX contributors
; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
@@ -8,6 +9,7 @@
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
+; Some portions generated by Codex (GPT-5).
;
;/**************************************************************************/
;/**************************************************************************/
@@ -69,7 +71,7 @@
_tx_thread_smp_time_get
MRC p15, 4, r0, c15, c0, 0 ; Read periph base address
- LDR r0, [r0, #0x604] ; Read count register
+ LDR r0, [r0, #0x200] ; Read global timer count low register
IF {INTER} = {TRUE}
BX lr ; Return to caller
@@ -78,4 +80,3 @@ _tx_thread_smp_time_get
ENDIF
END
-
diff --git a/ports_smp/cortex_a5_smp/gnu/src/tx_thread_smp_time_get.S b/ports_smp/cortex_a5_smp/gnu/src/tx_thread_smp_time_get.S
index 7e399690..04099aef 100644
--- a/ports_smp/cortex_a5_smp/gnu/src/tx_thread_smp_time_get.S
+++ b/ports_smp/cortex_a5_smp/gnu/src/tx_thread_smp_time_get.S
@@ -1,5 +1,6 @@
@/***************************************************************************
@ * Copyright (c) 2024 Microsoft Corporation
+@ * Copyright (c) 2026-present Eclipse ThreadX contributors
@ *
@ * This program and the accompanying materials are made available under the
@ * terms of the MIT License which is available at
@@ -8,6 +9,7 @@
@ * SPDX-License-Identifier: MIT
@ **************************************************************************/
@
+@ Some portions generated by Codex (GPT-5).
@
@/**************************************************************************/
@/**************************************************************************/
@@ -71,7 +73,7 @@
_tx_thread_smp_time_get:
MRC p15, 4, r0, c15, c0, 0 @ Read periph base address
- LDR r0, [r0, #0x604] @ Read count register
+ LDR r0, [r0, #0x200] @ Read global timer count low register
#ifdef __THUMB_INTERWORK
BX lr @ Return to caller
@@ -79,4 +81,3 @@ _tx_thread_smp_time_get:
MOV pc, lr @ Return to caller
#endif
-
diff --git a/ports_smp/cortex_a7_smp/ac5/src/tx_thread_smp_time_get.s b/ports_smp/cortex_a7_smp/ac5/src/tx_thread_smp_time_get.s
index 627d36f3..e3935200 100644
--- a/ports_smp/cortex_a7_smp/ac5/src/tx_thread_smp_time_get.s
+++ b/ports_smp/cortex_a7_smp/ac5/src/tx_thread_smp_time_get.s
@@ -1,5 +1,6 @@
;/***************************************************************************
; * Copyright (c) 2024 Microsoft Corporation
+; * Copyright (c) 2026-present Eclipse ThreadX contributors
; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
@@ -8,6 +9,7 @@
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
+; Some portions generated by Codex (GPT-5).
;
;/**************************************************************************/
;/**************************************************************************/
@@ -68,8 +70,7 @@
EXPORT _tx_thread_smp_time_get
_tx_thread_smp_time_get
- MRC p15, 4, r0, c15, c0, 0 ; Read periph base address
- LDR r0, [r0, #0x604] ; Read count register
+ MRRC p15, 0, r0, r1, c14 ; Read generic timer physical count
IF {INTER} = {TRUE}
BX lr ; Return to caller
@@ -78,4 +79,3 @@ _tx_thread_smp_time_get
ENDIF
END
-
diff --git a/ports_smp/cortex_a7_smp/gnu/src/tx_thread_smp_time_get.S b/ports_smp/cortex_a7_smp/gnu/src/tx_thread_smp_time_get.S
index 067f50d8..9eb5b12c 100644
--- a/ports_smp/cortex_a7_smp/gnu/src/tx_thread_smp_time_get.S
+++ b/ports_smp/cortex_a7_smp/gnu/src/tx_thread_smp_time_get.S
@@ -1,5 +1,6 @@
@/***************************************************************************
@ * Copyright (c) 2024 Microsoft Corporation
+@ * Copyright (c) 2026-present Eclipse ThreadX contributors
@ *
@ * This program and the accompanying materials are made available under the
@ * terms of the MIT License which is available at
@@ -8,6 +9,7 @@
@ * SPDX-License-Identifier: MIT
@ **************************************************************************/
@
+@ Some portions generated by Codex (GPT-5).
@
@/**************************************************************************/
@/**************************************************************************/
@@ -70,8 +72,7 @@
.type _tx_thread_smp_time_get,function
_tx_thread_smp_time_get:
- MRC p15, 4, r0, c15, c0, 0 @ Read periph base address
- LDR r0, [r0, #0x604] @ Read count register
+ MRRC p15, 0, r0, r1, c14 @ Read generic timer physical count
#ifdef __THUMB_INTERWORK
BX lr @ Return to caller
@@ -79,4 +80,3 @@ _tx_thread_smp_time_get:
MOV pc, lr @ Return to caller
#endif
-
diff --git a/ports_smp/cortex_a9_smp/ac5/src/tx_thread_smp_time_get.s b/ports_smp/cortex_a9_smp/ac5/src/tx_thread_smp_time_get.s
index 5b67b283..d656d1c2 100644
--- a/ports_smp/cortex_a9_smp/ac5/src/tx_thread_smp_time_get.s
+++ b/ports_smp/cortex_a9_smp/ac5/src/tx_thread_smp_time_get.s
@@ -1,5 +1,6 @@
;/***************************************************************************
; * Copyright (c) 2024 Microsoft Corporation
+; * Copyright (c) 2026-present Eclipse ThreadX contributors
; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
@@ -8,6 +9,7 @@
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
+; Some portions generated by Codex (GPT-5).
;
;/**************************************************************************/
;/**************************************************************************/
@@ -69,7 +71,7 @@
_tx_thread_smp_time_get
MRC p15, 4, r0, c15, c0, 0 ; Read periph base address
- LDR r0, [r0, #0x604] ; Read count register
+ LDR r0, [r0, #0x200] ; Read global timer count low register
IF {INTER} = {TRUE}
BX lr ; Return to caller
@@ -78,4 +80,3 @@ _tx_thread_smp_time_get
ENDIF
END
-
diff --git a/ports_smp/cortex_a9_smp/gnu/src/tx_thread_smp_time_get.S b/ports_smp/cortex_a9_smp/gnu/src/tx_thread_smp_time_get.S
index 9cebe0f2..cf8374ad 100644
--- a/ports_smp/cortex_a9_smp/gnu/src/tx_thread_smp_time_get.S
+++ b/ports_smp/cortex_a9_smp/gnu/src/tx_thread_smp_time_get.S
@@ -1,5 +1,6 @@
@/***************************************************************************
@ * Copyright (c) 2024 Microsoft Corporation
+@ * Copyright (c) 2026-present Eclipse ThreadX contributors
@ *
@ * This program and the accompanying materials are made available under the
@ * terms of the MIT License which is available at
@@ -8,6 +9,7 @@
@ * SPDX-License-Identifier: MIT
@ **************************************************************************/
@
+@ Some portions generated by Codex (GPT-5).
@
@/**************************************************************************/
@/**************************************************************************/
@@ -71,12 +73,10 @@
_tx_thread_smp_time_get:
MRC p15, 4, r0, c15, c0, 0 @ Read periph base address
- LDR r0, [r0, #0x604] @ Read count register
+ LDR r0, [r0, #0x200] @ Read global timer count low register
#ifdef __THUMB_INTERWORK
BX lr @ Return to caller
#else
MOV pc, lr @ Return to caller
#endif
-
-
diff --git a/ports_smp/cortex_r8_smp/ac5/src/tx_thread_smp_time_get.s b/ports_smp/cortex_r8_smp/ac5/src/tx_thread_smp_time_get.s
index a43484d7..c1714389 100644
--- a/ports_smp/cortex_r8_smp/ac5/src/tx_thread_smp_time_get.s
+++ b/ports_smp/cortex_r8_smp/ac5/src/tx_thread_smp_time_get.s
@@ -9,6 +9,7 @@
* SPDX-License-Identifier: MIT
**************************************************************************/
+// Some portions generated by Codex (GPT-5).
/**************************************************************************/
/**************************************************************************/
@@ -57,7 +58,7 @@
_tx_thread_smp_time_get
MRC p15, 4, r0, c15, c0, 0 // Read periph base address
- LDR r0, [r0, #0x604] // Read count register
+ LDR r0, [r0, #0x200] // Read global timer count low register
IF {INTER} = {TRUE}
BX lr // Return to caller