This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Flashing bootloader and application via J-Link

Hello. I want to make flashing of devices for production faster. So I want to write application together with bootloader via J-Link simultaneously and not via OTA DFU. I'm using S110 v6 and dual bank BLE DFU from SDK 5.1 example. I know that after flashing bootloader and application I just need to compute CRC16 of the DFU bank 0 and write this value to the bootloader settings in the flash, but maybe someone already has a solution to this problem?

Parents
  • I believe you can accomplish what you want by changing the following line in bootloader_util_arm.c from:

    uint8_t __attribute__((section (".bootloader_settings_sect"))) m_boot_settings[CODE_PAGE_SIZE] __attribute__((used));
    

    To:

    uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};
    

    Then you can program your merged app and bootloader with nrfjprog without it thinking the application is not valid.

Reply
  • I believe you can accomplish what you want by changing the following line in bootloader_util_arm.c from:

    uint8_t __attribute__((section (".bootloader_settings_sect"))) m_boot_settings[CODE_PAGE_SIZE] __attribute__((used));
    

    To:

    uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};
    

    Then you can program your merged app and bootloader with nrfjprog without it thinking the application is not valid.

Children
  • Thanks Nikita. I'm using the following with no luck (app does not boot):

    nrfjprog --eraseall nrfjprog --programs %SOFTDEVICE% --verify nrfjprog --program %APP% %BOOTLOADER% --verify nrfjprog --reset

  • Correct. Flashing S110 + bootloader + app via J-Link works. However, the one problem is that the bootloader does not run the application. At this point, I can use the UART DFU to reflash the application and it then loads correctly (everything works!). The source of this problem seems to be that "p_bootloader_settings" does not have BANK_VALID_APP set and crc set to ZERO (so it is failing the bootloader valid check).

  • So after flashing S110 + bootloader + app via J-Link application doesn't run? Then after flashing S110 + bootloader + app via J-Link try to look via debugger at flash content in bootloader settings sector and check if it contains BANK_VALID_APP (0x01) value.

  • Just checked with a debugger by placing a breakpoint @ if (p_bootloader_settings->bank_0 == BANK_VALID_APP) : As I suspected, every member of the "p_bootloader_settings" structure is zero. Very strange!

  • Upload your bootloader project, I'll check the code.

Related