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

Hardfault in memset during startup of Zigbee stack

Hi

Im trying to set up a project for development of a Zigbee / BLE based product. For that product, we use our own platform and SDK which includes the nordic nRF5 SDK for Thread and Zigbee. We use FreeRTOS in our platform, so therefore, I have chosen "examples/zigbee/experimental/multi_sensor_freertos" as a starting point for my application. 

We use our own build system, based on GNU Make, so therefore I have looked at the file "examples/zigbee/experimental/multi_sensor_freertos/pca10056/blank/armgcc/Makefile", and I have tried to get everything in there to match my own build.

The project compiles and starts, but during initialization of the Zigbee stack, I get a hardfault when using memset() in zb_init_configurable_mem(). 

I have tried to use memset() in main.c and it works as expected. Any ideas of what I have missed?

Thank you,

/Patrik

Parents Reply Children
  • Hi Patrik,

    Our Zigbee team have tried to reproduce the issue, but with no luck so far. They do have some questions that might help them solving it:

    • Do you experience this issue with other examples in our SDK?
    • Is this issue present in Zigbee-only configuration?
    • What toochain version are you using to compile this example? Is it gcc-arm-none-eabi-9-2020-q2?
    • What Zigbee role does the device have? (ZED/ZR)?
    • What memory config is used in your application? (zb_mem_config_min.h/med/max)?

    Best regards,

    Marte

  • Hi

    1. I tried example "examples/zigbee/light_control/light_bulb" and I get the same issue here. 
    2. What do you mean with "Zigbee-only"? I try to run the example "multi_sensor_freertos" and that example doesn't use multi-protocol if that is what you mean?
    3. Yes I use gcc-arm-none-eabi-9-2020-q2
    4. The example use role ZB_ED_ROLE
    5. The example use "#include "zb_mem_config_med.h"

    I use the example as is from the SDK. The difference is that:

    1. We use our own build system to compile and link

    2. We use our version of FreeRTOS. This should be an unmodified FreeRTOS-Kernel 10.4.2 version

    This is probably some stupid mistake on my side. I just can't figure out what. Maybe im missing some compile or link file. Or maybe some define in the Makefile that I have missed. 

    Regards,

    Patrik

  • Hi Patrik,

    Thank you, I have forwarded this information to our Zigbee team. As for the second question, I believe they meant without multiprotocol, and possibly without FreeRTOS as well. If you tried the light bulb example without making any changes to it, then that would be without FreeRTOS, so knowing that you got the same issue there is very helpful.

    Best regards,

    Marte

  • Hi Patrik,

    The Zigbee team is still trying to figure this out. Could you please share which linker you're using, and whether you're using other compiler or linker options than what is already present in the example in the SDK?

    Best regards,

    Marte

  • Hi

    We are using the this toolchain: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads/9-2020-q2-update

    The linker script is "zigbee_multi_sensor_freertos_gcc_nrf52.ld". One note about the linker script, is that I was not able to include the nrf_common.ld file. Then I get the following:

    c:/mbs/work/rf-network/mbstoolchains/gcc-arm-none-eabi-9-2020-q2/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file nrf_common.ld: No such file or directory
    collect2.exe: error: ld returned 1 exit status
    make: *** [/cygdrive/c/mbs/work/rf-network/products/multi_sensor_freertos2/abs-binary.mk:22: _output/products-multi_sensor_freertos2/NRF52_GCC-none-none-mbs_nrf_52840_v10/products-multi_sensor_freertos2.elf] Error 1

    Instead I copied the contents of the file where the include was. 

    I have tried to experiment with the compiler and linker options, but unmodified, this is what we use in our platform:

    CFLAGS:

    -mthumb \
    -mcpu=cortex-m4 \
    -ffunction-sections \
    -fdata-sections \
    -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
    -ggdb3 \
    -std=gnu11 \
    -O0

    LDFLAGS:

    -mthumb \
    -mcpu=cortex-m4 \
    -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
    -lc -lm \
    --specs=nano.specs \
    -Wl,--gc-sections \
    -ggdb3

    /Patrik

Related