Skip to content

Conversation

@VanNamDinh
Copy link
Contributor

Description

Port for GCC RX Family (RX100, RX200, RX600 and RX600v2). This work with new FIT version from Renesas as well. The RX GCC of Amazon FreeRTOS has not been updated for a while so that GCC projects can't be built and run.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Signed-off-by: Dinh Van Nam <[email protected]>
 * RX600v2
 * RX600
 * RX100

Signed-off-by: Dinh Van Nam <[email protected]>
@NoMaY-jp
Copy link
Contributor

Hello Dinh Van Nam,

The configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H and R_BSP_SECNAME_INTVECTTBL were introduced by me when I ported Amazon FreeRTOS to RX MCU and CC-RX/GNURX. Now I think that the following is better for GNURX.

Your proposal (i.e. Renesas RX FreeRTOS Package v10.0.3):

port.c

/* 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
...omit...

/*
 * Software interrupt handler.  Performs the actual context switch (saving and
 * restoring of registers).  Written in asm code as direct register access is
 * required.
 */
void vPortSoftwareInterruptISR( void ) __attribute__( ( naked ) );
#if defined(configTICK_VECTOR)
void vPortSoftwareInterruptISR( void ) __attribute__((naked, vector( R_BSP_SECNAME_INTVECTTBL, VECT_ICU_SWINT )));
#else
void vPortSoftwareInterruptISR( void ) __attribute__((naked));
#endif

/*
 * The tick interrupt handler.
 */
void vPortTickISR( void ) __attribute__( ( interrupt ) );

#if defined(configTICK_VECTOR)
void vPortTickISR( void ) __attribute__((interrupt( R_BSP_SECNAME_INTVECTTBL, _VECT( configTICK_VECTOR ) )));
#else
void vPortTickISR( void ) __attribute__((interrupt));
#endif

My proposal:

portmacro.h (The following is picked up from [my RX700v3 DPFPU's portmacro.h which is being developed](url https://github.com/NoMaY-jp/FreeRTOS-Kernel/blob/b6bb3a60c1a2138193d2bc9f996c53f51b5d4be4/portable/GCC/RX700v3_DPFPU/portmacro.h).)

/* 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

port.c (The following is picked up from [my RX700v3 DPFPU's port.c which is being developed](url https://github.com/NoMaY-jp/FreeRTOS-Kernel/blob/b6bb3a60c1a2138193d2bc9f996c53f51b5d4be4/portable/GCC/RX700v3_DPFPU/port.c).)

/* Hardware specifics. */
#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 */

...omit...

/*
 * Software interrupt handler.  Performs the actual context switch (saving and
 * restoring of registers).  Written in asm code as direct register access is
 * required.
 */
#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 ISR handler.  The peripheral used is configured by the application
 * via a hook/callback function.
 */
#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 */

Best regards,
NoMaY

@NoMaY-jp
Copy link
Contributor

Hello Dinh Van Nam,

The following topic (both threads are the same topic) is not subject of your pull request, but I think that it is better for you to keep this topic in your mind if you don't know it.

[Improper access to an on-chip peripheral register in Renesas RX port layer](url https://forums.freertos.org/t/improper-access-to-an-on-chip-peripheral-register-in-renesas-rx-port-layer/9851/) <-- in English

[Question about FreeRTOS code](url https://japan.renesasrulz.com/cafe_rene/f/forum5/5878/freertos/) <-- Please note that original title and all contents are in Japanese

Best regards,
NoMaY

@VanNamDinh
Copy link
Contributor Author

Hi NoMaY,

Thank you so much for your proposal and your contribution on RX MCU.

My team will consider your proposal in detail and resubmit pull request as soon as possible.
Please keep discussing on this channel.

Best regards,
Nam

@ravibhagavandas
Copy link
Contributor

Hello @VanNamDinh

We are in the process of reviewing this PR. Are you considering to resubmit this PR with the changes from NoMaY as proposed above ?

@ravibhagavandas
Copy link
Contributor

ravibhagavandas commented Aug 12, 2020

@VanNamDinh
It seems that existing demo RX200_RX231-RSK_GCC_e2studio_IAR build fails with this PR, due to the following error:

FreeRTOS/FreeRTOS/Source/portable/GCC/RX200/port.c:75:66: error: 'R_BSP_SECNAME_INTVECTTBL' undeclared here (not in a function)
 void vSoftwareInterruptISR( void ) __attribute__((naked, vector( R_BSP_SECNAME_INTVECTTBL, VECT_ICU_SWINT )));

Should the declaration above be guarded with configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H flag?

@NoMaY-jp
Copy link
Contributor

NoMaY-jp commented Aug 12, 2020

Hello @ravibhagavandas,

Should the declaration above be guarded with configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H flag?

Yes. As I wrote before, Dinh Van Nam's proposal is based on my work when I ported Amazon FreeRTOS to RX MCU and CC-RX/GNURX two years ago. At that time, I did not notice that configTICK_VECTOR is defined in FreeRTOSConfig.h of existing GNURX projects in FreeRTOS's zip file and FreeRTOS's repository though configTICK_VECTOR is not used in the GNURX port layers. Your comment makes me noticed that such thing just now. So, I have to say that it is mandatory (not enough 'better') to use configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H in the GNURX port layers. I'm sorry for my mistake.

Best regards,
NoMaY

@NoMaY-jp
Copy link
Contributor

Hello @ravibhagavandas,

I have reported this problem to Renesas Electronics Corporation via Japanese user forum (in the following post) but Renesas Japan is in company's summer holidays this week. (I have no direct communication method with them and Dinh Van Nam.)

(I'm sorry that all contents are in Japanese.)
https://japan.renesasrulz.com/cafe_rene/f/forum21/5940/e2-studio-v7-5-0-freertos-scfg-rtos-object/36176#36176

Best regards,
NoMaY

@ravibhagavandas
Copy link
Contributor

The changes for this PR are merged in PR #135 . Please feel free to open a new PR if you have additional changes.

laroche pushed a commit to laroche/FreeRTOS-Kernel that referenced this pull request Apr 18, 2024
Co-authored-by: Cobus van Eeden <[email protected]>
Co-authored-by: Aniruddha Kanhere <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants