errors while compiling freertos with iar compiler

chris-itk wrote on Tuesday, October 07, 2014:

Hi everybody,
I get a compiler error when I use the --mfc compiler flag (multi-file compilation) of the IAR compiler.
Without this flag, compiling every single c-file for itself, my project builds without any error.

I would be very glad if you could tell me what the problem is.

Regards
Chris

Here’s the message:
iccrl78.exe ./user_src/FreeRTOS/croutine.c ./user_src/FreeRTOS/event_groups.c ./applilet3_src/FreeRTOS_Hooks.c ./user_src/FreeRTOS/portable/MemMang/heap_1.c ./user_src/FreeRTOS/list.c ./user_src/FreeRTOS/portable/IAR/RL78/port.c ./user_src/FreeRTOS/queue.c ./applilet3_src/r_cg_cgc.c ./applilet3_src/r_cg_cgc_user.c ./applilet3_src/r_cg_port.c ./applilet3_src/r_cg_port_user.c ./applilet3_src/r_cg_timer.c ./applilet3_src/r_cg_wdt.c ./applilet3_src/r_cg_wdt_user.c ./applilet3_src/r_main.c ./applilet3_src/r_systeminit.c ./user_src/FreeRTOS/timers.c ./user_src/Tasks/UserTasks.c ./user_src/FreeRTOS/tasks.c --core rl78_2 --code_model near --data_model near --near_const_location rom0 -e -Ol --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --no_crosscall --no_scheduling --no_clustering --debug --mfc --no_system_include -o ./Debug/Obj/ --dlib_config dlrl78nn2n.h -I ./user_src/FreeRTOS/ -I ./user_src/FreeRTOS/portable/IAR/RL78/ -I ./user_src/FreeRTOS/include/ -I ./applilet3_src/ -I ./user_src/Tasks/ -I ./user_src/includes/

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

extern volatile TCB_t * volatile pxCurrentTCB;
^
“C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\FreeRTOS\portable\IAR\RL78\port.c”,90 Error[Pe1061]:
declaration of variable “pxCurrentTCB” is incompatible with a
declaration in another translation unit
“void volatile *volatile __near pxCurrentTCB” (declared at line 90
of “./user_src/FreeRTOS/portable/IAR/RL78/port.c”) (from
translation unit
“./user_src/FreeRTOS/portable/IAR/RL78/port.c”)
“struct tskTaskControlBlock *volatile __near pxCurrentTCB”
(declared at line 188 of “./user_src/FreeRTOS/tasks.c”)
(from translation unit “./user_src/FreeRTOS/tasks.c”)

Errors: 1
Warnings: none
makefile:60: recipe for target ‘Debug/Obj/croutine.r87’ failed
mingw32-make: *** [Debug/Obj/croutine.r87] Error 2

davedoors wrote on Wednesday, October 08, 2014:

I just tried this in my ARM project and didnt get an issue. It must be specific to the RL78 port file. Did you try changing the extern declaration

extern volatile TCB_t * volatile pxCurrentTCB;

to match the declaration in the other file? You cant use structtskTaskControlBlock, but maybe

extern TCB_t *volatile near pxCurrentTCB;

would work.

chris-itk wrote on Thursday, October 09, 2014:

Hi Dave,
thx for your answer.
Yes I tried this out, but it didn’t work.
I also tried to put the whole deklaration of structtskTaskControlBlock and pxCurrentTCB into the task.h file, to be able to use it in port.c. This works fine for this error, but a lot of other errors came up.

Here’s just one of them (there are a lot more):
“C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src\libs\FreeRTOS\include\portable.h”,363 Error[Pe1066]:
declaration of function “pxPortInitialiseStack” had a different
meaning during compilation of
“./user_src/Application/Tasks/TestTask.c”
“__near_func unsigned short *pxPortInitialiseStack(unsigned short
*, TaskFunction_t, void *)” (declared at line 363 of
“C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src
libs\FreeRTOS\include\portable.h”) (from translation
unit “./applilet3_src/r_main.c”)
“__near_func unsigned int *pxPortInitialiseStack(unsigned int *,
TaskFunction_t, void *)” (declared at line 363 of
“C:\Users\ckurz.ITK\Desktop\RL78_Demo\RL78_Demo\user_src
libs\FreeRTOS\include\portable.h”) (from translation
unit “./user_src/Application/Tasks/TestTask.c”)

I think I will stop trying to use the --mfc flag. It seems to be a lot of work to get this run correctly. I’m just using a loop in the makefile instead, and compiling every single file for itselfe.