nRF52 SDK – peer_manager_init(..) failure

Sysprogs forums Forums VisualGDB nRF52 SDK – peer_manager_init(..) failure

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9632
    bojanpotocnik
    Participant

    Hello,
    I am posting this as a solution for anyone with a similar problem: When initializing BLE with nRF52 SDK >= 12.1.0, function peer_manager_init(bool erase_bonds) throws fatal error with error code NRF_ERROR_INTERNAL.

    Call stack is as following:
    void peer_manager_init(bool erase_bonds) results in fatal error in APP_ERROR_CHECK(pm_init()), because
    ret_code_t pm_init(void) in peer_manager.c returns NRF_ERROR_INTERNAL, because
    ret_code_t pds_init() in peer_data_storage.c returns NRF_ERROR_NO_MEM, because
    ret_code_t fds_init(void) in fds.c returns FDS_ERR_NO_PAGES, because
    static fds_init_opts_t pages_init() in fds.c returns NO_PAGES, because fs_config.p_start_addr is 0.
    The problem is that fs_config.p_start_addr is defined by .fs_data section. In linker scripts nRF52832_XXAA_S132_*.lds fs_data is defined as:

    .data : AT(_sidata)
     {
     . = ALIGN(4);
     _sdata = .;
    
    PROVIDE(__data_start__ = _sdata);
     *(.data)
     *(.data*)
    
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
    
    . = ALIGN(4);
     _edata = .;
    
    PROVIDE(__data_end__ = _edata);
     } > SRAM

    which does not work, at least for me. After few hours of struggling, I found solution with help of original linker scripts from nRF5x SDK:

    .data : AT(_sidata)
    {
    . = ALIGN(4);
    _sdata = .;

    PROVIDE(__data_start__ = _sdata);
    *(.data)
    *(.data*)

    . = ALIGN(4);
    _edata = .;

    PROVIDE(__data_end__ = _edata);
    } > SRAM

    .fs_data :
    {
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
     } > SRAM
    `

    Now it works.

    • This topic was modified 7 years, 5 months ago by bojanpotocnik.
    • This topic was modified 7 years, 5 months ago by bojanpotocnik.
    • This topic was modified 7 years, 5 months ago by bojanpotocnik.
    • This topic was modified 7 years, 5 months ago by bojanpotocnik.
    • This topic was modified 7 years, 5 months ago by bojanpotocnik. Reason: I really don't get how to do proper code formatting
    #9656
    support
    Keymaster

    Hi,

    Thanks for posting this, it looks like our bug. We could not reproduce it on our side though.

    Could you please check if modifying our version of the linker script to align the fs_data contents also helps?

    .data : AT(_sidata)
     {
     . = ALIGN(4);
     _sdata = .;
    
    PROVIDE(__data_start__ = _sdata);
     *(.data)
     *(.data*)
    
    . = ALIGN(4);  #<=================== Insert this line
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))</strong>
    PROVIDE(__stop_fs_data = .);
    
    . = ALIGN(4);
     _edata = .;
    
    PROVIDE(__data_end__ = _edata);
     } > SRAM

    If yes, we will release a hotfix for the BSP.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.