This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Determining stack overflow by writing to a stack in a startup file

I'm trying to detect stack overflow. One approach that I found online was to prefill the memory with a constant value before the program runs, and see how much of the stack has been overwritten.

So now that I've been looking into it:

  • is ses_startup_common.s the startup file that initializes the RAM and calls main? (seems to be but making sure)
  • STACK_INIT_VAL contains the address of the stack pointer when the program starts, yes? What's
    __RAM1_segment_end__ equal to?
  • how do we go about filling the stack memory with some value? is it mainly loading the value into a general purpose register i.e R2?

Thanks

Related