This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_sdk: app_util.h CEIL_DIV implementation

app_util.h:106

#define CEIL_DIV(A, B)      \
     /*lint -save -e573 */   \
     ((((A) - 1) / (B)) + 1) \
     /*lint -restore */

Causes a compiler error (by sheer luck) when the numerator is 0. This can be seen in softdevice_handler.h:74

static uint32_t BLE_EVT_BUFFER[CEIL_DIV(BLE_STACK_EVT_MSG_BUF_SIZE, sizeof(uint32_t))];

when BLE_STACK_SUPPORT_REQD is not set (causing BLE_STACK_EVT_MSG_BUF_SIZE to be zero).

Suggested fix: Standard ceil macro implementation:

#define CEIL_DIV(A, B) (((A) + (B) - 1) / (B))
Parents Reply Children
No Data
Related