From b4789ca0d246d8c46bef7b5032da9c4b0483b801 Mon Sep 17 00:00:00 2001 From: Ravishankar Bhagavandas Date: Fri, 21 Aug 2020 16:16:36 -0700 Subject: [PATCH] Use configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H flag --- portable/GCC/RX600/port.c | 49 +++++++++++++++++++++----------- portable/GCC/RX600/portmacro.h | 6 ++++ portable/GCC/RX600v2/port.c | 40 ++++++++++++++++---------- portable/GCC/RX600v2/portmacro.h | 6 ++++ 4 files changed, 69 insertions(+), 32 deletions(-) diff --git a/portable/GCC/RX600/port.c b/portable/GCC/RX600/port.c index 723beaeb8..7462f2df9 100644 --- a/portable/GCC/RX600/port.c +++ b/portable/GCC/RX600/port.c @@ -37,11 +37,16 @@ #include "string.h" /* Hardware specifics. */ -#if defined(configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H) && (configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1) -#include "platform.h" -#else -#include "iodefine.h" -#endif +#if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 ) + + #include "platform.h" + +#else /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ + + #include "iodefine.h" + +#endif /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ + /*-----------------------------------------------------------*/ @@ -65,26 +70,36 @@ which would require the old IPL to be read first and stored in a local variable. * access to registers is required. */ static void prvStartFirstTask( void ) __attribute__((naked)); - /* * Software interrupt handler. Performs the actual context switch (saving and * restoring of registers). Written in asm code as direct register access is * required. */ -#if defined(configTICK_VECTOR) -void vSoftwareInterruptISR( void ) __attribute__((naked, vector( R_SECNAME_INTVECTTBL, VECT_ICU_SWINT ))); -#else -void vSoftwareInterruptISR( void ) __attribute__((naked)); -#endif +#if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 ) + + R_BSP_PRAGMA_INTERRUPT( vSoftwareInterruptISR, VECT( ICU, SWINT ) ) + R_BSP_ATTRIB_INTERRUPT void vSoftwareInterruptISR( void ) __attribute__( ( naked ) ); + +#else /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ + + void vSoftwareInterruptISR( void ) __attribute__( ( naked ) ); + +#endif /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ /* - * The tick interrupt handler. + * The tick ISR handler. The peripheral used is configured by the application + * via a hook/callback function. */ -#if defined(configTICK_VECTOR) -void vTickISR( void ) __attribute__((interrupt( R_SECNAME_INTVECTTBL, _VECT( configTICK_VECTOR ) ))); -#else -void vTickISR( void ) __attribute__((interrupt)); -#endif +#if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 ) + + R_BSP_PRAGMA_INTERRUPT( vTickISR, _VECT( configTICK_VECTOR ) ) + R_BSP_ATTRIB_INTERRUPT void vTickISR( void ); /* Do not add __attribute__( ( interrupt ) ). */ + +#else /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ + + void vTickISR( void ) __attribute__( ( interrupt ) ); + +#endif /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ /*-----------------------------------------------------------*/ diff --git a/portable/GCC/RX600/portmacro.h b/portable/GCC/RX600/portmacro.h index e534f1812..8c3696ea3 100644 --- a/portable/GCC/RX600/portmacro.h +++ b/portable/GCC/RX600/portmacro.h @@ -43,6 +43,12 @@ extern "C" { *----------------------------------------------------------- */ +/* When the FIT configurator or the Smart Configurator is used, platform.h has to be + * used. */ +#ifndef configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H + #define configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H 0 +#endif + /* Type definitions - these are a bit legacy and not really used now, other than portSTACK_TYPE and portBASE_TYPE. */ #define portCHAR char diff --git a/portable/GCC/RX600v2/port.c b/portable/GCC/RX600v2/port.c index e3e279c84..3a07d9fee 100644 --- a/portable/GCC/RX600v2/port.c +++ b/portable/GCC/RX600v2/port.c @@ -37,11 +37,15 @@ #include "string.h" /* Hardware specifics. */ -#if defined(configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H) && (configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1) -#include "platform.h" -#else -#include "iodefine.h" -#endif +#if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 ) + + #include "platform.h" + +#else /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ + + #include "iodefine.h" + +#endif /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ /*-----------------------------------------------------------*/ @@ -71,21 +75,27 @@ static void prvStartFirstTask( void ) __attribute__((naked)); * restoring of registers). Written in asm code as direct register access is * required. */ -#if defined(configTICK_VECTOR) -void vSoftwareInterruptISR( void ) __attribute__((naked, vector( R_BSP_SECNAME_INTVECTTBL, VECT_ICU_SWINT ))); -#else +#if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 ) +R_BSP_PRAGMA_INTERRUPT( vSoftwareInterruptISR, VECT( ICU, SWINT ) ) +R_BSP_ATTRIB_INTERRUPT void vSoftwareInterruptISR( void ) __attribute__( ( naked ) ); +#else /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ void vSoftwareInterruptISR( void ) __attribute__((naked)); -#endif +#endif /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ /* - * The tick interrupt handler. + * The tick ISR handler. The peripheral used is configured by the application + * via a hook/callback function. */ -#if defined(configTICK_VECTOR) -void vTickISR( void ) __attribute__((interrupt( R_BSP_SECNAME_INTVECTTBL, _VECT( configTICK_VECTOR ) ))); -#else -void vTickISR( void ) __attribute__((interrupt)); -#endif +#if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 ) + R_BSP_PRAGMA_INTERRUPT( vTickISR, _VECT( configTICK_VECTOR ) ) + R_BSP_ATTRIB_INTERRUPT void vTickISR( void ); /* Do not add __attribute__( ( interrupt ) ). */ + +#else /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ + + void vTickISR( void ) __attribute__( ( interrupt ) ); + +#endif /* configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H */ /*-----------------------------------------------------------*/ extern void *pxCurrentTCB; diff --git a/portable/GCC/RX600v2/portmacro.h b/portable/GCC/RX600v2/portmacro.h index e534f1812..8c3696ea3 100644 --- a/portable/GCC/RX600v2/portmacro.h +++ b/portable/GCC/RX600v2/portmacro.h @@ -43,6 +43,12 @@ extern "C" { *----------------------------------------------------------- */ +/* When the FIT configurator or the Smart Configurator is used, platform.h has to be + * used. */ +#ifndef configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H + #define configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H 0 +#endif + /* Type definitions - these are a bit legacy and not really used now, other than portSTACK_TYPE and portBASE_TYPE. */ #define portCHAR char