Create Mutex in PSoC Creator 4.2 with FreeRTOS

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
PascalS
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hi,

i try to setup a FreeRTOS based project at CYBLE-416045-02 module. Right now, I have enabled FreeRTOS support and I'am able to create and run some Tasks. My next step is to create a Mutex!

1. To get this project to work, I have to include the following header files:

     #include "FreeRTOS.h" 

     #include "task.h"

     #include "semphr.h"

     Cypress, PSoC 6 101: Lesson 1-4 PSoC Creator FreeRTOS - YouTube  [4:50]

     But why Alan Hawse says: "Notice that we didn't have to include any FreeRTOS header..."??? This statement is confusing for me. Mayby my issue is based in this point!

2. I try to create a semaphore:

     SemaphoreHandle_t xSemaphore;

     xSemaphore =  xSemaphoreCreateMutex();

     The PSoC Creator says, "Undefined reference to xQueueCreateMutex".

     But I can go to the definition of "xQueueCreateMutex" in "semphr.h":

     #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )

          #define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )

     #endif

     So the "xQueueCreateMutex" function should be included, if configSUPPORT_DYNAMIC_ALLOCATION  = 1!

     When I go into the FreeRTOSConfig.h I can see:

     #define configSUPPORT_DYNAMIC_ALLOCATION        1

     So why isn't the "semphr.h" not combined to the FreeRTOSConfig.h? Refer to Point 1, maybe I have forgotten something....otherwise "xQueueCreateMutex" should be defined.

Cheers!

0 Likes
1 Solution
PascalS
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

I had to set

#define configUSE_MUTEXES                       1

in FreeRTOS.h file!

View solution in original post

0 Likes
1 Reply
PascalS
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

I had to set

#define configUSE_MUTEXES                       1

in FreeRTOS.h file!

0 Likes