cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in cmsis_os.c

Manish Sharma
Associate III

Hi Team,

Recently, I came across an error "dereferencing pointer to incomplete type struct os_pool_cb " when in my program, I tried to access "markers" ( member of the struct os_pool_cb). Below is my design

file1.c

=======

#[include "cmsis_os.h"]​

extern osPoolId mypool;

osPoolDef(rxDataPool, 16, sizeof(int));

mypool = osPoolCreate(osPool(rxDataPool));

if(mypool->markers) <=====(dereferencing pointer to incomplete type struct os_pool_cb)

file2.c

======

#[include "cmsis_os.h"]​ 

osPoolId mypool;

uint32_t *ptr;

ptr = (uint32_t *)osPoolAlloc(mypool);

osPoolFree(mypool, ptr);

Solution

=========

Index: Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c

===================================================================

--- Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c  (revision 4442)

+++ Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c  (working copy)

@@ -907,16 +907,6 @@

 //This is a primitive and inefficient wrapper around the existing FreeRTOS memory management.^M

 //A better implementation will have to modify heap_x.c!^M

 ^M

-^M

-typedef struct os_pool_cb {^M

- void *pool;^M

- uint8_t *markers;^M

- uint32_t pool_sz;^M

- uint32_t item_sz;^M

- uint32_t currentIndex;^M

-} os_pool_cb_t;^M

-^M

-^M

 /**^M

 * @brief Create and Initialize a memory pool^M

 * @param pool_def     memory pool definition referenced with \ref osPool.^M

Index: Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h

===================================================================

--- Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h  (revision 4442)

+++ Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h  (working copy)

@@ -268,6 +268,16 @@

  osTimerPeriodic        =    1       ///< repeating timer^M

 } os_timer_type;^M

 ^M

+typedef struct os_pool_cb {^M

+   void *pool;^M

+   uint8_t *markers;^M

+   uint32_t pool_sz;^M

+   uint32_t item_sz;^M

+   uint32_t currentIndex;^M

+} os_pool_cb_t;^M

Regards,

Manish

#cmsis #freertos-stm32cube #cubemx-v4.24

0 REPLIES 0