Skip to content

Commit f159894

Browse files
authored
Merge pull request #5 from NoMaY-jp/RXTB-RTOSDemo
Update Renesas RX100 and RX600v2 port layer for Renesas TB-RX130/RX231/RX65N RTOS Demo
2 parents 1431b65 + 60a6f91 commit f159894

File tree

23 files changed

+3307
-306
lines changed

23 files changed

+3307
-306
lines changed

portable/GCC/RX/port.c

Lines changed: 758 additions & 0 deletions
Large diffs are not rendered by default.

portable/GCC/RX/portmacro.h

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
/*
2+
* FreeRTOS Kernel V10.4.1
3+
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* https://www.FreeRTOS.org
23+
* https://github.com/FreeRTOS
24+
*
25+
*/
26+
27+
#ifndef PORTMACRO_H
28+
#define PORTMACRO_H
29+
30+
/* *INDENT-OFF* */
31+
#ifdef __cplusplus
32+
extern "C" {
33+
#endif
34+
/* *INDENT-ON* */
35+
36+
/*-----------------------------------------------------------
37+
* Port specific definitions.
38+
*
39+
* The settings in this file configure FreeRTOS correctly for the
40+
* given hardware and compiler.
41+
*
42+
* These settings should not be altered.
43+
*-----------------------------------------------------------
44+
*/
45+
46+
/* If configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H is set to 0 then iodefine.h
47+
* is included and used in FreeRTOS Kernel's Renesas RX port. If the macro is set
48+
* to 1 then platform.h is included and used in the port. If the macro is set to 2
49+
* then neither iodefine.h nor platform.h are included. If the macro is undefined,
50+
* it is set to 0 (CC-RX/GNURX) or 2 (ICCRX) internally for backward compatibility.
51+
* When the FIT configurator or the Smart Configurator is used, platform.h has to be
52+
* used. */
53+
#ifndef configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H
54+
#define configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H 0
55+
#endif
56+
57+
/* If configUSE_TASK_DPFPU_SUPPORT is set to 1 (or undefined) then each task will
58+
* be created without a DPFPU context, and a task must call vTaskUsesDPFPU() before
59+
* making use of any DPFPU registers. If configUSE_TASK_DPFPU_SUPPORT is set to 2 then
60+
* tasks are created with a DPFPU context by default, and calling vTaskUsesDPFPU() has
61+
* no effect. If configUSE_TASK_DPFPU_SUPPORT is set to 0 then tasks never take care
62+
* of any DPFPU context (even if DPFPU registers are used). */
63+
#ifdef __RX_DFPU_INSNS__
64+
/* The compiler may use DPFPU registers. */
65+
#ifndef configUSE_TASK_DPFPU_SUPPORT
66+
#define configUSE_TASK_DPFPU_SUPPORT 1
67+
#endif
68+
#else
69+
/* The compiler does not use DPFPU registers. */
70+
#ifdef configUSE_TASK_DPFPU_SUPPORT
71+
#undef configUSE_TASK_DPFPU_SUPPORT
72+
#endif
73+
#define configUSE_TASK_DPFPU_SUPPORT 0
74+
#endif
75+
#define portUSE_TASK_DPFPU_SUPPORT configUSE_TASK_DPFPU_SUPPORT
76+
77+
#ifdef __RX_FPU_INSNS__
78+
/* The compiler may use FPSW register. */
79+
#define portUSE_TASK_FPU_SUPPORT 1
80+
#else
81+
/* The compiler does not use FPSW register. */
82+
#define portUSE_TASK_FPU_SUPPORT 0
83+
#endif
84+
85+
#ifdef __RXv1__
86+
/* The CPU has only one accumulator. */
87+
#define portUSE_TASK_ACC_SUPPORT 1
88+
#elif !defined( __RXv2__ ) && !defined( __RXv3__ ) && ( __GNUC__ < 8 )
89+
/* The CPU is RXv1 and has only one accumulator. */
90+
#define portUSE_TASK_ACC_SUPPORT 1
91+
#else
92+
/* The CPU has two accumulators. */
93+
#define portUSE_TASK_ACC_SUPPORT 2
94+
#endif
95+
96+
/*-----------------------------------------------------------*/
97+
98+
/* Type definitions - these are a bit legacy and not really used now, other than
99+
* portSTACK_TYPE and portBASE_TYPE. */
100+
#define portCHAR char
101+
#define portFLOAT float
102+
#define portDOUBLE double
103+
#define portLONG long
104+
#define portSHORT short
105+
#define portSTACK_TYPE uint32_t
106+
#define portBASE_TYPE long
107+
108+
typedef portSTACK_TYPE StackType_t;
109+
typedef long BaseType_t;
110+
typedef unsigned long UBaseType_t;
111+
112+
#if ( configUSE_16_BIT_TICKS == 1 )
113+
typedef uint16_t TickType_t;
114+
#define portMAX_DELAY ( TickType_t ) 0xffff
115+
#else
116+
typedef uint32_t TickType_t;
117+
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
118+
119+
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
120+
* not need to be guarded with a critical section. */
121+
#define portTICK_TYPE_IS_ATOMIC 1
122+
#endif
123+
124+
/*-----------------------------------------------------------*/
125+
126+
/* Inline assembler specifics. */
127+
#if ( defined( __STDC_VERSION__ ) && ( __STDC_VERSION__ >= 199901L ) )
128+
/* *INDENT-OFF* */
129+
#define _portASM( ... ) __asm volatile ( #__VA_ARGS__ "\n" );
130+
#define portASM( ... ) _portASM( __VA_ARGS__ )
131+
#define portASM_LAB_NEXT( name ) ?+
132+
#define portASM_LAB_PREV( name ) ?-
133+
#define portASM_LAB( name_colon ) _portASM( ?: )
134+
#define portASM_BEGIN
135+
#define portASM_END
136+
/* *INDENT-ON* */
137+
#endif /* if ( defined( __STDC_VERSION__ ) && ( __STDC_VERSION__ >= 199901L ) ) */
138+
139+
/* Workaround to reduce errors/warnings caused by e2 studio CDT's INDEXER and CODAN. */
140+
#ifdef __CDT_PARSER__
141+
#ifndef __asm
142+
#define __asm asm
143+
#endif
144+
#ifndef __attribute__
145+
#define __attribute__( ... )
146+
#endif
147+
#endif
148+
149+
/*-----------------------------------------------------------*/
150+
151+
/* Hardware specifics. */
152+
#define portBYTE_ALIGNMENT 8 /* Could make four, according to manual. */
153+
#define portSTACK_GROWTH -1
154+
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
155+
#define portNOP() __asm volatile ( "NOP" )
156+
157+
/* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) ( *portITU_SWINTR == XXX );"
158+
* where portITU_SWINTR is the location of the software interrupt register
159+
* (0x000872E0) and XXX is an arbitrary number. Don't rely on the assembler to
160+
* select a register, so instead save and restore clobbered registers manually. */
161+
/* *INDENT-OFF* */
162+
#define portYIELD() \
163+
__asm volatile \
164+
( \
165+
"PUSH.L R10 \n"\
166+
"MOV.L #0x872E0, R10 \n"\
167+
"MOV.B #0x1, [ R10 ] \n"\
168+
"CMP [ R10 ].UB, R10 \n"\
169+
"POP R10 "\
170+
:::"cc" \
171+
)
172+
/* *INDENT-ON* */
173+
174+
#define portYIELD_FROM_ISR( x ) if( ( x ) != pdFALSE ) portYIELD()
175+
176+
/* These macros should not be called directly, but through the
177+
* taskENTER_CRITICAL() and taskEXIT_CRITICAL() macros. An extra check is
178+
* performed if configASSERT() is defined to ensure an assertion handler does not
179+
* inadvertently attempt to lower the IPL when the call to assert was triggered
180+
* because the IPL value was found to be above configMAX_SYSCALL_INTERRUPT_PRIORITY
181+
* when an ISR safe FreeRTOS API function was executed. ISR safe FreeRTOS API
182+
* functions are those that end in FromISR. FreeRTOS maintains a separate
183+
* interrupt API to ensure API function and interrupt entry is as fast and as
184+
* simple as possible. */
185+
#define portENABLE_INTERRUPTS() __asm volatile ( "MVTIPL #0" )
186+
#ifdef configASSERT
187+
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() configASSERT( ( ulPortGetIPL() <= configMAX_SYSCALL_INTERRUPT_PRIORITY ) )
188+
#define portDISABLE_INTERRUPTS() if( ulPortGetIPL() < configMAX_SYSCALL_INTERRUPT_PRIORITY ) __asm volatile ( "MVTIPL %0" ::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) )
189+
#else
190+
#define portDISABLE_INTERRUPTS() __asm volatile ( "MVTIPL %0" ::"i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) )
191+
#endif
192+
193+
/* Critical nesting counts are stored in the TCB. */
194+
#define portCRITICAL_NESTING_IN_TCB ( 1 )
195+
196+
/* The critical nesting functions defined within tasks.c. */
197+
extern void vTaskEnterCritical( void );
198+
extern void vTaskExitCritical( void );
199+
#define portENTER_CRITICAL() vTaskEnterCritical()
200+
#define portEXIT_CRITICAL() vTaskExitCritical()
201+
202+
/* As this port allows interrupt nesting... */
203+
uint32_t ulPortGetIPL( void ) __attribute__( ( naked ) );
204+
void vPortSetIPL( uint32_t ulNewIPL ) __attribute__( ( naked ) );
205+
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortGetIPL(); portDISABLE_INTERRUPTS()
206+
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) vPortSetIPL( uxSavedInterruptStatus )
207+
208+
/*-----------------------------------------------------------*/
209+
210+
/* Task function macros as described on the FreeRTOS.org WEB site. */
211+
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
212+
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
213+
214+
/*-----------------------------------------------------------*/
215+
216+
/* If portUSE_TASK_DPFPU_SUPPORT is set to 1 (or left undefined) then tasks are
217+
* created without a DPFPU context and must call vPortTaskUsesDPFPU() to give
218+
* themselves a DPFPU context before using any DPFPU instructions. If
219+
* portUSE_TASK_DPFPU_SUPPORT is set to 2 then all tasks will have a DPFPU context
220+
* by default. */
221+
#if ( portUSE_TASK_DPFPU_SUPPORT == 1 )
222+
void vPortTaskUsesDPFPU( void );
223+
#else
224+
225+
/* Each task has a DPFPU context already, so define this function away to
226+
* nothing to prevent it being called accidentally. */
227+
#define vPortTaskUsesDPFPU()
228+
#endif
229+
#define portTASK_USES_DPFPU() vPortTaskUsesDPFPU()
230+
231+
/* Definition to allow compatibility with existing FreeRTOS Demo using flop.c. */
232+
#define portTASK_USES_FLOATING_POINT() vPortTaskUsesDPFPU()
233+
234+
/* *INDENT-OFF* */
235+
#ifdef __cplusplus
236+
}
237+
#endif
238+
/* *INDENT-ON* */
239+
240+
#endif /* PORTMACRO_H */

portable/GCC/RX/readme.txt

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
The generic RX port layer in this folder can be used for the following MCUs in case of other than using
2+
tickless idle functionality of RX100 port layers and/or using C89 specification and/or using old version
3+
of ICCRX.
4+
5+
6+
RX MCU Group CPU FPU FPU
7+
Core (Single (Double
8+
Type Precision) Precision)
9+
10+
RX110 RXv1 No ---
11+
RX111 RXv1 No ---
12+
RX113 RXv1 No ---
13+
RX130 RXv1 No ---
14+
RX13T RXv1 Yes ---
15+
16+
RX210 RXv1 No ---
17+
RX21A RXv1 No ---
18+
RX220 RXv1 No ---
19+
RX230,RX231 RXv2 Yes ---
20+
RX23E-A RXv2 Yes ---
21+
RX23W RXv2 Yes ---
22+
RX23T RXv2 Yes ---
23+
RX24T RXv2 Yes ---
24+
RX24U RXv2 Yes ---
25+
26+
RX610 RXv1 Yes ---
27+
RX62N,RX621 RXv1 Yes ---
28+
RX630 RXv1 Yes ---
29+
RX634 RXv1 Yes ---
30+
RX63N,RX631 RXv1 Yes ---
31+
RX64M RXv2 Yes ---
32+
RX65N,RX651 RXv2 Yes ---
33+
RX66N RXv3 Yes Yes
34+
RX62T RXv1 Yes ---
35+
RX62G RXv1 Yes ---
36+
RX63T RXv1 Yes ---
37+
RX66T RXv3 Yes No
38+
39+
RX71M RXv2 Yes ---
40+
RX72M RXv3 Yes Yes
41+
RX72N RXv3 Yes Yes
42+
RX72T RXv3 Yes No
43+
44+
Notes:
45+
46+
(1) When you use the FIT configurator or the Smart Configurator, platform.h has to be used. In this case,
47+
the following definition is necessary in FreeRTOSConfig.h.
48+
49+
/* If configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H is set to 0 then iodefine.h
50+
is included and used in FreeRTOS Kernel's Renesas RX port. If the macro is set
51+
to 1 then platform.h is included and used in the port. If the macro is set to 2
52+
then neither iodefine.h nor platform.h are included. If the macro is undefined,
53+
it is set to 0 (CC-RX/GNURX) or 2 (ICCRX) internally for backward compatibility.
54+
When the FIT configurator or the Smart Configurator is used, platform.h has to be
55+
used. */
56+
#define configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H 1
57+
58+
(2) When you use the CC-RX compiler of Renesas or the GNURX compiler, the definition of configTICK_VECTOR
59+
is like the following:
60+
61+
/* The peripheral used to generate the tick interrupt is configured as part of
62+
the application code. This constant should be set to the vector number of the
63+
peripheral chosen. As supplied this is CMT0. */
64+
#define configTICK_VECTOR _CMT0_CMI0
65+
66+
(3) When you use the ICCRX compiler of IAR, the definition of configTICK_VECTOR depends on the setting of
67+
configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H like the followings:
68+
69+
(3-1) In case of configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 0 or 1
70+
71+
#define configTICK_VECTOR _CMT0_CMI0
72+
73+
(3-2) In case of configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 2 or undefined
74+
75+
#define configTICK_VECTOR VECT_CMT0_CMI0
76+
77+
(4) Moreover in the case of above (3-2), I/O register definition header file which is provided from IAR
78+
has to be included in FreeRTOSConfig.h like the followings:
79+
80+
/* Renesas hardware definition header. */
81+
#include <iorx71m.h>
82+
83+
84+
For more information about Renesas RX MCUs, please visit the following URL:
85+
86+
https://www.renesas.com/products/microcontrollers-microprocessors/rx.html
87+

portable/GCC/RX100/readme.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
The following table shows which port is recommended to be used.
1+
The following port layers are no longer recommended to be used other than using tickless idle functionality
2+
of RX100 port layers and/or using C89 specification and/or using old version of ICCRX. The following table
3+
shows which port layer can be used if you have to use one of the following port layers.
24

35

46
RX MCU Group CPU FPU FPU Port Layer
@@ -28,16 +30,16 @@ RX634 RXv1 Yes --- Renesas/RX600 GCC/RX60
2830
RX63N,RX631 RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600
2931
RX64M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2
3032
RX65N,RX651 RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2
31-
RX66N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU
33+
RX66N RXv3 Yes Yes N/A (*5) N/A (*5) N/A (*5)
3234
RX62T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600
3335
RX62G RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600
3436
RX63T RXv1 Yes --- Renesas/RX600 GCC/RX600 IAR/RX600
35-
RX66T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5)
37+
RX66T RXv3 Yes No Renesas/RX600v2 GCC/RX600v2 IAR/RXv2
3638

3739
RX71M RXv2 Yes --- Renesas/RX600v2 GCC/RX600v2 IAR/RXv2
38-
RX72M RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU
39-
RX72N RXv3 Yes Yes Renesas/RX700v3_DPFPU GCC/RX700v3_DPFPU IAR/RX700v3_DPFPU
40-
RX72T RXv3 Yes No Renesas/RX600v2 (*5) GCC/RX600v2 (*5) IAR/RXv2 (*5)
40+
RX72M RXv3 Yes Yes N/A (*5) N/A (*5) N/A (*5)
41+
RX72N RXv3 Yes Yes N/A (*5) N/A (*5) N/A (*5)
42+
RX72T RXv3 Yes No Renesas/RX600v2 GCC/RX600v2 IAR/RXv2
4143

4244
Notes:
4345

@@ -55,9 +57,7 @@ configTICK_VECTOR (in FreeRTOSConfig.h).
5557

5658
*4: RX600 ports use MVTIPL instruction but RX610 MCUs don't support this instruction.
5759

58-
*5: RX700v3_DPFPU ports are also available with the following definition in FreeRTOSConfig.h.
59-
60-
#define configUSE_TASK_DPFPU_SUPPORT 0
60+
*5: Please use generic RX port layers (i.e. Renesas/RX, GCC/RX, IAR/RX).
6161

6262
*6: PriorityDefinitions.h has to be provided for port_asm.s in case of other than RX700v3_DPFPU port.
6363
It contains two definitions of interrupt priority like the following.

0 commit comments

Comments
 (0)