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

Linker-file and peer manager RAM problem

I'm working on my owm dfu service and until recently I used pstorage_raw for handling memory. Now as I wanted to implement bonding, I added the peer manager, because I'm not so sure about implementing the security features by myself. Thus, I had to switch from pstorage to fstorage.

As fstorage uses section variables, I added fs_data to the linker file. Usually the fs_config variables used by the fds module in peer manager and my dfu service are written in RAM at start up, which is working fine when I flash the program. BUT if I reset the nRF, these config are completely overwritten and the peer manager init fails!

Furthermore, sd_ble_enable always tells me "RAM START ADDR 0x20002008 should be adjusted to 0x20001FE8", although it is set to 0x20001FE8 which you can see in my linker-file:

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

MEMORY
{
  FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x1A000
  RAM (rwx) :  ORIGIN = 0x20001FE8, LENGTH = 0x6018
        
  /** Location in UICR where bootloader start address is stored. */
  UICR_BOOTLOADER (r) : ORIGIN = 0x10001014, LENGTH = 0x04
}

SECTIONS
{
  /* Write the bootloader address in UICR. */
  .uicrBootStartAddress : 
  {
    KEEP(*(.uicrBootStartAddress))
  } > UICR_BOOTLOADER
  
  .fs_data :
  {
    . = ALIGN(4);
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
  } > RAM  
}


INCLUDE "nrf5x_common.ld"

I'm working with an Eclipse makefile Project with Cross ARM GCC on a nRF52832 with s132_nrf52_2.0.0_softdevice.hex and the nRF5_SDK_11.0.0_89a8197.

I'm really desparate and have no idea how to proceede like this, and I don't want to revert all the modification from implementing peer manager and fstorage again, if I don't have to.

I know that SDK12 just released, but I don't have a compatible chip revision...

  • I retried implementing the peer manager from scratch in my bootloader programm and again got memory problems. But this time I found my problem:

      FLASH (rx) : ORIGIN = 0x6B000, LENGTH = 0x15000
    
        /** Location of bootloader setting in flash. */
      BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0007E000, LENGTH = 0x1000
    
      /** Location of mbr params page in flash. */
      MBR_PARAMS_PAGE (rw) : ORIGIN = 0x0007F000, LENGTH = 0x1000
    

    As I implemented the huge peer manager, my bootloader became so big that it reached into the Bootloader Settings, because the Flash was accidently defined to go to the end of the flash memory 0x80000. This is now fixed and the memory problems are of course gone now.

Related