Compiler error when building FreeRTOS for Renesas RX113 (RX100) Demo

Hello,
I am trying to compile the Demo project downloaded from freertos.org,
for Renesas RX113 and using the Renesas development board that has RX113 microcontroller (Part No. R5F51138AxFP) . I am following the exact procedure as described on following URL:
https://www.freertos.org/RX113_RTOS_Renesas_GCC_IAR.html

Name of the zip file downloaded is: “FreeRTOSv10.3.1”

The folder name (inside this downloaded zip) that has the relevant demo project is: “RX100_RX113-RSK_Renesas_e2studio”

IDE that I am using: e2 studio Version: 5.4.0.018

CC-RX Compiler ToolChains with which I tried compiling (without success) the Demo:
v3.02.00
v2.08.00
v2.06.00
v2.04.01

Error that is seen:
E0523047:Illegal #pragma interrupt declaration

Compiler throws above error on following statement which is in the file port.c:
#pragma interrupt ( prvTickISR( vect = _VECT( configTICK_VECTOR ), enable ) )


Note:
I tried removing the " _VECT( ) " mentioned in above statement, but the error does NOT get resolved. Please suggest a resolution to this error.

path of port.c file is:
FreeRTOSv10.3.1\FreeRTOS\Source\portable\Renesas\RX100\port.c

Thank you in advance.

Looking at the latest compiler manual, it shows the format should be:

#pragma interrupt [(]<function name>[(<interrupt specification>[,...])][,...][)]

and there is a table provided, which is not going to format correctly here, but will past below. It seems to show vect= would now be the correct syntax, but we will have to investigate further.

No. Item Form Options Specifications
1 Vector table vect= <vector number> Specifies the vector number for which
the interrupt function address is stored.
2 Fast interrupt fint None Specifies the function used for fast interrupts.
This RTFI instruction is used to return
from the function.
3 Limitation on registers
in interrupt function
save None Limits the number of registers used in
the interrupt function to reduce save and
restore operations.
4 Nested interrupt enable enable None Sets the I flag in PSW to 1 at the beginning
of the function to enable nested
interrupts.
5 Accumulator saving acc None Saves and restores Accumulator in the
interrupt function.
6 Accumulator non-saving
no_acc None Does not save and restore Accumulator
in the interrupt function.
7 Enable the register
bank save function
[V3.01.00 or later]
bank= <bank number> Enables the register bank save function.
Specify the number of the bank in which
the values of registers will be saved.

Thank you for your reply.
I had not mentioned it earlier that I had referred to the format given in compiler manual and the table given therein (that you have referred to). That’s why I tried replacing the statement with the one below but it didn’t work (i.e. error remains):
#pragma interrupt ( prvTickISR( vect= configTICK_VECTOR, enable ) )

I came across the following URL that discusses in this regard:

I also tried replacing ‘configTICK_VECTOR’ directly by number ‘28’ which is the interrupt vector (#define VECT_CMT0_CMI0 28) that finally gets assigned as default assignment, but the error still remains.

There are other similar “#pragma interrupt” declarations in the code which are not giving any error right now, which are as mentioned below:
#pragma interrupt r_sci1_transmit_interrupt(vect=VECT(SCI1,TXI1),fint)
#pragma interrupt r_sci1_receiveerror_interrupt(vect=VECT(SCI1,ERI1))

You will notice that in above two declarations, just “VECT” is used (instead of “_VECT” used in the one that gives error). I don’t know why this difference in the same code? I tried making this change as well but error still remains.

This was just additional information from my side.
You have already said that you need to investigate further. Thank you for that.

#pragma interrupt ( prvTickISR( vect = configTICK_VECTOR, enable ) )

Is what worked in the other repo, so it is curious as to why it doesn’t work here, especially as you eliminated the possibility of the configTICK_VECTOR constant somehow being out of scope.

I tried with e2 studio version 7.0.0 and I got the same error.

The _VECT(X) macro expands to VECT##X. In the current case, it is expected to expand to VECT_CMT0_CMI0 which is defined as 28 in io_define.h. The problem is that configTICK_VECTOR is defined to VECT_CMT0_CMI0 resulting in _VECT( configTICK_VECTOR ) getting expanded to VECT_VECT_CMT0_CMI0 (which is invalid).

If I change configTICK_VECTOR to _CMT0_CMI0 it works for me. Would you please change the configTICK_VECTOR in FreeRTOSConfig.h:

#define configTICK_VECTOR _CMT0_CMI0

Let us know if that works.

Thanks.

Hello Gaurav,
Thank you for your reply.
I did the change that you mentioned but the end result is that
the project still does not build successfully. Details are as follows:

The earlier error (i.e. E0523047) goes away,but for each instance
of call to function ‘prvStartFirstTask();’ and ‘prvYieldHandler();’
the compiler throws following error:
E0552113:Symbol definition is not appropriate

Note that: function ‘prvStartFirstTask();’ is the same function that-
becomes an interrupt function because of the ‘#pragma interrupt’ directive.

The end result is: Build Failed.

I don’t know if it has anything to do with the e2 studio IDE Version.
I am using an older version (as I am presently working on a non RTOS
project developed earlier in the older IDE). Do you think that using a
newer e2 studio IDE Version will make any difference? Is it possible to
install two different e2 studio IDE Versions on the same PC?
Also, please inform the CC-RX compiler ToolChain that you used for successful build.
The demo folder also contains a folder named ‘RX100-RSK_Renesas_e2studio’
but probably it is developed using FIT modules and needs a board support package
whereas I think my setup supports only the ‘code configurator’.

My CCRX version is 3.01.00 - It was the one already installed on my machine. I installed e2studio version 5.4.0 and after making FreeRTOSConfig.h change I mentioned above, it works for me. I tried CCRX versions 3.01.00, 2.06.00, 2.08.00 and all of them work.

I am not sure what is different between mine and your setup. Would you please try with a clean copy of code?

Regarding the co-existence of multiple versions of e2studio, I’d suggest to check with Renesas. When I installed version 5.4.0, it warned me that I need to uninstall the newer version first - based on which I would guess that it is probably not possible but please confirm with Renesas.

Thanks.

Hello,

I may understand what happened in the past. Before the following issue and pull request in Amazon FreeRTOS repository, I guess that the project was able to be built. But only port.c was changed and FreeRTOSConfig.h was NOT changed at the time, so the project become unable to be built.

Missing _VECT in #pragma interrupt (Renesas RX100 series) #1006

Add missing _VECT to #pragma interrupt in RX100/port.c #1013

Before the time, the following definition in FreeRTOSConfig.h and the following use of the marco in port.c are matched, so the project was able to be built.

FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/FreeRTOSConfig.h

#define configTICK_VECTOR VECT_CMT0_CMI0

FreeRTOS/Source/portable/Renesas/RX100/port.c

#pragma interrupt ( prvTickISR( vect = configTICK_VECTOR, enable ) )

But only port.c was changed as follows and FreeRTOSConfig.h was NOT changed at the time, so the project become unable to be built.

FreeRTOS/Source/portable/Renesas/RX100/port.c

#pragma interrupt ( prvTickISR( vect = _VECT( configTICK_VECTOR ), enable ) )

I guess that the reason why they changed the use of the marco in port.c was that only RX100 port was different from other RX ports as follows and Amazon FreeRTOS’s FreeRTOSConfig.h was written for RX600v2 port.

FreeRTOS/Source/portable/Renesas/{RX200, RX600, RX600v2}/port.c

#pragma interrupt ( prvTickISR( vect = _VECT( configTICK_VECTOR ), enable ) )

More information are here.

Update Renesas GCC compiler ports #135
https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/135#issuecomment-680172086

Build: Fix Demo/RX100_RX113-RSK_Renesas_e2studio RTOS demo project build error #224
https://github.com/FreeRTOS/FreeRTOS/pull/224#issuecomment-687442987

In the comming FreeRTOS v10.4.0, also FreeRTOSConfig.h will be changed by the following commit as follows.

Fix: Demo/RX100_RX113-RSK_Renesas_e2studio RTOS demo project build error (#224)

FreeRTOS/Demo/RX100_RX113-RSK_Renesas_e2studio/src/FreeRTOSConfig.h

#define configTICK_VECTOR _CMT0_CMI0

In the future, another FreeRTOSConfig.h will be changed by the following pull request as follows.

Build: Fix Demo/RX100-RSK_Renesas_e2studio RTOS demo project build error #228

FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/FreeRTOSConfig.h

#define configTICK_VECTOR _CMT0_CMI0

Best regards,
NoMaY