I am facing a problem in an application (MDK4.23) I have written for my LM4F232 board.
I have a function which defines a struct variable. This function(parent) in turn calls another function(child) within which a malloc is being done. For some reason the mallc ed memory and the address of the struct variable are close to each other.
So when I initialize my malloced memory I in turn lose the contents of the struct variable from the parent function (which calls the child).
Does anyone have any idea why this happens. Is there something I am not taking care off in my scatter file which is causing this.
I think stack and heap are sometimes allocated on a single block of memory with half being used by each and each of the memories growing outwards. Does anyone know how to allocate this stack/heap memory using the scatter file. A sample scatter file for the same would be much appreciated.
My present scatter file is this :
LR_IROM 0x00000000 0x00040000
{
;
; Specify the Execution Address of the code and the size.
;
ER_IROM 0x00000000 0x00040000
{
*.o (RESET, +First)
* (InRoot$$Sections, +RO)
}
;
; Specify the Execution Address of the data area.
;
RW_IRAM 0x20000000 0x00008000
{
;
; Uncomment the following line in order to use IntRegister().
;
;* (vtable, +First)
* (+RW, +ZI)
}
}
Thanks.