Merge pull request #10706 from hugueskamba/fix-softcoding-mem-pool-size-evaluation

mem pool size: Fix calculation of memory pool size for portability
pull/10896/head
Martin Kojtal 2019-06-25 10:59:56 +01:00 committed by GitHub
commit e39aeff69e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -183,8 +183,7 @@ public:
private: private:
osMemoryPoolId_t _id; osMemoryPoolId_t _id;
/* osMemoryPoolNew requires that pool block size is a multiple of 4 bytes. */ char _pool_mem[MBED_RTOS_STORAGE_MEM_POOL_MEM_SIZE(pool_sz, sizeof(T))];
char _pool_mem[((sizeof(T) + 3) & ~3) * pool_sz];
mbed_rtos_storage_mem_pool_t _obj_mem; mbed_rtos_storage_mem_pool_t _obj_mem;
}; };
/** @}*/ /** @}*/
@ -192,5 +191,3 @@ private:
} }
#endif #endif

View File

@ -52,6 +52,9 @@ typedef osRtxEventFlags_t mbed_rtos_storage_event_flags_t;
typedef osRtxMessage_t mbed_rtos_storage_message_t; typedef osRtxMessage_t mbed_rtos_storage_message_t;
typedef osRtxTimer_t mbed_rtos_storage_timer_t; typedef osRtxTimer_t mbed_rtos_storage_timer_t;
#define MBED_RTOS_STORAGE_MEM_POOL_MEM_SIZE(block_count, block_size) \
osRtxMemoryPoolMemSize(block_count, block_size)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif