MPU Fault on Downloader library although stack size is configured at maximum

I am trying to use the AWS FOTA library. It correctly downloads the image at 100% but always ends with a MPU Fault on the downloader thread.

I set the stack size at the maximum value (CONFIG_DOWNLOADER_STACK_SIZE=8192) and it doesn't solve the issue.

[00:03:24.600,708] <inf> downloader: Downloaded 430848/430959 bytes (99%)
[00:03:25.757,324] <wrn> modem_cmux: Frame FCS error
[00:03:25.757,354] <wrn> modem_cmux: Dropped frame
[00:03:27.200,286] <dbg> net_if: net_if_tx: (rx_q[0]): Processing (pkt 0x200345fc, prio 0) network packet iface 1 (0x200038ec)
[00:03:27.200,408] <dbg> net_sock: zsock_received_cb: (rx_q[0]): ctx=0x20009308, pkt=0x2003497c, st=0, user_data=0
[00:03:27.201,324] <inf> downloader: Downloaded 430959/430959 bytes (100%)
[00:03:27.201,354] <inf> downloader: Download complete
[00:03:27.201,416] <dbg> net_sock: zsock_close_ctx: (downloader): close: ctx=0x20009308, fd=4
[00:03:27.201,751] <dbg> net_if: net_if_tx: (downloader): Processing (pkt 0x200345bc, prio 0) network packet iface 1 (0x200038ec)
[00:03:27.290,161] <inf> dfu_target_mcuboot: MCUBoot image-0 upgrade scheduled. Reset device to apply
[00:03:27.290,161] <dbg> aws_fota: http_fota_handler: FOTA_DOWNLOAD_EVT_FINISHED
[00:03:27.290,191] <dbg> aws_iot: aws_fota_cb_handler: AWS_FOTA_EVT_DL_PROGRESS, (100%)
[00:03:27.290,191] <inf> aws_iot_sample: AWS_IOT_EVT_FOTA_DL_PROGRESS, (100%)
[00:03:27.290,252] <dbg> aws_fota: update_job_execution: update_job_execution, status: 2, version_number: 2
[00:03:27.290,405] <dbg> net_mqtt: mqtt_publish: (downloader): [CID 0x2000b574]:[State 0x06]: >> Topic size 0x0000002b, Data size 0x00000055
[00:03:27.290,466] <err> os: ***** MPU FAULT *****
[00:03:27.290,466] <err> os:   Stacking error (context area might be not valid)
[00:03:27.290,466] <err> os:   Data Access Violation
[00:03:27.290,496] <err> os:   MMFAR Address: 0x20003df0
[00:03:27.290,496] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000000
[00:03:27.290,527] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x00000000
[00:03:27.290,527] <err> os:  xpsr:  0x00000000
[00:03:27.290,557] <err> os: Faulting instruction address (r15/pc): 0x00000000
[00:03:27.290,588] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00:03:27.290,618] <err> os: Current thread: 0x20003cf0 (downloader)
[00:03:27.539,947] <err> os: Halting system

Please help.

Full code: https://github.com/olalonde/ncs-l9-e7/tree/modem-port

I also tried chaning the downloader Kconfig to allow a larger stack size but that didn't solve the issue.

Parents
  • Hello,

    I find it a bit surprising that all the stacked registers are zeroed. If the stack content is corrupted due to an overflow, it usually leads to more arbitrary values. It's also interesting that this occurs after the download is complete. Could you please try to debug this in Segger Ozone and set a data breakpoint at the MMFAR Address and see if you are able to catch the write that triggered the stack guard?

    Segger Ozone should appear here if installed:

    Best regards,

    Vidar

Reply
  • Hello,

    I find it a bit surprising that all the stacked registers are zeroed. If the stack content is corrupted due to an overflow, it usually leads to more arbitrary values. It's also interesting that this occurs after the download is complete. Could you please try to debug this in Segger Ozone and set a data breakpoint at the MMFAR Address and see if you are able to catch the write that triggered the stack guard?

    Segger Ozone should appear here if installed:

    Best regards,

    Vidar

Children
No Data
Related