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

Peer manager leading to hard fault with -Os flag with GCC 5

FormerMember
FormerMember

HI all,

We've recently moved to SDK 11.0 and it certainly has not been a painless migration, especially when using GCC.

Setup: GCC 5.2.1 on Linux Mint with nrf51 xxAA on a custom board

So, When using the peer manager, I'm not able to run with -Os flag with GCC, it gets into hard fault somewhere. Its fine with O1 or O2. I'm guessing some memory isn't allocated in an aligned manner. Please help me solve this as we prefer using Os as its lighter on the OTA update.

I had a similar problem where the following statement caused hard fault

if (p_page_addr[FDS_PAGE_TAG_WORD_0] != FDS_PAGE_TAG_MAGIC)

which is line number 183 in fds.c. This got resolved when I copied that this part of linker script from another post in Devzone

SECTIONS
{
  .fs_data :
  {
    . = ALIGN(4);
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
    . = ALIGN(4);
     __data_end__ = .;
  } > RAM
} INSERT AFTER .data;

Also things like the linker script being faulty in the SoftDevice section of the SDK makes ,me feel that again GCC is being treated as a second class citizen. There is not enough testing and verification with GCC before releasing the SDK.

Thanks!

Parents
  • "I'm guessing some memory isn't allocated in an aligned manner. Please help me solve this as we prefer using Os as its lighter on the OTA update."

    Guessing doesn't help. How can someone solve a random hardfault you have without proper details? Hardfaults are possible to track back, so get the stack trace and work out where the hardfault occurred and why, then someone may be able to suggest something.

    As to your general complaints about GCC support, Nordic at least provides support for GCC, but internally they're really a Keil shop so it's going to get less testing and it's going to have some issues. A lot of those get resolved by the community here and are rolled back into the SDK. That's the cost of using free tools.

    The fix for the linker script was put into the released SDK11.0, are you sure you're using the right SDK?

Reply
  • "I'm guessing some memory isn't allocated in an aligned manner. Please help me solve this as we prefer using Os as its lighter on the OTA update."

    Guessing doesn't help. How can someone solve a random hardfault you have without proper details? Hardfaults are possible to track back, so get the stack trace and work out where the hardfault occurred and why, then someone may be able to suggest something.

    As to your general complaints about GCC support, Nordic at least provides support for GCC, but internally they're really a Keil shop so it's going to get less testing and it's going to have some issues. A lot of those get resolved by the community here and are rolled back into the SDK. That's the cost of using free tools.

    The fix for the linker script was put into the released SDK11.0, are you sure you're using the right SDK?

Children
No Data
Related