Types assignment in FreeRTOS

migraichen wrote on Friday, July 20, 2018:

Hey everyone,

i’m trying to Port FreeRTOS to a 8051 Softcore Controller (https://github.com/jaruiz/light52) but when i compile the File
tasks.c (https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/tasks.c#l1011) i receive the following error

$ sdcc --debug -o obj/ -D__LIGHT52__ -Isrc/FreeRTOS/include -Isrc/config -I…/include -Isrc/FreeRTOS/portable/SDCC/light52 -c src/FreeRTOS/tasks.c

src/FreeRTOS/tasks.c:1011: error 47: indirections to different types assignment
from type ‘struct TaskControlBlock_t generic* fixed’
to type ‘struct TaskControlBlock_t generic* int fixed’

src/FreeRTOS/tasks.c:1954: error 78: incompatible types
from type ‘struct TaskControlBlock_t generic* near* fixed’
to type ‘struct TaskControlBlock_t generic* int generic* const fixed’

How do I have to cast these types ?

best regards
Michael

rtel wrote on Friday, July 20, 2018:

In the last release (10.0.1) these types were void *. In the head
revision of SVN they are no longer void * but ‘type safe’ - each type is
different. Are you using the latest release (downloaded as a zip or exe
file) or checking the files out of SVN?

migraichen wrote on Saturday, July 21, 2018:

Hey Richard,

yes, i cheched out the trunk via SVN.

I can try a different version on monday and see if that’s compiling.

Thanks for your help, have a nice weekend.
Michael

rtel wrote on Saturday, July 21, 2018:

Hmm, the version in SVN has been tested with several compilers with no
issues. Could this be an issue with SDCC? I last attempted to use
typesafe handles some years back and had to back out the changes due to
a debugger issue. I believe the code is all perfectly valid C, and
quite old C too, nothing that relies on a later version of the standard.

migraichen wrote on Monday, July 23, 2018:

Hey Richard,

I changed to version 10.0.0 today but I’m still getting these errors.
So I tried different Versions of SDCC. Last week I had Vesion 3.5.0 from Ubuntu Repository installed.
Version 3.6.0 and 3.7.0 gives me additional errors:

src/FreeRTOS/tasks.c:558: error 226: no type specifier for ‘prvInitialiseNewTask parameter 6’
src/FreeRTOS/tasks.c:738: error 226: no type specifier for ‘xTaskCreate parameter 6’
src/FreeRTOS/tasks.c:831: error 226: no type specifier for ‘prvInitialiseNewTask parameter 6’

parameter 6 is always “TaskHandle_t * const pxCreatedTask”

I tried to analyse the TaskHandle_t structure and TCB_t structure but they seem to be equal as far as I can see. I guess I have to see how SDCC interprets them.

What other 8051 compilers did you use ?

Best regards
Michael

rtel wrote on Monday, July 23, 2018:

SDCC is the only one I have used - but it was a VERY long time ago, so
no doubt an obsolete version of the compiler. V10.0.0 is very well
exercised with many compilers, and uses the void* handles instead of the
typesafe handles.

migraichen wrote on Wednesday, July 25, 2018:

SDCC seems to by complaning about the “const” if I change “TaskHandle_t * const pxCreatedTask” to “TaskHandle_t * pxCreatedTask” for each funktion i get over this point.

Why did you define it as const, since it gets set during the Initialization ?