SoftDevices
Protocol |
Role |
Chip |
SoftDevice |
Bluetooth Low Energy |
Peripheral |
|
S110 |
|
S112 |
|
S113 |
Central or Peripheral |
|
S120 |
Central and Peripheral |
|
S130 |
|
S132 |
|
S140 |
ANT |
|
|
S210 |
|
S212 |
Bluetooth Low Energy and ANT |
Peripheral |
|
S310 |
Peripheral and Broadcaster |
|
S312 |
All roles |
|
S332 |
|
S340 |
ARM Assembly
SVCALL(SD_BLE_ENABLE,
uint32_t,
sd_ble_enable(uint32_t * p_app_ram_base)
);
#define SVCALL(number, return_type, signature) \
static return_type signature \
{ \
__asm( \
"svc %0\n" \
"bx r14" : : "I" (GCC_CAST_CPP number) : "r0" \
);
ARM GCC Inline Assembler Kochbuch
ARM GCC Inline Assembler Cookbook
GCC Extended Asm – Assembler Instructions with C Expression Operands
ARM GCC Inline Assembler Cookbook (PDF)
Writing inline assembly code
Stack Trace
sd_softdevice_enable()
components\libraries\util\app_error_weak.c
void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
nrf_sdm.h uint32_t sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler)
nrf_sdh.c ret_code_t nrf_sdh_enable_request(void)
main.c void ble_stack_init(void)
main.c int main(void)
ble_evt_handler()
Specifying Attributes of Variables – section
Analyzing the Linker Map file with a little help from the ELF and the DWARF
github.com/govind-mukundan/MapViewer, A windows application to view and analyze information from the linker generated Map file
static nrf_sdh_ble_evt_observer_t m_ble_observer
__attribute__ ((section(".sdh_ble_observers3")))
__attribute__((used)) = {
.handler = ble_evt_handler,
.p_context = NULL
}
components\libraries\experimental_section_vars\nrf_section.h
============================================================
section_name = sdh_ble_observers3
section_var = static nrf_sdh_ble_evt_observer_t m_ble_observer
#define NRF_SECTION_ITEM_REGISTER(section_name, section_var) \
section_var __attribute__ ((section("." STRINGIFY(section_name)))) __attribute__((used))
components\libraries\experimental_section_vars\nrf_section_iter.h
=================================================================
#define NRF_SECTION_SET_ITEM_REGISTER(_name, _priority, _var)
NRF_SECTION_ITEM_REGISTER(CONCAT_2(_name, _priority), _var)
components\softdevice\common\nrf_sdh_ble.h
==========================================
_name = m_ble_observer
_prio = 3
_handler = ble_evt_handler,
_context = NULL
#define NRF_SDH_BLE_OBSERVER(_name, _prio, _handler, _context)
NRF_SECTION_SET_ITEM_REGISTER(
sdh_ble_observers,
_prio,
static nrf_sdh_ble_evt_observer_t _name
) =
{
.handler = _handler,
.p_context = _context
}
main.c
======
#define APP_BLE_OBSERVER_PRIO 3
// Register a handler for BLE events.
NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
on_adv_evt()
/\*\*<[a-zA-Z .\\@_]*\*/
[,]?[ ]*/\*\*<[a-zA-Z ();,.\\@_]*\*/
ble_advertising_t p_advertising->adv_handle
ble_advertising_t p_advertising->evt_handler
ble_advertising_t p_advertising->error_handler
uint32_t sd_ble_gap_adv_set_configure(...)
uint32_t ble_advertising_init(...)
void advertising_init() -> init.evt_handler = on_adv_evt
int main(void)
static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
typedef enum {
BLE_ADV_EVT_IDLE
BLE_ADV_EVT_DIRECTED_HIGH_DUTY
BLE_ADV_EVT_DIRECTED
BLE_ADV_EVT_FAST
BLE_ADV_EVT_SLOW
BLE_ADV_EVT_FAST_WHITELIST
BLE_ADV_EVT_SLOW_WHITELIST
BLE_ADV_EVT_WHITELIST_REQUEST
BLE_ADV_EVT_PEER_ADDR_REQUEST
} ble_adv_evt_t;
enum BLE_GAP_EVTS {
BLE_GAP_EVT_CONNECTED
BLE_GAP_EVT_DISCONNECTED
BLE_GAP_EVT_CONN_PARAM_UPDATE
BLE_GAP_EVT_SEC_PARAMS_REQUEST
BLE_GAP_EVT_SEC_INFO_REQUEST
BLE_GAP_EVT_PASSKEY_DISPLAY
BLE_GAP_EVT_KEY_PRESSED
BLE_GAP_EVT_AUTH_KEY_REQUEST
BLE_GAP_EVT_LESC_DHKEY_REQUEST
BLE_GAP_EVT_AUTH_STATUS
BLE_GAP_EVT_CONN_SEC_UPDATE
BLE_GAP_EVT_TIMEOUT
BLE_GAP_EVT_RSSI_CHANGED
BLE_GAP_EVT_ADV_REPORT
BLE_GAP_EVT_SEC_REQUEST
BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST
BLE_GAP_EVT_SCAN_REQ_REPORT
BLE_GAP_EVT_PHY_UPDATE_REQUEST
BLE_GAP_EVT_PHY_UPDATE
BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST
BLE_GAP_EVT_DATA_LENGTH_UPDATE
BLE_GAP_EVT_QOS_CHANNEL_SURVEY_REPORT
BLE_GAP_EVT_ADV_SET_TERMINATED
};
enum BLE_GATTC_EVTS {
BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE
BLE_GATTC_EVT_REL_DISC_RSP
BLE_GATTC_EVT_CHAR_DISC_RSP
BLE_GATTC_EVT_DESC_DISC_RSP
BLE_GATTC_EVT_ATTR_INFO_DISC_RSP
BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP
BLE_GATTC_EVT_READ_RSP
BLE_GATTC_EVT_CHAR_VALS_READ_RSP
BLE_GATTC_EVT_WRITE_RSP
BLE_GATTC_EVT_HVX
BLE_GATTC_EVT_EXCHANGE_MTU_RSP
BLE_GATTC_EVT_TIMEOUT
BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE
};
S132
a
b