Bootloader is not compatible with NRF52832_XXAB

Hi,

Based on previous threads on the matter:

https://devzone.nordicsemi.com/f/nordic-q-a/46565/sdk-15-3-0-missing-bootloader-definitions-for-nrf52832_xxab-qfab

https://devzone.nordicsemi.com/f/nordic-q-a/52686/buttonless-dfu-on-nrf52832_xxab

And how old this issue is (v15.3.0), I've decided to summerize the workaround I have created for this, and hopefully this will be included in the next SDK version:

    1 From 782baa241fbc93f25305417ec29c319126539d34 Mon Sep 17 00:00:00 2001
    2 From: Shahar Hadas <[email protected]>
    3 Date: Thu, 23 Dec 2021 13:11:39 -0500
    4 Subject: [PATCH] Fix support for NRF52832_XXAB in bootloader
    5 
    6 ---
    7  components/libraries/bootloader/dfu/nrf_dfu_types.h           | 4 ++++
    8  .../libraries/bootloader/nrf_bootloader_fw_activation.c       | 4 ++--
    9  components/libraries/bootloader/nrf_bootloader_info.c         | 2 +-
   10  3 files changed, 7 insertions(+), 3 deletions(-)
   11 
   12 diff --git a/components/libraries/bootloader/dfu/nrf_dfu_types.h b/components/libraries/bootloader/dfu/nrf_dfu_types.h
   13 index cd2d7ef..8d960f1 100644
   14 --- a/components/libraries/bootloader/dfu/nrf_dfu_types.h
   15 +++ b/components/libraries/bootloader/dfu/nrf_dfu_types.h
   16 @@ -101,6 +101,8 @@ extern "C" {
   17      #define BOOTLOADER_SETTINGS_ADDRESS     (0x0003F000UL)
   18  #elif defined( NRF52832_XXAA )
   19      #define BOOTLOADER_SETTINGS_ADDRESS     (0x0007F000UL)
   20 +#elif defined( NRF52832_XXAB )
   21 +    #define BOOTLOADER_SETTINGS_ADDRESS     (0x0003F000UL)
   22  #elif defined( NRF52833_XXAA )
   23      #define BOOTLOADER_SETTINGS_ADDRESS     (0x0007F000UL)
   24  #elif defined(NRF52840_XXAA)
   25 @@ -118,6 +120,8 @@ extern "C" {
   26      #define NRF_MBR_PARAMS_PAGE_ADDRESS         (0x000FE000UL)
   27  #elif defined(NRF52832_XXAA)
   28      #define NRF_MBR_PARAMS_PAGE_ADDRESS         (0x0007E000UL)
   29 +#elif defined(NRF52832_XXAB)
   30 +    #define NRF_MBR_PARAMS_PAGE_ADDRESS         (0x0003E000UL)
   31  #elif defined(NRF52833_XXAA)
   32      #define NRF_MBR_PARAMS_PAGE_ADDRESS         (0x0007E000UL)
   33  #elif defined(NRF52810_XXAA)
   34 diff --git a/components/libraries/bootloader/nrf_bootloader_fw_activation.c b/components/libraries/bootloader/nrf_bootloader_fw_activation.c
   35 index 91168b8..8be4bfe 100644
   36 --- a/components/libraries/bootloader/nrf_bootloader_fw_activation.c
   37 +++ b/components/libraries/bootloader/nrf_bootloader_fw_activation.c
   38 @@ -287,13 +287,13 @@ static uint32_t bl_activate(void)
   39      // This code is a configurable workaround for updating SD+BL from SDK 12.x.y - 14.1.0
   40      // SoftDevice size increase would lead to unaligned source address when comparing new BL in SD+BL updates.
   41      // This workaround is not required once BL is successfully installed with a version that is compiled SDK 14.1.0
   42 -#if defined(NRF52832_XXAA) && defined(BLE_STACK_SUPPORT_REQD)
   43 +#if (defined(NRF52832_XXAA) || defined(NRF52832_XXAB)) && defined(BLE_STACK_SUPPORT_REQD)
   44      if ((p_bank->bank_code == NRF_DFU_BANK_VALID_SD_BL) &&
   45          (memcmp((void *)BOOTLOADER_START_ADDR, (void *)(src_addr - 0x4000), len) == 0))
   46      {
   47          ret_val = NRF_SUCCESS;
   48      }
   49 -#endif // defined(NRF52832_XXAA)
   50 +#endif // defined(NRF52832_XXAA) || defined(NRF52832_XXAB)
   51  
   52      // Check if the BL has already been copied.
   53      if ((ret_val != NRF_SUCCESS) &&
   54 diff --git a/components/libraries/bootloader/nrf_bootloader_info.c b/components/libraries/bootloader/nrf_bootloader_info.c
   55 index 01e0441..467efd5 100644
   56 --- a/components/libraries/bootloader/nrf_bootloader_info.c
   57 +++ b/components/libraries/bootloader/nrf_bootloader_info.c
   58 @@ -81,7 +81,7 @@ void nrf_bootloader_debug_port_disable(void)
   59          nrf_nvmc_write_word((uint32_t)&NRF_UICR->APPROTECT, 0x0);
   60          NVIC_SystemReset();
   61      }
   62 -#if (!defined (NRF52810_XXAA) && !defined (NRF52811_XXAA) && !defined (NRF52832_XXAA) && !defined (NRF52832_XXAB))
   63 +#if (!defined (NRF52810_XXAA) && !defined (NRF52811_XXAA) && !defined (NRF52832_XXAA) && !defined (NRF52832_XXAB) && !defined (NRF52832_XXAB))
   64      if (NRF_UICR->DEBUGCTRL != 0x0)
   65      {
   66          nrf_nvmc_write_word((uint32_t)&NRF_UICR->DEBUGCTRL, 0x0);
   67 -- 
   68 2.34.1
   69 

Related