apache / apache/nuttx

Stack overflow with apps on imxrt1064-evk:netnsh

Open
#4,084 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

Hello everyone,

I recently started hacking on a i.MX RT 1064 EVK board with NuttX (board support is not yet in any stable release, only on master branch) and I ported a very simple app running a Microsoft Azure IoT Hub Demo Example. (The library itself is inside Azure IoT Repo, for reference [here](https://github.com/Azure/azure-iot-sdk-c)

NuttX NSH shell is reporting an hard fault and the application is crashing after launched (I also step-by-step debugged it but apart from the crash there is really nothing wrong with the code...)

Please find attached here the trace:

```
nsh> Hello, from **** IoT Client Applicatioarm_hardfault: PANIC!!! Hard fault: 40000000
up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 135 task:
up_registerdump: R0: 20218b70 202102c8 f83a9851 bff9f07b 7004aee1 00000000 00000000 202199b8
up_registerdump: R8: 00000000 00000000 00000000 00000000 0000000d 202199b8 700250e9 700093e4
up_registerdump: xPSR: a1000000 BASEPRI: 00000080 CONTROL: 00000000
up_registerdump: EXC_RETURN: ffffffe9
up_dumpstate: sp: 20219828
up_dumpstate: stack base: 00000014
up_dumpstate: stack size: 04000000
up_dumpstate: ERROR: Stack pointer is not within the allocated stack
```

What is bugging me in this report is the stack pointer relative to stack base address and size. I understand that the panic is triggered because sp is outside stack bounded region, (00000014+ 04000000 is always outside 20200000).

In this board, on-chip RAM addresses start at 0x20200000 so, in principle, stack should be below those address and not starting from 0, to respect the alignment (and the size).

Do you think that there is something wrong in the linker script file on in the BSP for this particular board?
I can submit a PR if someone can hint me where to look for fixing the issue.

(Smaller standard programs like ping work fine, so I really do not understand if it is my executable or a system bug).

For reference, please find attached the `.config` file here

[config.txt](https://github.com/apache/incubator-nuttx/files/6771068/config.txt)

Any suggestion?

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.