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

How to use the .sdh_soc_observers section?

WIth the upgrade to the new SDK, registering the callback handlers has been made more difficult to figure out.

The .sdh_ble_observers, .sdh_soc_observersers  sections are created after .text, etc.

Result of /opt/arm-none-eabi-2018q2/bin/arm-none-eabi-objdump -x crownstone.elf

crownstone.elf:     file format elf32-littlearm
crownstone.elf
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00037ce5

Program Header:
0x70000001 off    0x00030b18 vaddr 0x00050b18 paddr 0x00050b18 align 2**2
         filesz 0x000002d8 memsz 0x000002d8 flags r--
    LOAD off    0x00000000 vaddr 0x00020000 paddr 0x00020000 align 2**16
         filesz 0x00030df0 memsz 0x00030df0 flags r-x
    LOAD off    0x00032430 vaddr 0x20002430 paddr 0x00050df0 align 2**16
         filesz 0x00000a0c memsz 0x000023b8 flags rw-
private flags = 5000400: [Version5 EABI] [hard-float ABI]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0002a8e8  00026000  00026000  00006000  2**6
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .sdh_ble_observers 00000008  000508e8  000508e8  000308e8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .sdh_soc_observers 00000010  000508f0  000508f0  000308f0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .sdh_state_observers 00000008  00050900  00050900  00030900  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .sdh_stack_observers 00000008  00050908  00050908  00030908  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .sdh_req_observers 00000008  00050910  00050910  00030910  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA

Calling like this:

extern "C" {                                                                                                            
                                                                                                                        
#define CROWNSTONE_SOC_OBSERVER_PRIO 0                                                                                  
static void crownstone_soc_evt_handler(uint32_t evt_id, void * p_context)                                               
{                                                                                                                       
    // some logging
}                                                                                                                       
                                                                                                                        
NRF_SDH_SOC_OBSERVER(m_crownstone_soc_observer, CROWNSTONE_SOC_OBSERVER_PRIO, crownstone_soc_evt_handler, NULL);        
                                                                                                                        
}

However, no events are generated.

Is there some way I can debug this? Even an example .elf file (using the SDK15) would be useful.

Related