Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with NRF_SDH_SOC_OBSERVER macro - "expected ) before numeric constant"

Hello,

I'm finishing migrating to the newest SDK from SDK 13.1. I'm having problems using the BLE_ADVERTISING_DEF macro, it doesn't compile.

The reason appears to be somewhere in the NRF_SDH_SOC_OBSERVER macro. If try to compile this for example: 

NRF_SDH_SOC_OBSERVER(m_advertising_soc_obs, 1, ble_advertising_on_ble_evt, &m_advertising)

The compiler throws this error:

/Users/andresovela/foolography/nrf5-sdk-15.0/components/ble/ble_advertising/ble_advertising.h:79:45: error: expected ')' before numeric constant
 NRF_SDH_SOC_OBSERVER(m_advertising_soc_obs, 1, ble_advertising_on_ble_evt, &m_advertising)

I have no idea if I moved something somewhere by mistake, but I've been dragging that compilation error since SDK 14.2 (I migrated to 15.0 in steps). Does anyone have any idea what can I do about that error? It occurs to me that I might have modified something somewhere in the SDK by mistake, but since I saw that error in SDK 14 and in SDK 15 as well, I think the error must be somewhere in my code.

If I replace the call to BLE_ADVERTISING_DEF(m_advertising) with ble_advertising_t m_advertising, my project compiles just fine, but it doesn't advertise of course since I'm not registering the observers.

Any ideas?

EDIT:

I've been following the macro hierarchy and since that macro puts an observer in a section defined in the linker file, I thought that the problem might be there as well, but I can't see anything wrong there either:

.sdh_ble_observers :
  {
    PROVIDE(__start_sdh_ble_observers = .);
    KEEP(*(SORT(.sdh_ble_observers*)))
    PROVIDE(__stop_sdh_ble_observers = .);
  } > FLASH
  .sdh_soc_observers :
  {
    PROVIDE(__start_sdh_soc_observers = .);
    KEEP(*(SORT(.sdh_soc_observers*)))
    PROVIDE(__stop_sdh_soc_observers = .);
  } > FLASH

Related