Skip to main content
Visitor II
July 3, 2024
Question

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

  • July 3, 2024
  • 2 replies
  • 1257 views

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

    This topic has been closed for replies.

    2 replies

    Super User
    July 3, 2024

    @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 ... ?

    Hjain.1Author
    Visitor II
    July 3, 2024

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

    Graduate II
    July 3, 2024

    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?