Stack Overflow Issues with CY8C4245AXI-483 Bootloader Implementation on ESP32

pankaj8at
Posts: 2
Joined: Wed Apr 17, 2024 6:38 am

Stack Overflow Issues with CY8C4245AXI-483 Bootloader Implementation on ESP32

Postby pankaj8at » Wed Apr 17, 2024 6:43 am

Hello Community,

I am currently working on a project involving the CY8C4245AXI-483 microcontroller where I have developed a bootloadable and a custom bootloader. For the bootloader host, I am utilizing the host code provided by Infineon, adapted to run on an ESP32.

Issue Summary:
I am encountering intermittent stack overflow issues during operation. The problem seems to be exacerbated by deep function calls within the bootloader code. Despite efforts to manage and optimize the code structure, the issue persists, affecting the stability and reliability of the bootloader operation.

Technical Details:

Microcontroller Used: CY8C4245AXI-483
Additional Hardware: ESP32 for implementing the bootloader host

Observations:
The issue occurs intermittently, particularly under conditions of heavy load or specific operational scenarios.
Deeply nested function calls appear to be a contributing factor.
Adjustments to stack size and optimizations in recursion have been partially successful.

Attempts to Resolve:
Refactoring recursive functions to iterative ones where possible.
Reducing the number of local variables in deeply nested functions.

Attachments:
Debug logs capturing the incidents of stack overflow.
Code snippets of the bootloader functions with deep calls.

Best regards,
Attachments
btldr_cyp_esp.zip
(78.97 KiB) Downloaded 54 times

ESP_Sprite
Posts: 9729
Joined: Thu Nov 26, 2015 4:08 am

Re: Stack Overflow Issues with CY8C4245AXI-483 Bootloader Implementation on ESP32

Postby ESP_Sprite » Wed Apr 17, 2024 6:49 am

I don't see the debug log, it would be helpful to see where the stack overflow happens and to have a backtrace of that.

Also: what stack did you increase? In your sdkconfig, the main stack (which calls into the bootloader stuff) only is allocated 3584 bytes. I'd suggest using menuconfig to increase that by a lot, to 16K or something, and see if the issue still shows up.

pankaj8at
Posts: 2
Joined: Wed Apr 17, 2024 6:38 am

Re: Stack Overflow Issues with CY8C4245AXI-483 Bootloader Implementation on ESP32

Postby pankaj8at » Wed Apr 17, 2024 12:24 pm

Hi, I've attached the log file of the project i've shared previously with you. And No I havn't tried increasing the stackl size, but ill try it now and will update you for the same.

Thanks and Regards,
Pankaj Singh
Attachments
esp_cyp_bootloader_logs.txt
(5.25 KiB) Downloaded 49 times

Who is online

Users browsing this forum: No registered users and 62 guests