summaryrefslogtreecommitdiff
path: root/ports_module/rxv2/iar/module_manager/src
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-03-06 19:27:49 +0100
committerGitHub <[email protected]>2026-03-06 19:27:49 +0100
commit3726d7906b4808bfec7855fc088e073199df9120 (patch)
tree8789bfd03d1d49e1967e80d04aa4ff606fda43eb /ports_module/rxv2/iar/module_manager/src
parent4b6e8100d932a3a67b34c6eb17f84f3bffb9e2ae (diff)
parentc3259a216026372e3833dd8996a68f77e8595fbd (diff)
Merge pull request #510 from eclipse-threadx/devv6.5.0.202601_rel
Merge changes ahead of the v6.5.0.202601 release
Diffstat (limited to 'ports_module/rxv2/iar/module_manager/src')
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_initialize_low_level.s18
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_thread_context_restore.s30
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_thread_context_save.s22
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_thread_interrupt_control.s30
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_thread_schedule.s68
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_thread_stack_build.s26
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_thread_system_return.s16
-rw-r--r--ports_module/rxv2/iar/module_manager/src/tx_timer_interrupt.s32
-rw-r--r--ports_module/rxv2/iar/module_manager/src/txm_module_manager_alignment_adjust.c13
-rw-r--r--ports_module/rxv2/iar/module_manager/src/txm_module_manager_external_memory_enable.c35
-rw-r--r--ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_handler.c17
-rw-r--r--ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_notify.c15
-rw-r--r--ports_module/rxv2/iar/module_manager/src/txm_module_manager_setup_mpu_registers.c35
-rw-r--r--ports_module/rxv2/iar/module_manager/src/txm_module_manager_thread_stack_build.s20
14 files changed, 136 insertions, 241 deletions
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_initialize_low_level.s b/ports_module/rxv2/iar/module_manager/src/tx_initialize_low_level.s
index f3d5293c..3faf9bc9 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_initialize_low_level.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_initialize_low_level.s
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -56,13 +57,6 @@
/* CALLED BY */
/* */
/* _tx_initialize_kernel_enter ThreadX entry function */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 01-31-2022 William E. Lamie Initial Version 6.1.10 */
-/* */
/**************************************************************************/
public __tx_initialize_low_level
@@ -72,7 +66,7 @@ __tx_initialize_low_level:
// _tx_initialize_unused_memory = (VOID_PTR) &free_mem_start;
MOV.L #__tx_free_memory_start, R1 // Pick up unused memory address
- MOV.L #__tx_initialize_unused_memory,R2
+ MOV.L #__tx_initialize_unused_memory,R2
MOV.L R1,[R2] // Save first free memory address
/* Set priority of SWINT to 1. */
@@ -89,7 +83,7 @@ __tx_initialize_low_level:
/* Enable SWINT2. */
OR #(1 << 2), r2
MOV.B r2, [r1]
-
+
RTS
section FREEMEM:DATA
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_thread_context_restore.s b/ports_module/rxv2/iar/module_manager/src/tx_thread_context_restore.s
index b9dc97da..f4c5f492 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_thread_context_restore.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_thread_context_restore.s
@@ -1,10 +1,10 @@
;/***************************************************************************
-; * Copyright (c) 2024 Microsoft Corporation
-; *
+; * Copyright (c) 2024 Microsoft Corporation
+; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
; * https://opensource.org/licenses/MIT.
-; *
+; *
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
@@ -72,16 +72,6 @@
;/* */
;/* ISRs Interrupt Service Routines */
;/* */
-;/* RELEASE HISTORY */
-;/* */
-;/* DATE NAME DESCRIPTION */
-;/* */
-;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */
-;/* 10-15-2021 William E. Lamie Modified comment(s), and */
-;/* removed unnecessary stack */
-;/* type placement, */
-;/* resulting in version 6.1.9 */
-;/* */
;/**************************************************************************/
public __tx_thread_context_restore
@@ -99,7 +89,7 @@ __tx_thread_context_restore:
MOV.L [R1], R2
SUB #1, R2
MOV.L R2,[R1]
- BEQ __tx_thread_not_nested_restore
+ BEQ __tx_thread_not_nested_restore
;
; /* Interrupts are nested. */
@@ -121,17 +111,17 @@ __tx_thread_not_nested_restore:
; else if (((_tx_thread_current_ptr) && (_tx_thread_current_ptr == _tx_thread_execute_ptr))
; || (_tx_thread_preempt_disable))
; {
-
+
MOV.L #__tx_thread_current_ptr, R1 ; Pickup current thread ptr address
MOV.L [R1], R2
CMP #0, R2
- BEQ __tx_thread_idle_system_restore
-
+ BEQ __tx_thread_idle_system_restore
+
MOV.L #__tx_thread_preempt_disable, R3 ; Pick up preempt disable flag
MOV.L [R3], R3
CMP #0, R3
BNE __tx_thread_no_preempt_restore ; If pre-empt disable flag set, we simply return to the original point of interrupt regardless
-
+
MOV.L #__tx_thread_execute_ptr, R3 ; (_tx_thread_current_ptr != _tx_thread_execute_ptr)
CMP [R3], R2
BNE __tx_thread_preempt_restore ; Jump to pre-empt restoring
@@ -172,7 +162,7 @@ __tx_thread_dont_save_ts:
SETPSW U ; User stack
PUSHM R6-R13
-
+
MVFACGU #0, A1, R4 ; Save accumulators.
MVFACHI #0, A1, R5
MVFACLO #0, A1, R6
@@ -181,7 +171,7 @@ __tx_thread_dont_save_ts:
MVFACHI #0, A0, R5
MVFACLO #0, A0, R6
PUSHM R4-R6
-
+
;
; /* Clear the current task pointer. */
; _tx_thread_current_ptr = TX_NULL;
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_thread_context_save.s b/ports_module/rxv2/iar/module_manager/src/tx_thread_context_save.s
index 0d461baa..4e7b8fc3 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_thread_context_save.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_thread_context_save.s
@@ -1,10 +1,10 @@
;/***************************************************************************
-; * Copyright (c) 2024 Microsoft Corporation
-; *
+; * Copyright (c) 2024 Microsoft Corporation
+; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
; * https://opensource.org/licenses/MIT.
-; *
+; *
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
@@ -65,14 +65,6 @@
;/* */
;/* ISRs */
;/* */
-;/* RELEASE HISTORY */
-;/* */
-;/* DATE NAME DESCRIPTION */
-;/* */
-;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */
-;/* 10-15-2021 William E. Lamie Modified comment(s), */
-;/* resulting in version 6.1.9 */
-;/* */
;/**************************************************************************/
;VOID _tx_thread_context_save(VOID)
;{
@@ -100,7 +92,7 @@ __tx_thread_context_save:
BEQ __tx_thread_not_nested_save
;
; /* Nested interrupt condition. */
-;
+;
ADD #1, r2 ; _tx_thread_system_state++
MOV.L r2, [r1]
@@ -126,7 +118,7 @@ __tx_thread_not_nested_save:
MOV.L #__tx_thread_current_ptr, R2 ; Pickup current thread pointer
MOV.L [R2], R2
- CMP #0,R2 ; Is it NULL?
+ CMP #0,R2 ; Is it NULL?
BEQ __tx_thread_idle_system_save ; Yes, idle system is running - idle restore
;
; /* Move stack frame over to the current threads stack. */
@@ -148,7 +140,7 @@ __tx_thread_not_nested_save:
MOV.L R14, [-R1] ; Save R14 on thread stack
MVFC FPSW, R3
MOV.L R3, [-R1] ; Save FPSW on thread stack
-
+
POP R2 ; Pick up return address from interrupt stack
ADD #16, R0, R0 ; Correct interrupt stack pointer back to the bottom
MVTC R1, USP ; Set user/thread stack pointer
@@ -167,5 +159,5 @@ __tx_thread_idle_system_save:
JMP R1 ; Return to caller
;
; }
-;}
+;}
END
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_thread_interrupt_control.s b/ports_module/rxv2/iar/module_manager/src/tx_thread_interrupt_control.s
index 558b9153..b2cb65e4 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_thread_interrupt_control.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_thread_interrupt_control.s
@@ -1,18 +1,18 @@
;/***************************************************************************
-; * Copyright (c) 2024 Microsoft Corporation
-; *
+; * Copyright (c) 2024 Microsoft Corporation
+; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
; * https://opensource.org/licenses/MIT.
-; *
+; *
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
;
;/**************************************************************************/
;/**************************************************************************/
-;/** */
-;/** ThreadX Component */
+;/** */
+;/** ThreadX Component */
;/** */
;/** Thread */
;/** */
@@ -59,14 +59,6 @@
;/* */
;/* Application Code */
;/* */
-;/* RELEASE HISTORY */
-;/* */
-;/* DATE NAME DESCRIPTION */
-;/* */
-;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */
-;/* 10-15-2021 William E. Lamie Modified comment(s), */
-;/* resulting in version 6.1.9 */
-;/* */
;/**************************************************************************/
;UINT _tx_thread_interrupt_control(UINT new_posture)
;{
@@ -75,20 +67,20 @@ __tx_thread_interrupt_control:
;
; /* Pickup current interrupt lockout posture. */
;
-
+
MVFC PSW, R2 ; Save PSW to R2
MOV.L R2, R3 ; Make a copy of PSW in r3
-
+
;
; /* Apply the new interrupt posture. */
;
-
+
BTST #16, R1 ; Test I bit of PSW of "new posture"
BMNE #16, R2 ; Conditionally set I bit of intermediate posture
-
+
MVTC R2, PSW ; Save intermediate posture to PSW
-
- MOV.L R3,R1 ; Get original SR
+
+ MOV.L R3,R1 ; Get original SR
RTS ; Return to caller
;}
END
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_thread_schedule.s b/ports_module/rxv2/iar/module_manager/src/tx_thread_schedule.s
index fb60efaa..572eff32 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_thread_schedule.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_thread_schedule.s
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -62,17 +63,6 @@
/* _tx_initialize_kernel_enter ThreadX entry function */
/* _tx_thread_system_return Return to system from thread */
/* _tx_thread_context_restore Restore thread's context */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */
-/* 10-15-2021 William E. Lamie Modified comment(s), and */
-/* removed unnecessary stack */
-/* type checking, */
-/* resulting in version 6.1.9 */
-/* */
/**************************************************************************/
// VOID _tx_thread_schedule(VOID)
// {
@@ -134,40 +124,40 @@ __tx_thread_schedule_loop:
MOV.L 156[R2],R1 // Pickup user_mode
CMP #0,R1 // Is protection required for this thread?
BEQ skip_mpu_setup // No, skip MPU setup
-
+
MOV.L #0x00086408,R1 // Region 1 Start Page Register address
MOV.L 144[R2],R2 // Address of module instance ptr at offset 144 in TCB
ADD #100,R2,R2 // Get address of MPU table in module struct, starting at region 1
-
+
// Region 0 (Trampoline from User mode to ThreadX) set up in txm_module_manager_setup_mpu_registers.c
-
+
// Build region 1 (User code)
MOV.L [R2+],R4 // Pickup region 1 start page, increment to region 1 end page
MOV.L R4,[R1+] // Setup region 1 start page reg, increment to region 1 end page reg.
MOV.L [R2+],R4 // Pickup region 1 end page, increment to region 2 start page
MOV.L R4,[R1+] // Setup region 1 end page reg, increment to region 2 start page reg.
-
+
// Build region 2 (User data)
MOV.L [R2+],R4 // Pickup region 2 start page, increment to region 2 end page
MOV.L R4,[R1+] // Setup region 2 start page reg, increment to region 2 end page reg.
MOV.L [R2+],R4 // Pickup region 2 end page, increment to region 3 start page
MOV.L R4,[R1+] // Setup region 2 end page reg, increment to region 3 start page reg.
-
+
// Build region 3 (Shared memory)
MOV.L [R2+],R4 // Pickup region 3 start page, increment to region 3 end page
MOV.L R4,[R1+] // Setup region 3 start page reg, increment to region 3 end page reg.
MOV.L [R2+],R4 // Pickup region 3 end page, increment to region 4 start page
MOV.L R4,[R1+] // Setup region 3 end page reg, increment to region 4 start page reg.
-
+
// Region 4-7 unused
-
+
// Setup background region
MOV.L #0x00086504,R1 // Pickup MPBAC
MOV #0,[R1] // Read/Write/Execute prohibited.
// Enable MPU
MOV.L #0x00086500,R1 // Pickup MPEN
MOV #1,[R1] // Enable MPU
-
+
skip_mpu_setup
POPM R1-R3 // Restore accumulators.
@@ -180,7 +170,7 @@ skip_mpu_setup
MVTACGU R1, A1
POPM R6-R13 // Recover interrupt stack frame
- POPC FPSW
+ POPC FPSW
POPM R14-R15
POPM R3-R5
POPM R1-R2
@@ -195,7 +185,7 @@ skip_mpu_setup
The priority of this interrupt is set to the lowest priority within
tx_initialize_low_level() and triggered by ThreadX when calling
_tx_thread_system_return(). */
-
+
public ___interrupt_27
___interrupt_27:
@@ -206,7 +196,7 @@ ___interrupt_27:
BRA __tx_thread_context_restore
-/* You may have to modify BSP to use this handler.
+/* You may have to modify BSP to use this handler.
// MPU Memory access violation
PUBLIC ___excep_access_inst
PUBLIC ___violation_handler
@@ -260,15 +250,15 @@ ___violation_handler
MOV.L R3, 32[R1] // Save R1
POP R3 // Recall R2
MOV.L R3, 36[R1] // Save R2
-
+
BSR __txm_module_manager_memory_fault_handler // Call memory manager fault handler
-
+
// Decrement and save system state
MOV.L #__tx_thread_system_state, R1 // Pickup address of system state
MOV.L [R1], R2 // Pickup system state
SUB #1, R2 // Decrement
MOV.L R2, [R1] // Store new system state
-
+
MOV.L #__tx_thread_current_ptr, R2 // Pickup address of current thread pointer
MOV.L #0, [R2] // Clear current thread pointer
BRA __tx_thread_schedule // Attempt to schedule the next thread
@@ -284,15 +274,15 @@ __txm_module_manager_kernel
CMP #__txm_module_manager_user_mode_entry+3, R5 // Did we come from user_mode_entry?
BEQ __txm_module_manager_entry // If so, continue.
RTE // If not, then return from where we came.
-
+
__txm_module_manager_entry
// We are entering the kernel from a module thread with user mode selected.
- // At this point, we are out of user mode!
+ // At this point, we are out of user mode!
// Clear current user mode.
MOV.L #__tx_thread_current_ptr, R5
MOV [R5],R5
MOV #0,152[R5]
-
+
// Switch to kernel stack
PUSHM R1-R2
MVFC USP, R1 // Pickup module thread stack pointer
@@ -312,7 +302,7 @@ __txm_module_manager_entry
MOV.L 4[SP], R5
BCLR #20, R5
MOV.L R5, 4[SP]
-
+
// Return to user_mode_entry where kernel_dispatch will be called.
RTE
@@ -324,12 +314,12 @@ __txm_module_manager_entry
__txm_module_manager_user_mode_entry
INT #26 // Enter ThreadX kernel (exit User mode).
-
+
// At this point, we are out of user mode.
// Simply call the kernel dispatch function.
MOV.L #__txm_module_manager_kernel_dispatch,R5
JSR R5
-
+
// Restore user mode while inside of ThreadX.
MOV.L #__tx_thread_current_ptr, R5
MOV [R5],R5
@@ -348,7 +338,7 @@ __txm_module_manager_user_mode_entry
#endif
MOV.L 172[R5], R5 // Pickup module thread stack pointer
MVTC R5, USP // Set stack pointer
-
+
// USP is set for an RTS, need to set for RTE to set User mode in PSW.
// Push return address on SP
@@ -359,21 +349,21 @@ __txm_module_manager_user_mode_entry
BSET #20,R5
MOV.L R5,4[SP]
RTE
-
+
// Fill rest of page with NOPs.
NOP
NOP
NOP
NOP
-
+
NOP
NOP
NOP
NOP
-
+
NOP
NOP
NOP
NOP
-
+
END
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_thread_stack_build.s b/ports_module/rxv2/iar/module_manager/src/tx_thread_stack_build.s
index be33d407..1d8f4593 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_thread_stack_build.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_thread_stack_build.s
@@ -1,10 +1,10 @@
;/***************************************************************************
-; * Copyright (c) 2024 Microsoft Corporation
-; *
+; * Copyright (c) 2024 Microsoft Corporation
+; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
; * https://opensource.org/licenses/MIT.
-; *
+; *
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
@@ -55,26 +55,14 @@
;/* */
;/* _tx_thread_create Create thread service */
;/* */
-;/* RELEASE HISTORY */
-;/* */
-;/* DATE NAME DESCRIPTION */
-;/* */
-;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */
-;/* 10-15-2021 William E. Lamie Modified comment(s), and */
-;/* removed unnecessary stack */
-;/* type placement, */
-;/* resulting in version 6.1.9 */
-;/* 01-31-2022 William E. Lamie Modified comment(s), */
-;/* resulting in version 6.1.10 */
-;/* */
;/**************************************************************************/
public __tx_thread_stack_build
__tx_thread_stack_build:
;
-;
+;
; /* Build an interrupt frame. The form of the fake interrupt stack
; on the Renesas RX should look like the following after it is built:
-;
+;
; Stack Top: ACC0
; ACC1
; R6
@@ -137,11 +125,11 @@ __tx_thread_stack_build:
MOV.L R4,[-R3]
; /* Setup stack pointer. */
-; thread_ptr -> tx_thread_stack_ptr = R1;
+; thread_ptr -> tx_thread_stack_ptr = R1;
MOV.L R3, 8[R1]
; Store initial SP in thread control block
RTS
-
+
;}
END
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_thread_system_return.s b/ports_module/rxv2/iar/module_manager/src/tx_thread_system_return.s
index 714e1276..2c2021f6 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_thread_system_return.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_thread_system_return.s
@@ -1,10 +1,10 @@
;/***************************************************************************
-; * Copyright (c) 2024 Microsoft Corporation
-; *
+; * Copyright (c) 2024 Microsoft Corporation
+; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
; * https://opensource.org/licenses/MIT.
-; *
+; *
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
@@ -20,7 +20,7 @@
;/**************************************************************************/
section .text:CODE:ROOT
-
+
;/**************************************************************************/
;/* */
;/* FUNCTION RELEASE */
@@ -54,14 +54,6 @@
;/* */
;/* ThreadX components */
;/* */
-;/* RELEASE HISTORY */
-;/* */
-;/* DATE NAME DESCRIPTION */
-;/* */
-;/* 12-31-2020 William E. Lamie Initial Version 6.1.3 */
-;/* 10-15-2021 William E. Lamie Modified comment(s), */
-;/* resulting in version 6.1.9 */
-;/* */
;/**************************************************************************/
public __tx_thread_system_return
diff --git a/ports_module/rxv2/iar/module_manager/src/tx_timer_interrupt.s b/ports_module/rxv2/iar/module_manager/src/tx_timer_interrupt.s
index 1b736519..cb79535a 100644
--- a/ports_module/rxv2/iar/module_manager/src/tx_timer_interrupt.s
+++ b/ports_module/rxv2/iar/module_manager/src/tx_timer_interrupt.s
@@ -1,10 +1,10 @@
;/***************************************************************************
-; * Copyright (c) 2024 Microsoft Corporation
-; *
+; * Copyright (c) 2024 Microsoft Corporation
+; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
; * https://opensource.org/licenses/MIT.
-; *
+; *
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
@@ -73,18 +73,6 @@ SWI0 EQU 0x872E0
;/* */
;/* interrupt vector */
;/* */
-;/* RELEASE HISTORY */
-;/* */
-;/* DATE NAME DESCRIPTION */
-;/* */
-;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */
-;/* 10-15-2021 William E. Lamie Modified comment(s), */
-;/* resulting in version 6.1.9 */
-;/* 01-31-2022 William E. Lamie Modified comment(s), and */
-;/* added missing thread */
-;/* preemption logic, */
-;/* resulting in version 6.1.10 */
-;/* */
;/**************************************************************************/
public __tx_timer_interrupt
@@ -147,14 +135,14 @@ __tx_timer_no_time_slice:
MOV.L [R2+], R1 ; Pickup timer list entry, _tx_timer_current_ptr++
CMP #0, R1 ; Is timer pointer NULL?
BEQ __tx_timer_no_timer ; Yes, no timer has expired
-
+
;
; /* Set expiration flag. */
; _tx_timer_expired = TX_TRUE;
;
MOV.L #__tx_timer_expired,R2 ; Build address of expired flag
MOV.L #1, R1 ; Build expired value
- MOV.L R1, [R2]
+ MOV.L R1, [R2]
BRA __tx_timer_done ; Finished with timer processing
;
; }
@@ -165,7 +153,7 @@ __tx_timer_no_timer:
; /* No timer expired, increment the timer pointer. */
; _tx_timer_current_ptr++;
;
-; /* R2 already contains __tx_timer_current_ptr++ */
+; /* R2 already contains __tx_timer_current_ptr++ */
;
; /* Check for wrap-around. */
; if (_tx_timer_current_ptr == _tx_timer_list_end)
@@ -184,9 +172,9 @@ __tx_timer_no_timer:
; }
;
__tx_timer_skip_wrap:
- MOV.L #__tx_timer_current_ptr,R1
+ MOV.L #__tx_timer_current_ptr,R1
MOV.L R2, [R1] ; Store in updated pointer in _tx_timer_current_ptr
-
+
__tx_timer_done:
;
; /* See if anything has expired. */
@@ -220,14 +208,14 @@ __tx_timer_dont_activate:
; /* Did time slice expire? */
; if (_tx_timer_expired_time_slice)
; {
-;
+;
MOV.L #__tx_timer_expired_time_slice, R1 ; Pickup time-slice expired flag addr
MOV.L [R1], R1 ; Pickup actual flag
CMP #0,R1 ; Has time-slice expired?
BEQ __tx_timer_not_ts_expiration ; No, skip time-slice expiration
;
; /* Time slice interrupted thread. */
-; _tx_thread_time_slice();
+; _tx_thread_time_slice();
BSR __tx_thread_time_slice ; Call time-slice processing
diff --git a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_alignment_adjust.c b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_alignment_adjust.c
index a12e5386..c14c1715 100644
--- a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_alignment_adjust.c
+++ b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_alignment_adjust.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -60,12 +61,6 @@
/* */
/* Initial thread stack frame */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 10-15-2021 Scott Larson Initial Version 6.1.9 */
-/* */
/**************************************************************************/
VOID _txm_module_manager_alignment_adjust(TXM_MODULE_PREAMBLE *module_preamble,
ULONG *code_size,
diff --git a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_external_memory_enable.c b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_external_memory_enable.c
index 25d1ea2b..f407249a 100644
--- a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_external_memory_enable.c
+++ b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_external_memory_enable.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -64,12 +65,6 @@
/* */
/* Application code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 10-15-2021 Scott Larson Initial Version 6.1.9 */
-/* */
/**************************************************************************/
UINT _txm_module_manager_external_memory_enable(TXM_MODULE_INSTANCE *module_instance,
VOID *start_address,
@@ -106,7 +101,7 @@ TXM_MODULE_PREAMBLE *module_preamble;
/* Invalid module pointer. */
return(TX_PTR_ERROR);
}
-
+
/* Determine if the module instance is in the loaded state. */
if (module_instance -> txm_module_instance_state != TXM_MODULE_LOADED)
{
@@ -116,7 +111,7 @@ TXM_MODULE_PREAMBLE *module_preamble;
/* Return error if the module is not ready. */
return(TX_START_ERROR);
}
-
+
/* Check if preamble ext/shared mem property bit set. */
module_preamble = module_instance -> txm_module_instance_preamble_ptr;
if(!(module_preamble -> txm_module_preamble_property_flags & TXM_MODULE_SHARED_EXTERNAL_MEMORY_ACCESS))
@@ -127,24 +122,24 @@ TXM_MODULE_PREAMBLE *module_preamble;
/* Return error if bit not set. */
return(TXM_MODULE_INVALID_PROPERTIES);
}
-
+
/* Start address must be 16-byte aligned. */
address = (ULONG) start_address;
if(address != (address & 0xFFFFFFF0))
{
/* Release the protection mutex. */
_tx_mutex_put(&_txm_module_manager_mutex);
-
+
/* Return alignment error. */
return(TXM_MODULE_ALIGNMENT_ERROR);
}
-
+
/* Check length. */
-
+
/* At this point, we have a valid address and length. */
/* Build region start page register. */
module_instance -> txm_module_instance_mpu_registers[TXM_MODULE_MANAGER_SHARED_MPU_INDEX] = address & 0xFFFFFFF0;
-
+
/* Check for valid attributes. */
if(attributes & TXM_MODULE_MANAGER_SHARED_ATTRIBUTE_EXECUTE)
{
@@ -158,17 +153,17 @@ TXM_MODULE_PREAMBLE *module_preamble;
{
attributes_check |= TXM_MODULE_MANAGER_ATTRIBUTE_READ_MPU_BIT;
}
-
+
/* Build region end page register with attributes, OR in the Valid bit. */
module_instance -> txm_module_instance_mpu_registers[TXM_MODULE_MANAGER_SHARED_MPU_INDEX+1] = ((address + length - 1) & 0xFFFFFFF0) | attributes_check | 0x01;
-
+
/* Save address and length in module. */
module_instance -> txm_module_instance_shared_memory_address = address;
module_instance -> txm_module_instance_shared_memory_length = length;
-
+
/* Release the protection mutex. */
_tx_mutex_put(&_txm_module_manager_mutex);
-
+
/* Return success. */
return(TX_SUCCESS);
}
diff --git a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_handler.c b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_handler.c
index 4cc5159e..0ff6baf2 100644
--- a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_handler.c
+++ b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_handler.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -71,12 +72,6 @@ TXM_MODULE_MANAGER_FAULT_INFO
/* */
/* Fault handler */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 10-15-2021 Scott Larson Initial Version 6.1.9 */
-/* */
/**************************************************************************/
VOID _txm_module_manager_memory_fault_handler(VOID)
{
@@ -89,7 +84,7 @@ TX_THREAD *thread_ptr;
/* Initialize the module instance pointer to NULL. */
module_instance_ptr = TX_NULL;
-
+
/* Is there a thread? */
if (thread_ptr)
{
@@ -99,7 +94,7 @@ TX_THREAD *thread_ptr;
/* Terminate the current thread. */
_tx_thread_terminate(_tx_thread_current_ptr);
}
-
+
/* Determine if there is a user memory fault notification callback. */
if (_txm_module_manager_fault_notify)
{
diff --git a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_notify.c b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_notify.c
index 405c049f..7fe88dfe 100644
--- a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_notify.c
+++ b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_memory_fault_notify.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -66,18 +67,12 @@ extern VOID (*_txm_module_manager_fault_notify)(TX_THREAD *, TXM_MODULE_INSTA
/* */
/* Application Code */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 10-15-2021 Scott Larson Initial Version 6.1.9 */
-/* */
/**************************************************************************/
UINT _txm_module_manager_memory_fault_notify(VOID (*notify_function)(TX_THREAD *, TXM_MODULE_INSTANCE *))
{
/* Setup notification function. */
_txm_module_manager_fault_notify = notify_function;
-
+
/* Return success. */
return(TX_SUCCESS);
}
diff --git a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_setup_mpu_registers.c b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_setup_mpu_registers.c
index 9175331b..183f38ae 100644
--- a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_setup_mpu_registers.c
+++ b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_setup_mpu_registers.c
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -55,12 +56,6 @@
/* */
/* _txm_module_manager_thread_create */
/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 10-15-2021 Scott Larson Initial Version 6.1.9 */
-/* */
/**************************************************************************/
VOID _txm_module_manager_setup_mpu_registers(TXM_MODULE_INSTANCE *module_instance)
{
@@ -73,34 +68,34 @@ ULONG region_end_page_register;
region_start_page_register = (ULONG) _txm_module_manager_user_mode_entry;
region_start_page_register = region_start_page_register & 0xFFFFFFF0;
module_instance -> txm_module_instance_mpu_registers[0] = region_start_page_register;
- /* Region 0 End page is 2 pages away (for a total of 3 pages).
+ /* Region 0 End page is 2 pages away (for a total of 3 pages).
* Set reading permitted, writing prohibited, execution permitted, enable region. */
module_instance -> txm_module_instance_mpu_registers[1] = (region_start_page_register + 0x20) | 0x0B;
-
+
/* Place the trampoline protection in the MPU registers */
RSPAGE0 = module_instance -> txm_module_instance_mpu_registers[0];
REPAGE0 = module_instance -> txm_module_instance_mpu_registers[1];
-
+
/* Setup region 1 for code area. */
/* Set reading permitted, writing prohibited, execution permitted, enable region. */
- region_start_page_register = (ULONG) module_instance -> txm_module_instance_code_start;
+ region_start_page_register = (ULONG) module_instance -> txm_module_instance_code_start;
region_size = (ULONG) module_instance -> txm_module_instance_code_size;
-
+
region_end_page_register = (region_start_page_register + region_size - 1) & 0xFFFFFFF0;
region_start_page_register = region_start_page_register & 0xFFFFFFF0;
-
+
module_instance -> txm_module_instance_mpu_registers[2] = region_start_page_register;
module_instance -> txm_module_instance_mpu_registers[3] = region_end_page_register | 0x0B;
-
+
/* Setup region 2 for data area. */
/* Set reading permitted, writing permitted, execution prohibited, enable region. */
- region_start_page_register = (ULONG) module_instance -> txm_module_instance_data_start;
+ region_start_page_register = (ULONG) module_instance -> txm_module_instance_data_start;
region_size = (ULONG) module_instance -> txm_module_instance_data_size;
-
+
region_end_page_register = (region_start_page_register + region_size - 1) & 0xFFFFFFF0;
region_start_page_register = region_start_page_register & 0xFFFFFFF0;
-
+
module_instance -> txm_module_instance_mpu_registers[4] = region_start_page_register;
module_instance -> txm_module_instance_mpu_registers[5] = region_end_page_register | 0x0D;
-
+
}
diff --git a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_thread_stack_build.s b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_thread_stack_build.s
index 9cf9fa14..fa5bf71d 100644
--- a/ports_module/rxv2/iar/module_manager/src/txm_module_manager_thread_stack_build.s
+++ b/ports_module/rxv2/iar/module_manager/src/txm_module_manager_thread_stack_build.s
@@ -1,10 +1,11 @@
/***************************************************************************
- * Copyright (c) 2024 Microsoft Corporation
- *
+ * 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
* https://opensource.org/licenses/MIT.
- *
+ *
* SPDX-License-Identifier: MIT
**************************************************************************/
@@ -53,13 +54,6 @@
/* CALLED BY */
/* */
/* _tx_thread_create Create thread service */
-/* */
-/* RELEASE HISTORY */
-/* */
-/* DATE NAME DESCRIPTION */
-/* */
-/* 01-31-2022 Scott Larson Initial Version 6.1.10 */
-/* */
/**************************************************************************/
// VOID _txm_module_manager_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(TX_THREAD *, TXM_MODULE_INSTANCE *))
// {
@@ -68,7 +62,7 @@ __txm_module_manager_thread_stack_build:
/* Build an interrupt frame. The form of the fake interrupt stack
on the Renesas RX should look like the following after it is built:
-
+
Stack Top: 1 Interrupt stack frame type
ACC0
ACC1
@@ -103,9 +97,9 @@ __txm_module_manager_thread_stack_build:
BMC #20,R4 // if user mode, set mode bit of initial PSW
MOV.L R4, [-R3] // initial PSW
MOV.L R2, [-R3] // initial PC
-
+
MOV.L 8[R1], R4 // Pickup thread entry info pointer, which is in the stack pointer position of the thread control block.
- // It was setup in the txm_module_manager_thread_create function. It will be overwritten later in this
+ // It was setup in the txm_module_manager_thread_create function. It will be overwritten later in this
// function with the actual, initial stack pointer.
MOV.L R4,[-R3] // initial R2, which is the module entry information.
MOV.L R1,[-R3] // initial R1, which is the thread control block.