You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Supported new feature Interrupt Stack Management for U2x Port. (#28)
* Add new port layer for CCRH U2x and GHS U2x
* Updated U2x port to support U2Cx devices.
* Due to internal constraint, we need to postpone the upstream. We will resume once it will be ready.
* Update RH850 U2x resource references.
* Due to internal constraint, we need to postpone the upstream. We will resume once it will be ready.
* Update RH850 U2x resource references.
* Updated U2x port to support U2Cx devices.
* Due to internal constraint, we need to postpone the upstream. We will resume once it will be ready.
* Update RH850 U2x resource references
* Update RH850 U2x resource references
* updated U2x FreeRTOS port to support Stack Interrupt Management.
* updated U2x FreeRTOS port to support Stack Interrupt Management.
* 1. Supported new feature Interrupt Stack Management.
2. Improved the usage of FXU/FPU.
3. Improved the content in README.md.
---------
Co-authored-by: Duc Dat Le <duc.le.xm@renesas.com>
Co-authored-by: vung.tran.zg <vung.tran.zg@renesas.com>
@@ -18,26 +18,120 @@ This repository contains the port of FreeRTOS for Renesas RH850/U2x microcontrol
18
18
19
19
## Link to Test Project
20
20
21
-
The test project can be found in [RH850_U2Ax_CCRH](https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos/tree/main/RH850_U2Ax_CCRH) and [RH850_U2Bx_CCRH](https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos/tree/main/RH850_U2Bx_CCRH). These projects contain example tasks and configurations to help you get started with FreeRTOS on the RH850/U2Ax and U2Bx.
21
+
The test project can be found in [RH850_U2Ax_CCRH](https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos/tree/main/RH850_U2Ax_CCRH) and [RH850_U2Bx_CCRH](https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos/tree/main/RH850_U2Bx_CCRH). These projects contain example tasks and configurations to help you get started with FreeRTOS on the RH850/U2Ax and RH850/U2Bx.
22
+
23
+
## Setup for Vector Table
24
+
1. Allocate the Stack area in Linker Script:<br />
25
+
- In the Linker configuration, create a dedicated Stack (memory region) for the Vector Table of each Processing Element (PE).
26
+
27
+
For example, in **Section Settings**, add:<br />
28
+
| Address | Section |
29
+
|------------|---------------------|
30
+
| 0x00040000 | .inttable_PE0.const |
31
+
| 0x00041000 | .inttable_PE1.const |
32
+
| 0x00042000 | .inttable_PE2.const |
33
+
34
+

35
+
36
+
2. Declare the Vector Table in the source code:<br />
37
+
- In the application source code, define the Vector Table.<br />
38
+
- Map this Vector Table to the Stack region that was created in the Linker Script.
#endif /* End of #if (configNUMBER_OF_CORES > 1) */
72
+
73
+
#pragma section default
74
+
</pre>
75
+
76
+
3. Assign the Vector Table into the INTBP register in Startup:<br />
77
+
- In System Startup, assign the Vector Table address into the INTBP register so that the Processor knows where to fetch Interrupt Vectors.
78
+
79
+
For example, in **Startup** file, add:<br />
80
+
<pre>
81
+
$ifdef PE1_USED
82
+
__PE1:
83
+
; Initialization of the interrupt base pointer.
84
+
.extern _g_vector_table_PE1
85
+
mov #_g_vector_table_PE1, r10
86
+
ldsr r10, 4, 1 ; INTBP
87
+
88
+
mov #_PE1_stacktop, sp ; Set sp register.
89
+
mov #__sex_entry_PE1, r10 ; First set EBASE register address.
90
+
jr32 __DONE
91
+
$endif
92
+
93
+
$ifdef PE2_USED
94
+
__PE2:
95
+
; Initialization of the interrupt base pointer.
96
+
.extern _g_vector_table_PE2
97
+
mov #_g_vector_table_PE2, r10
98
+
ldsr r10, 4, 1 ; INTBP
99
+
100
+
mov #_PE2_stacktop, sp ; Set sp register.
101
+
mov #__sex_entry_PE2, r10 ; First set EBASE register address.
102
+
jr32 __DONE
103
+
$endif
104
+
</pre>
105
+
106
+
4. Interrupt Vector Configuration:<br />
107
+
- Interrupt handling must be configured using the Direct Vector method, e.g. by configuring EBASE or EICn registers.
108
+
109
+
## FPU and FXU Units Usage
110
+
- The `FXU Unit` is available only on RH850 U2Bx devices.<br />
111
+
To ensure correct operation, any task requiring FXU must run on an FXU-enabled core. In SMP systems, the core assignment shall be fixed using CPU affinity via the `vTaskCoreAffinitySet()` function.
112
+
113
+
- By default, the FPU and FXU operations are enabled, which may introduce redundant code and impact performance.<br />
114
+
If they are not required by the application, FPU and FXU related code can be disabled by defining the macros `configDISABLE_FPU` and `configDISABLE_FXU` respectively.<br />
115
+
Additionally, `-DconfigDISABLE_FPU` and `-DconfigDISABLE_FXU` should be added to the compiler option.
116
+
117
+
For example, in **Property** of CC-RH (Build Tool):<br />
118
+

22
119
23
120
## Note
24
-
1. The minimal stack size (configMINIMAL_STACK_SIZE) must be included the reserved memory for nested interrupt. This formula can be referred: `(task_context_size) * (2 + configMAX_INT_NESTING) + Stack_depth_of_taskcode`
25
-
In which, `task_context_size` is calculated as `36*4bytes = 144bytes` (when FPU enabled) or `34*4bytes = 136` (when FPU disabled), configMAX_INT_NESTING is `02` as default (Note that a value of `0` is not allowed).
121
+
1. Refer this formula to estimate the minimal stack size (configMINIMAL_STACK_SIZE) used: `[(task_context_size) * 2] + stack_required_for_taskcode`.<br />
122
+
In which, `task_context_size` is calculated as `36 * 4 bytes = 144 bytes`.
123
+
26
124
2. Users need to create a memory section named `mev_address` in `CRAM` for Exclusive Control functionality. Users should initialize the `mev_address` section in the startup file.
27
125
28
-
Example:
29
-
```
30
-
; .mev_address section in CRAM is used for Sync flags
31
-
mov #__s.mev_address.bss, r20
32
-
st.w r0, 0[r20]
33
-
```
34
-
3. The `FXU unit` is only available on `core 0`. Users must ensure that FXU operations are restricted to `core 0` by using the `vTaskCoreAffinitySet` function provided by FreeRTOS SMP.
35
-
4. FXU can be enabled by specific compiler option `-DconfigENABLE_FXU`. FPU can be enabled by specific compiler option `-DconfigENABLE_FPU`
36
-
5. The macros `configENABLE_FXU` and `configENABLE_FPU` must be defined in `FreeRTOSConfig.h`.
37
-
6. This port supports U2Ax and U2Bx devices. The user must configure `configDEVICE_NAME` with the value `U2Bx_DEVICES` or `U2Ax_DEVICES` to specify which device is being used.
38
-
7. The User can configure the interrupt priority of the OSTM Timer using `configTIMER_INT_PRIORITY`, with 16 levels available (0 being the highest priority and 15 the lowest).
39
-
8. This port also supports the configuration of contiguous CPU cores in FreeRTOS, allowing the user to set task affinity for execution on specific cores or subsets of cores.
126
+
For example:<br />
127
+
<pre>
128
+
; .mev_address section in CRAM is used for Sync flags
129
+
mov #__s.mev_address.bss, r20
130
+
st.w r0, 0[r20]</pre>
131
+
132
+
3. This port supports both U2Ax and U2Bx devices. The User must configure `configDEVICE_NAME` with the value `U2Bx_DEVICES` or `U2Ax_DEVICES` to specify which device is being used.
40
133
134
+
4. This port also supports the configuration of contiguous CPU cores in FreeRTOS SMP, allowing the User to set task affinity for execution on specific cores or subsets of cores.
41
135
42
136
## Other Relevant Information
43
137
@@ -52,4 +146,4 @@ Example:
52
146
- If you encounter any issues or have questions about this port, please open an issue in this repository or contact the maintainer.
53
147
54
148
-**Contributing:**
55
-
- Contributions to improve this port are welcome. Please fork the repository, make your changes, and submit a pull request.
149
+
- Contributions to improve this port are welcome. Please fork the repository, make your changes, and submit a pull request.
0 commit comments