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

Wrong initialization value in static variables

Hi,

I'm developing a node based on the nRF52840-QIAA rev. B.

I'm using Eclipse Neon and GCC-toolchain for coding. Softdevice is S140 5.0.0.2 alpha and SDK is V14.2.

For Debugging I'm using an PCA10056 (nRF52840 PDK).

I'm always running into Error as soon as i try to interact with the softdevice. For example when calling nrf_sdh_enable_request().

While Debugging I've noticed that static variables like m_nrf_sdh_enabled (which is of type bool) don't seem to get initialized correctly.

Instead of "false", the value is an integer value. Depending on the configurations in sdk_config.h or the settings in the linker script for RAM start adress, this value changes.

Is this a Problem with the settings in linker script or what could it be?

Note: I'm using the default linkerscript provided in the examples library from ble_peripheral/ble_app_template 

Thanks for your help and advises!

Dominic

Parents
  • All static variables are located in .bss segment. By default in startup code you should erase .bss section of RAM before code start.

    FALSE value equal to 0, so I suppose your startup code has wrong init sequence. Please set the breakpoint at Reset_Handler address and check if _bss_start__ and __bss_end__ have the correct value. Also in .map file address of m_nrf_sdh_enabled shoul be between these values.

  • Hi ekrashtan,

    I tried to check your hints but when I set a breakpoint in the startup-file at the very beginning of the Reset_Handler, then this Breakpoint is never hit.

    Some lines below the Reset_Handler I saw this comment in the startup code:

    /* Call _start function provided by libraries.
     * If those libraries are not accessible, define __START as your entry point.
     */

    Could this be a Problem, if i don't set this correctly?

    __bss_start__ is at 0x200021fc

    __bss_end__ is at 0x200035dc

    m_nrf_sdh_enabled is at 0x20003368

    So this variable is located between bss_start and bss_end.

    RAM ORIGIN is set to 0x20002088 in linkerscript, as the correct address could only be known after the first enable of the softdevice as far as i know. This setting is made according to the ble_app_template from the sdk.

    Best regards 

    Dominic

Reply
  • Hi ekrashtan,

    I tried to check your hints but when I set a breakpoint in the startup-file at the very beginning of the Reset_Handler, then this Breakpoint is never hit.

    Some lines below the Reset_Handler I saw this comment in the startup code:

    /* Call _start function provided by libraries.
     * If those libraries are not accessible, define __START as your entry point.
     */

    Could this be a Problem, if i don't set this correctly?

    __bss_start__ is at 0x200021fc

    __bss_end__ is at 0x200035dc

    m_nrf_sdh_enabled is at 0x20003368

    So this variable is located between bss_start and bss_end.

    RAM ORIGIN is set to 0x20002088 in linkerscript, as the correct address could only be known after the first enable of the softdevice as far as i know. This setting is made according to the ble_app_template from the sdk.

    Best regards 

    Dominic

Children
No Data
Related