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
  • NO that's not the problem, <stdint.h> is included from app_util.h.

    If you look at the definition of CEIL_DIV it's

    CEIL_DIV(A,B) (((A)-1)/((B)) +1)
    

    If A isn't defined then it's 0, so A-1 = FFFFFFFF. sizeof(uint32)t) is 4. FFFFFFFF/4+1 = 0x40000000 = 1073741824.

    So where in your code is BLE_STACK_EVT_MSG_BUF_SIZE defined? It's possible that Keil is failing to find the definition when it's parsing that file alone and shows the error, thinking that it's not defined, and hence zero. However when you compile it's found properly and set properly and so there's no error.

  • no idea. Don't use Keil myself, but all compilers are able sometimes to get confused about defined symbols when doing analysis on single files etc. THere's probably some target or other setting which is defined fractionally differently between the two and that's throwing it off.

Reply
  • no idea. Don't use Keil myself, but all compilers are able sometimes to get confused about defined symbols when doing analysis on single files etc. THere's probably some target or other setting which is defined fractionally differently between the two and that's throwing it off.

Children
No Data