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

Write firmware to bank 1 from application

Hello.

I would like to know if its possible to preform a firmware update from the application itself like so:

1. Getting the firmware via UART in chunks of 2k (from a GSM modem).

2. Writing each chunk to Bank1.

3. Reset to DFU mode that will check if the data in Bank1 is valid.

4. If so, copy it to Bank0 and start the application.

If its possible, I would like to know how to write directly to bank1 from my application and how to reset to that DFU mode.

We are currently using SDK15.

Thanks and all the best,

Ofer.

Parents Reply Children
  • Hi Vidar,

    I'm note sure I understand what you mean. I didn't programmed the Bootloader setting page yet. I get bank1 address from: 

    uint32_t nrf_dfu_bank1_start_addr(void)
    {
        uint32_t bank0_addr = nrf_dfu_bank0_start_addr();
        return ALIGN_TO_PAGE(bank0_addr + s_dfu_settings.bank_0.image_size);
    }

    Doesn't this already pointing to the start location of bank1?

  • I've added:

     

      <MemorySegment name="bootloader_settings_page" start="0x000FF000" size="0x1000">
    	<ProgramSection alignment="4" keep="Yes" load="No" name=".bootloader_settings_page" address_symbol="__start_bootloader_settings_page" end_symbol="__stop_bootloader_settings_page" start = "0x000FF000" size="0x1000" />
      </MemorySegment>
      <MemorySegment name="mbr_params_page" start="0x000FE000" size="0x1000">
    	<ProgramSection alignment="4" keep="Yes" load="No" name=".mbr_params_page" address_symbol="__start_mbr_params_page" end_symbol="__stop_mbr_params_page" start = "0x000FE000" size="0x1000" />
      </MemorySegment>
      <MemorySegment name="ot_flash_data" start="0xdc000" size="0x4000">
    	<ProgramSection alignment="4" keep="Yes" load="Yes" name=".ot_flash_data" address_symbol="__start_ot_flash_data" end_symbol="__stop_ot_flash_data" start = "0xdc000" size="0x4000" />
      </MemorySegment>
      <MemorySegment name="uicr_bootloader_start_address" start="0x00000FF8" size="0x4">
    	<ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_bootloader_start_address" address_symbol="__start_uicr_bootloader_start_address" end_symbol="__stop_uicr_bootloader_start_address" start = "0x00000FF8" size="0x4" />
      </MemorySegment>
      <MemorySegment name="uicr_mbr_params_page" start="0x00000FFC" size="0x4">
    	<ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_mbr_params_page" address_symbol="__start_uicr_mbr_params_page" end_symbol="__stop_uicr_mbr_params_page" start = "0x00000FFC" size="0x4" />
      </MemorySegment>
    </Root>
    

    To flash_placement.xml and and bootloader_settings_page RX 0x000FF000 0x1000;uicr_mbr_params_page RX 0x00000FFC 0x4;mbr_params_page RX 0x000FE000 0x1000

    to the Memory segments.

    Now the bank1 address is 0x72000 but the error: <error> app: SOFTDEVICE: INVALID MEMORY ACCESS still appears.

  • Hi Ofer,

    The Softdevice will trigger the INVALID MEMORY ACCESS assert if the application tries to access either memory or peripherals that are reserved to the Softdevice (System on Chip resource requirements). As this is occuring when you try to do flash, I assume the problem is that you try to use the NVMC directly and not through the SD flash API.  Please make sure you have selected the SoftDevice backend for fstorage.

Related