Sysprogs forums › Forums › VisualGDB › nRF52 SDK – peer_manager_init(..) failure
Tagged: fds_init, NRF_ERROR_NO_MEM, nRF52 SDK, pds_init, peer_manager_init, pm_init
- This topic has 1 reply, 2 voices, and was last updated 8 years ago by support.
-
AuthorPosts
-
November 30, 2016 at 09:09 #9632bojanpotocnikParticipant
Hello,
I am posting this as a solution for anyone with a similar problem: When initializing BLE with nRF52 SDK >= 12.1.0, functionpeer_manager_init(bool erase_bonds)
throws fatal error with error codeNRF_ERROR_INTERNAL.
Call stack is as following:
void peer_manager_init(bool erase_bonds)
results in fatal error inAPP_ERROR_CHECK(pm_init())
, because
ret_code_t pm_init(void)
in peer_manager.c returnsNRF_ERROR_INTERNAL
, because
ret_code_t pds_init()
in peer_data_storage.c returnsNRF_ERROR_NO_MEM
, because
ret_code_t fds_init(void)
in fds.c returnsFDS_ERR_NO_PAGES
, because
static fds_init_opts_t pages_init()
in fds.c returnsNO_PAGES
, becausefs_config.p_start_addr
is0
.
The problem is thatfs_config.p_start_addr
is defined by .fs_data section. In linker scripts nRF52832_XXAA_S132_*.ldsfs_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 8 years ago by bojanpotocnik.
- This topic was modified 8 years ago by bojanpotocnik.
- This topic was modified 8 years ago by bojanpotocnik.
- This topic was modified 8 years ago by bojanpotocnik.
- This topic was modified 8 years ago by bojanpotocnik. Reason: I really don't get how to do proper code formatting
December 1, 2016 at 00:42 #9656supportKeymasterHi,
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.
-
AuthorPosts
- You must be logged in to reply to this topic.