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

SOFTDEVICE_HANDLER_INIT error: array is too large

I have ported the example ble_app_beacon from sdk 7.2.0 for use with nrf51422_xxaa and softdevice s310 (v.2.00).

In the function ble_stack_init() there is a call to the macro

SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, false) 

(my board doesn't have a LF quartz, but the result is the same). Keil (v5.14) underlines it with red, and if I hover with the mouse on it, it gives me the error "error: array is too large (1073741824 elements)". It does seem a bit large indeed.

It probably refers to the declaration of the array in the softdevice_handler.h

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

Oddly enough, I can compile and run the code, apparently with no problems. The original example app doesn't show this error. Is it something I should worry about?

I have noticed that softdevice_handler.h makes use of sizeof(uint32_t) but doesn't include <stdint.h>, can this be the problem?

Parents
  • Yes, same problem for me when i was trying to use SOFTDEVICE_HANDLER_INIT without BLE_STACK_SUPPORT_REQD defined (i am in ANT only context). In this case BLE_STACK_EVT_MSG_BUF_SIZE is 0 (defined by ble_stack_hadler_types.h)

    So as RK says, the errors comes the fact that 0-1 = FFFFFFFF.

    The solution is to replace

    #define BLE_STACK_EVT_MSG_BUF_SIZE        0    /**< Since the BLE stack support is not required, this is equated to 0, so that the @ref softdevice_handler.h can compute the internal event buffer size without having to care for BLE events.*/
    

    by

    #define BLE_STACK_EVT_MSG_BUF_SIZE        1
    
Reply
  • Yes, same problem for me when i was trying to use SOFTDEVICE_HANDLER_INIT without BLE_STACK_SUPPORT_REQD defined (i am in ANT only context). In this case BLE_STACK_EVT_MSG_BUF_SIZE is 0 (defined by ble_stack_hadler_types.h)

    So as RK says, the errors comes the fact that 0-1 = FFFFFFFF.

    The solution is to replace

    #define BLE_STACK_EVT_MSG_BUF_SIZE        0    /**< Since the BLE stack support is not required, this is equated to 0, so that the @ref softdevice_handler.h can compute the internal event buffer size without having to care for BLE events.*/
    

    by

    #define BLE_STACK_EVT_MSG_BUF_SIZE        1
    
Children
No Data
Related