2015-07-13 03:42 PM
In the latest version of the STM32CubeF4 package (and the last few I've used), there seems to be an error in the CMSIS OS wrapper for FreeRTOS. I imagine this is in the other Cube packages as well, though I haven't looked. In the memory pool allocation function (osPoolAlloc() in cmsis_os.c), we traverse the list of free memory blocks with the following code:
for (i = 0; i < pool_id->pool_sz; i++) {
index = pool_id->currentIndex + i; if (index >= pool_id->pool_sz) { index = 0; }This should read something like:for (i = 0; i < pool_id->pool_sz; i++) {
index = pool_id->currentIndex + i; if (index >= pool_id->pool_sz) { index = index - pool_id->pool_sz; }To properly traverse the list of blocks in a circular manner. Otherwise, depending on how fast you allocate and release items from the pool, you can run into cases where allocations fail even though the pool has plenty of free space.2015-11-11 10:28 AM
*bump*
just came across this as well and found this post.