I build and downloaded the last SDK for Kinetis KL17Z from kex.nxp.com and I noticed this version now support FreeRTOS v 9.0.0. I am very excited by this version due its news functions.
But when I create a new projetct with KDS v3.2 via the Kinetis SDKv2 project wizard and then compile my new project, compilation failed with these errors :
C:\ ....... \Debug/../freertos/Source/tasks.c:2046: undefined reference to `portRECORD_READY_PRIORITY'
C:\ ....... \Debug/../freertos/Source/tasks.c:2586: undefined reference to `portRECORD_READY_PRIORITY'
It seem that the problems are locate into task.c file and for those API :
prvAddTaskToReadyList( pxNewTCB ); taskRESET_READY_PRIORITY( pxTCB->uxPriority ); prvAddTaskToReadyList( pxTCB ); taskSELECT_HIGHEST_PRIORITY_TASK(); prvAddTaskToReadyList( pxUnblockedTCB );
And so on in task.c file.
I have no idea what wrong...
How can I fix this ?
Today it's the same with KDS 3.2 (updated) and SDK_2.1_MKL27Z32xxx4
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
the compilation still fails
m_data' overflowed by 5184 bytes
m_data overflowed with stack and heap
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0050;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0050;
3296bytes are always missing
Freertos is not possible on the Z32 (8k RAM) ?
I have used FreeRTOS down to device with 1KByte of RAM (of course that does not leave much, only for two tasks).
Your problem with the linker error is probably that you use a heap size too large. Can you check
in your FreeRTOSConfig.h?
I created a new program for the KL43Z and I have the same problem.
I put the #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0.
The error that I have when I compile is:
Description Resource Path Location Type
undefined reference to `_vTaskSwitchContext' port.c /Demo/freertos/Source/portable/GCC/ARM_CM0 line 290 C/C++ Problem
I didn't modify anything what could I do?
Yesterday I was watching
#define configMINIMAL_STACK_SIZE ((unsigned short)90)
And I found it weak
Defaut value for TOTAL_HEAP_SIZE is 10240... Necessarily with 8k of ram this can not work.
Ok. So I noticed that my "undefined macro" are linked with the config macro configUSE_PORT_OPTIMISED_TASK_SELECTION . Which it set by default in FreeRTOS v9. If I clear it, then compile succeed, otherwise compilation fail.
In FreeRTOS v8, this macro config is even not define in FreeRTOSConfig.h, so consider to be clear by default at compilation time. So this why I never had this error before.
Some information about this config is showed in task.c :
/* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 0 then task selection is performed in a generic way that is not optimised to any particular microcontroller architecture. */
And in the opposite way :
/* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 1 then task selection is
performed in a way that is tailored to the particular microcontroller
architecture being used. */
FreeRTOS reference manual explain it.
So I got my issue and that is. It seem that KL17Z or KL25Z cannot support optimised task.
That macro should be cleared by default for those microcontrollers.
Ok. I tried to compile a new downloaded SDK but this time for FRDM-KL25Z and I had exactly same errors. Even on another computer.
I believe there is a problem with Kinetis Expert...
I have found out that the portRECORD_READY_PRIORITY is defined in portmacro.h with
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
Pls add #include "portmacro.h" in task.c
Hope it can help you
I included "portmacro.h" in task.c but nothing change. So I checked that header file and I realized that portRECORD_READY_PRIORITY is not define ... So I added the macro you gave me and then compile error occurred again but this time for :
/freertos/Source/tasks.c:2807: undefined reference to `portGET_HIGHEST_PRIORITY'
/freertos/Source/tasks.c:3738: undefined reference to `portRESET_READY_PRIORITY'
My though is that some macro are missed for some reasons :smileyconfused:. Maybe Kinetis Expert forgot something at build time.
Can you send me please your "portmacro.h" file in order the compare ?
Edit: I attached my portmacro.h.