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
  • @Hung Bui: Hmm, I forgot how I got that number. I referenced from one of the answers in the devzone's question.

    Sorry I cannot find the referenced link. I will edit this comment if I find it.

    Surprisingly, I haven't failed BLE OTA with that settings.

    So, I have to change the linker script (in IAR ,.icf file) to 0x20002C00-0x20003FFF.

    IAR is different from Keil uVision so I think the iRAM2 is meaning the __no_init section in IAR.

    Anyways, 128 (128 = 0x20004000 - 0x20003F80, top of 16KB Ram ~ __no_init section)

    -46 (size of two global variables)

    = 82 bytes for my extra data, is this correct?

    Thanks for your help.

Children
No Data
Related