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

Tossing or sharing data after entering bootloader DFU

Hi, I use

  • IAR EWARM 7.20

  • Custom Board that has nRF51822-QFAA Revision 2

  • SDK 7.2 + S110 7.1 / SDK 10.0 + S110 8.0

  • ble_app_hrs example with Dual Bank DFU OTA

Hi, thanks to Vidar Berg's answer,

I realized that the dfu_ble_svc_peer_data_set function sets these variables at the bootloader.

// at the HRS app, dfu_app_set_peer_data.c
static void dfu_app_set_peer_data(void){ // ...

m_peer_data.addr     = key_set.keys_central.p_id_key->id_addr_info;
m_peer_data.enc_info = *key_set.keys_central.enc_key.p_enc_info;
m_peer_data.irk      = key_set.keys_central.p_id_key->id_info;

err_code = dfu_ble_svc_set_peer_data(&m_peer_data);
APP_ERROR_CHECK(err_code);
}

#elif defined ( __ICCARM__ ) // at bootloader, dfu_ble_svc.c
__no_init static dfu_ble_peer_data_t m_peer_data     @ 0x20003F80; 
__no_init static uint16_t            m_peer_data_crc @ 0x20003F80 + sizeof(dfu_ble_peer_data_t);
// sizeof(dfu_ble_peer_data_t) == 44 at SDK 7.2
#endif

Similar to this, I want to set my own data.

Like at the App, I have to run my own state 1 at the bootloader.

Or I want to set the number of blinks of LED at the app,

so the bootloader reads the value and blink that much.

So I want to set a global variable like that.

Or do I have to use pstorage functions at the bootloader?'

I hope the app and the bootloader can read the same pstorage page.

-Regards, Mango

Parents Reply
  • Great, what about the size? How much I can insert my own data? In case of SDK 7.2,

    typedef struct{ // sizeof(dfu_ble_peer_data_t) == 44 at SDK 7.2
    ble_gap_enc_info_t enc_info;
    ble_gap_irk_t      irk;
    ble_gap_addr_t     addr;
    } dfu_ble_peer_data_t;
    

    Since the bootloader at SDK 7.2 occupies small size of RAM of nRF518922-QFAA (16KB RAM),

    (0x20002C00 ~ 0x20003FAF) how much data am I allowed to add?

Children
No Data
Related