Cordio: Make allocating too much memory for pool a warning, not a fatal assert

pull/8981/head
Donatien Garnier 2018-12-05 18:52:28 +00:00
parent 101c5697e5
commit 2978cd8404
1 changed files with 8 additions and 3 deletions

View File

@ -330,9 +330,14 @@ void BLE::stack_setup()
buf_pool_desc.pool_count, buf_pool_desc.pool_description
);
// This assert will fail if we've either allocated too much or too little memory
// (bytes_used would be set to 0 in that case)
MBED_ASSERT(bytes_used == buf_pool_desc.buffer_size);
// Raise assert if not enough memory was allocated
MBED_ASSERT(bytes_used != 0);
// This warning will be raised if we've allocated too much memory
if(bytes_used < buf_pool_desc.buffer_size)
{
MBED_WARNING1(MBED_MAKE_ERROR(MBED_MODULE_BLE, MBED_ERROR_CODE_INVALID_SIZE), "Too much memory allocated for Cordio memory pool, reduce buf_pool_desc.buffer_size by value below.", buf_pool_desc.buffer_size - bytes_used);
}
WsfTimerInit();
SecInit();