FreeRTOS and HighTec Development Platform build problem

pamdev wrote on Wednesday, June 21, 2017:

Hi! My team is trying to use TC1798 evaluation board with FreeRTOS 9.0.0.

I’m experiencing big trubles porting FreeRTOS Demo project for TC1782 to the latest(?) version of HighTec Development Platform (Version: 1.6.2.20170130-b29c1f1). As I have concluded the Demo project was made for the Platform version prior to 1.1.0 (though it seems to build on version 1.2 platform). I did my best trying to port the project code for the HighTec Development Platform but nothing helps. Build fails with message:

FreeRTOS_Demo: Each LDF project needs an LDF project nature (since version 1.1.0)

I moved the FreeRTOS Demo source code folder to a new empty HighTec project for TC1782 and copied some config setting from demo to the new project (e.g. include paths). I tried to build the project but got the error from ‘FreeRTOSConfig.h’ file that has the following line:

#error Ensure CreateProjectDirectoryStructure.bat has been executed before building.  See comment immediately above.

The comment itself tells that you can remove that line and refresh the project. That’s what I did but …

The next build gave lots of errors like this:

"C:\HighTec\toolchains\tricore\v4.9.1.0-infineon-1.1/bin/tricore-gcc" -c -I"../h" -I"C:\HighTec\toolchains\tricore\v4.9.1.0-infineon-1.1\tricore\include" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo\Common_Demo_Source\include" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo\FreeRTOS_Source\include" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782" -fno-common -Os -g3 -W -Wall -Wextra -Wdiv-by-zero -Warray-bounds -Wcast-align -Wignored-qualifiers -Wformat -Wformat-security -DTRIBOARD_TC1782 -fshort-double -mcpu=tc1782 -mversion-info -MMD -MP -MF"RTOSDemo/FreeRTOS_Source/portable/MemMang/heap_2.d" -MT"RTOSDemo/FreeRTOS_Source/portable/MemMang/heap_2.d" -o "RTOSDemo/FreeRTOS_Source/portable/MemMang/heap_2.o" "../RTOSDemo/FreeRTOS_Source/portable/MemMang/heap_2.c"
'Finished building: ../RTOSDemo/FreeRTOS_Source/portable/MemMang/heap_2.c'
' '
'Building file: ../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c'
'Invoking: TriCore C Compiler'
"C:\HighTec\toolchains\tricore\v4.9.1.0-infineon-1.1/bin/tricore-gcc" -c -I"../h" -I"C:\HighTec\toolchains\tricore\v4.9.1.0-infineon-1.1\tricore\include" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo\Common_Demo_Source\include" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo\FreeRTOS_Source\include" -I"C:\Users\TVT\workspace\CORRIDA\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782" -fno-common -Os -g3 -W -Wall -Wextra -Wdiv-by-zero -Warray-bounds -Wcast-align -Wignored-qualifiers -Wformat -Wformat-security -DTRIBOARD_TC1782 -fshort-double -mcpu=tc1782 -mversion-info -MMD -MP -MF"RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.d" -MT"RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.d" -o "RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.o" "../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c"
../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c: In function 'pxPortInitialiseStack':
../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c:170:3: error: stray '$' in program
   pulLowerCSA = portCSA_TO_ADDRESS( _mfcr( $FCX ) );
   ^
In file included from C:\Users\TVT\workspace\CORRIDA\RTOSDemo\FreeRTOS_Source\include/portable.h:94:0,
                 from C:\Users\TVT\workspace\CORRIDA\RTOSDemo\FreeRTOS_Source\include/FreeRTOS.h:104,
                 from ../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c:81:
../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c:170:37: error: incompatible type for argument 1 of '_mfcr'
   pulLowerCSA = portCSA_TO_ADDRESS( _mfcr( $FCX ) );
                                     ^
C:\Users\TVT\workspace\CORRIDA\RTOSDemo\FreeRTOS_Source\portable\GCC\TriCore_1782/portmacro.h:142:62: note: in definition of macro 'portCSA_TO_ADDRESS'
 #define portCSA_TO_ADDRESS( pCSA )   ( ( uint32_t * )( ( ( ( pCSA ) & 0x000F0000 ) << 12 ) | ( ( ( pCSA ) & 0x0000FFFF ) << 6 ) ) )
                                                              ^
In file included from ../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c:76:0:
c:\hightec\toolchains\tricore\v4.9.1.0-infineon-1.1\tricore\include\machine\intrinsics.h:111:10: note: expected 'unsigned int' but argument is of type 'FCX_t'
 unsigned _mfcr (const unsigned __regaddr)
          ^
../RTOSDemo/FreeRTOS_Source/portable/GCC/TriCore_1782/port.c:170:3: error: stray '$' in program
   pulLowerCSA = portCSA_TO_ADDRESS( _mfcr( $FCX ) );
   ^

Is it possible to use FreeRTOS with the latest HighTec Development Platform? If the answer is yes is there possibility to port FreeRTOS TC1782 Demo to this invironment?

Thanks in advance!


With best wishes, Theodore

rtel wrote on Wednesday, June 21, 2017:

I’m sure it is possible, but it seems from your post there will be a bit
of scratching and prodding to do so as the syntax the compiler wants
seems to have changed.

You should be able to correct errors where just the type is wrong easily
enough - perhaps there are some library files in the FreeRTOS project
directory that need updating to their latest versions?

After that, faced with this sort of issue I would try a couple of
things: first look for an application note that from Tasking that tells
you how to move from one version to another, second look at assembly
code and examples that come with the compiler to see what it is
expecting, then copy that. If you are still stuck then you could try
the documentation for the _mfcr macro to see what it says to do :o)

pamdev wrote on Monday, June 26, 2017:

It’s not easy to beleive that there is a reason to change the syntax of the register referencing though generally it’s possible. Is there any source of information (reference, manual, examples, etc) to figure out the CPU register and system areas referencing for modern TriCore toolchain c compiler? I couldn’t find any so far.

rtel wrote on Monday, June 26, 2017:

L Is there any

source of information (reference, manual, examples, etc) to figure out
the CPU register and system areas referencing for modern TriCore
toolchain c compiler? I couldn’t find any so far.

I’m sure there are but you are asking the wrong person - we provide
support for FreeRTOS not the compilers (we use more than 18 compilers at
the last count) so this question will have to be directed to the
compiler vendor.

pamdev wrote on Tuesday, June 27, 2017:

Perhaps I have found a solution in one of docs. The syntax didn’t change but the macros did.

_mfcr( $FCX ) --> __MFCR( $FCX )

This way the code compiles normally.

rtel wrote on Tuesday, June 27, 2017:

Great. Thanks for reporting back. Was that the only change that was
necessary?