cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Hardfault when creating a local variable and not getting Hardfault when making the same variable Global

Hjain.1
Associate II

Hi,

Im using threadx, in that i have defined a task in which i initialize my external flash memory regions 
i have a 116 byte structure which contains memory information

when i use this structure locally i get a never execute hardfault error where as when i move that variable to global i dont get hardfault
please note that the stack size of task is 6200 bytes
Attaching screenshots

3 REPLIES 3
Andrew Neil
Evangelist III

@Hjain.1 wrote:

please note that the stack size of task is 6200 bytes


So have you tried increasing that - by at least 116 bytes ... ?

as you can see my stack is barely full only 2kb is used and yes i did try increasing it

What specifically is the nature of the Hard Fault, see registers, stack and instructions. 

If not a stack overflow, perhaps corruption or modifying out of bounds.

Failure at return?

Use for a DMA or IT routine and losing scope?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..