Adding just one more static variable (no matter where) crashes the program

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EyGe_3183606
Level 4
Level 4
25 replies posted 10 sign-ins 10 replies posted

Hi,

We have CYBLE-224110-00 (PSOC 4).

We have a serious issue with our project.

We are working with the fixed stack bootloader project.

We reached a situation that when we add just one more static variable to the bootloadable code (doesn't matter which file/function/name), then things begin to fall apart when the bootloadable is running. The program manages to run but at various and consistent cases we can cause it to crash. If we remove the static variable then everything works fine in the same scenarios.

It's as if there is a memory issue of some kind.

We tried to increase/decrease heap and stack sizes in the code (based on what's written here: How to change Stack/Heap sizes of FIXED STACK BOOTLOADER project?

but changing them in either direction does not change the situation. Just to clarify, before we even attempted to change the heap and the stack, PSOC Creator indicated that our RAM utilization is at 93% and ROM utilization is at 99.3%.

We are basically stuck without the ability to understand what is the problem and how to fix it.

Any help would be appreciated.

Thanks,

David

0 Likes
1 Solution

I managed to find the source of the problem.

The problem was due to a stack overflow during run time upon activation of a certain function.

We identified the route cause of the overflow - a large array was defined within the function --> so we simply reduced its size and it resolved our problem.

We identified the stack overflow using the code examples provided by Cypress as part of a "test package" they provided here:

https://www.cypress.com/documentation/application-notes/an89056-psoc-4-iec-60730-class-b-and-iec-615...

I recommend to use this test package and integrate it into ANY cypress code since this is a fantastic way to perform sanity/stability tests to your system.

View solution in original post

0 Likes
2 Replies