ady001 wrote on Thursday, April 28, 2016:
Dear Support,
I’ve been evaluating the RTOS on the PIC24 platform and have been impressed. I’ve got tasks with priorities, messages queues, critical sections etc.
I wanted to have a play with a Mutex but the linker does not seem to like xSemaphoreCreateMutex() even though it is happy with my later use of xSemaphoreGive() and xSemaphoreTake() in the same file. Maybe I’ve missed a header file or a defintion somewhere but I’m stuck.
/* My includes */
include “FreeRTOS.h”
include “task.h”
include “semphr.h”
include “queue.h”
/* My Mutex handle */
static SemaphoreHandle_t MutexHandle_AppTestLED = NULL;
/* My Mutex creation */
void vApplicationMutex(void)
{
MutexHandle_AppTestLED = xSemaphoreCreateMutex();
}
// Error thrown by the linker…
: In function _vApplicationMutex': : undefined reference to
_xQueueCreateMutex’
build/default/production/_ext/1472/ApplicationTask.o(.text+0x12): In function _vApplicationMutex': : undefined reference to
_xQueueCreateMutex’
The function xSemaphoreCreateMutex() is in blue in the project, showing it is recognize as a function and ‘Navigate to defintion’ opens the file semphr.h at the extract below ( where the section is active in the compilation ).
if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
endif
Please can you help ?
Kind regards,
Ady