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

DFU issue on custom board

Hello,

I am using a custom board and my setup looks like this:

  • nrf51 chip
  • 16KB RAM
  • 256KB of Flash
  • external crystal of 32MHz
  • SDK12.1
  • Compiling on Linux using GCC

I am trying to port the bootloader_secure example to the custom board. I have been able to run this example to the pca10028 board. Same code, some build system. Only with a few needed adjustments for the pca10028 of course. No issues currently.

Now, with the same build system I just compile this for the custom board. To make things more interesting, I am using the same linker script for both the pca10028 and the custom one - that is the adjusted one for the 16KB of RAM (remember the example runs OK on pca10028). This looks like this:

/* Linker script to configure memory regions. */

SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)

MEMORY
{
  /** Flash start address for the bootloader. This setting will also be stored in UICR to allow the
   *  MBR to init the bootloader when starting the system. This value must correspond to
   *  BOOTLOADER_REGION_START found in dfu_types.h. The system is prevented from starting up if
   *  those values do not match. The check is performed in main.c, see
   *  APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START);
   */
  /*FLASH (rx) : ORIGIN = 0x35C00, LENGTH = 0xA000*/
  FLASH (rx) : ORIGIN = 0x35C00, LENGTH = 0xA000

  /** RAM Region for bootloader. This setting is suitable when used with s110, s120, s130, s310. */
  /* RAM (rwx) :  ORIGIN = 0x20002560, LENGTH = 0x1A20 */
  RAM (rwx) :  ORIGIN = 0x20002C00, LENGTH = 0x1380

  /** Location of non initialized RAM. Non initialized RAM is used for exchanging bond information
   *  from application to bootloader when using buttonluss DFU OTA.
   */
  NOINIT (rwx) :  ORIGIN = 0x20003F80, LENGTH = 0x80

  /** Location of bootloader setting in at the last flash page. */
  BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0003FC00, LENGTH = 0x0400

  /** Location in UICR where bootloader start address is stored. */
  UICR_BOOTLOADER (r) : ORIGIN = 0x10001014, LENGTH = 0x04
}

SECTIONS
{
  /* Ensures the bootloader settings are placed at the last flash page. */
  .bootloaderSettings(NOLOAD) :
  {

  } > BOOTLOADER_SETTINGS

  /* Ensures the Bootloader start address in flash is written to UICR when flashing the image. */
  .uicrBootStartAddress :
  {
    KEEP(*(.uicrBootStartAddress))
  } > UICR_BOOTLOADER

  /* No init RAM section in bootloader. Used for bond information exchange. */
  .noinit(NOLOAD) :
  {

  } > NOINIT
  /* other placements follow here... */
}

SECTIONS
{
  . = ALIGN(4);
  .fs_data :
  {
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
  } > RAM

  . = ALIGN(4);
  .svc_data :
  {
    PROVIDE(__start_svc_data = .);
    KEEP(*(.svc_data))
    PROVIDE(__stop_svc_data = .);
  } > RAM

  . = ALIGN(4);
  .dfu_trans :
  {
    PROVIDE(__start_dfu_trans = .);
    KEEP(*(.dfu_trans))
    PROVIDE(__stop_dfu_trans = .);
  } > RAM

} INSERT AFTER .data

INCLUDE "nrf51_common.ld"

Stack size for both examples is at 255 bytes. Heap is zero.

This is the debug output of the custom board:

ain)		Inside main
(nrf_bootloader_init)		In nrf_bootloader_init
(nrf_dfu_init)		In real nrf_dfu_init
(nrf_dfu_settings_init)		running nrf_dfu_settings_init
(nrf_dfu_continue)		Enter nrf_dfu_continue
(nrf_dfu_continue_bank)		Single: Invalid bank
(nrf_dfu_app_is_valid)		Enter nrf_dfu_app_is_valid
(nrf_dfu_app_is_valid)		Return false in valid app check
(nrf_dfu_transports_init)		In nrf_dfu_transports_init
(nrf_dfu_transports_init)		num transports: 1
(ble_stack_init)		vector table: 0x00035C00
(softdevice_enable)		sd_ble_enable: RAM START at 0x20001FE8
(softdevice_enable)		sd_ble_enable: app_ram_base should be adjusted to 0x200025E0
(softdevice_enable)		ram size should be adjusted to 0x5A20 
(nrf_dfu_transports_init)		After nrf_dfu_transports_init
(nrf_dfu_init)		Could not initalize DFU transport: 0x00F42400
ain)		Inside main

The program reaches a point where it resets itself. And this happens forever. The softdevice has no chance in getting into advertising mode.

Any clues? Any ideas how to move forward?

Thanks!

Related