Porting FreeRTOS to Renesas RL78F14R5F10pgj

chris-itk wrote on Monday, September 29, 2014:

Hi everybody,
i’ve got some problems with porting the freertos demo project to a RL78F14 (RL78F14R5F10pgj) controller.
I’m using the iar compiler.
I can build the existing demo projects (as provided by freertos v8.1.2 for the rl78 controllers) without any error.
But if I include the necesarry register definitions (ior5f10pgj.h, ior5f10pgj_ext.t) for my controller in FreeRTOS_Config.h, I get a compiler error about some undefined symbols. See the logfile extract below.
Does anybody know about this problem, or how to fix it?
I would be very glad if you could help me.

Regards
Chris

/****************************************************************************************************/
port.c
iccrl78.exe C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\port.c --core rl78_2 --code_model near --data_model near --near_const_location rom0 -o C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\Debug\Obj\ --dlib_config C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.0\rl78\LIB\dlrl78nn2n.h -e -Ol --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --no_crosscall --no_scheduling --no_clustering --debug -I C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\ -I C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\ -I C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\include\

IAR C/C++ Compiler V1.40.3.898 for RL78
Copyright 2011-2014 IAR Systems AB.
Evaluation license - IAR Embedded Workbench for Renesas RL78, Evaluation version 1.40
C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\port.c(279) : Error[Pe020]: identifier “ITMK” is undefined
C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\port.c(282) : Error[Pe020]: identifier “ITMC” is undefined
C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\port.c(285) : Error[Pe020]: identifier “ITIF” is undefined

Errors: 3
Warnings: none
Error while running C/C++ Compiler

portasm.s87
arl78.exe C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\portasm.s87 --core rl78_2 -D__DEVICE_FILE__=<ior5f10pgj.h> -D__DEVICE_FILE_EXT__=<ior5f10pgj_ext.h> -o C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\Debug\Obj\ -M<> -r -I C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\ -I C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\ -I C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\include\ -D__NEAR_MODEL__ -D__NEAR_DATA_MODEL__ --code_model near --data_model near

IAR Assembler V1.40.3.898 for RL78
Copyright 2011-2014 IAR Systems AB.
C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\portasm.s87(102) : Error[As014]: Expression can not be forward
C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\portasm.s87(102) : Error[As014]: Expression can not be forward
C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\portasm.s87(102) : Error[As011]: Undefined symbol: INTIT_vect
C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\portasm.s87(102) : Error[As014]: Expression can not be forward

Errors: 4
Warnings: none
Error while running Assembler

Total number of errors: 7
Total number of warnings: 0

/****************************************************************************************************/

rtel wrote on Monday, September 29, 2014:

I think the second set of errors are related to the first.

That demo has configurations for multiple different RL78 families. To switch between the families you have to select the correct build configuration in IAR (done using the drop down box at the top of the workspace window, just above where the files are listed). Selecting a build configuration will ensure the correct device is selected in the IAR project options (General Options, target tab), and define a pre-processor constant. The pre-processor constant is then used to select the correct header files for the selected device, but:

But if I include the necesarry register definitions (ior5f10pgj.h,
ior5f10pgj_ext.t) for my controller in FreeRTOS_Config.h

the header files are included in demo_specific_io.h, not FreeRTOSConfig.h. I don’t think you need to edit FreeRTOSConfig.h.

Have you selected the correct target in the project options (the FreeRTOS download does not include a build configuration for the RL78f14) and ensured there are no pre-processor constants defined in the project (C/C++ Compiler, preprocessor tab in the project options dialogue box)?

Regards.

chris-itk wrote on Monday, September 29, 2014:

Hi, thanks for your quick answer.

"To switch between the families you have to select the correct build configuration in IAR (done using the drop down box at the top of the workspace window, just above where the files are listed). "

Yes, I know that. And it does work for the available targets. But the controller I’m using isn’t provided by any of your demos.
So I thougt about creating my own demo for the RL78F14.
As you write on http://www.freertos.org/a00090.html#RENESAS:
“These demos can be adapted to any microcontroller within the same family that has sufficient ROM/RAM.”
This applies to the RL78F14 in my oppinion, or am I wrong?

Regards
Christian

rtel wrote on Monday, September 29, 2014:

[sorry if this post appears twice]

The port is using an interval timer to generate the tick interrupt. In the build configurations included in the FreeRTOS download, the definitions for ITMC come from the ior_nnn.h header file, but the ior5f10pgj.h file for your part does not contain that definition.

Looking at the block diagram for that part here, the timers block does not show an interval timer:
http://www.renesas.com/products/mpumcu/rl78/rl78f1x/rl78f14/index.jsp

whereas the block diagram for other RL78 families does show an interval timer. For example the block diagram on the following page:
http://www.renesas.com/products/mpumcu/rl78/rl78g1x/rl78g14/index.jsp

So it does indeed look like you are going to have to change the port.c file so that it generates its tick interrupt from a different timer peripheral.

Regards.

chris-itk wrote on Monday, September 29, 2014:

Thank your very much for your answer. I also thought on doing that.
Regards