This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problems allocating memory in main()


> //void cyg_user_start ( void) {
> int main () {
>   Cyg_Thread* lThread0; 
>   Cyg_Thread* lThread1;
>   char* lPing = "ping";
>   char* lPong = "pong";
>   char lStack0 [4096];
>   char lStack1 [4096]; // uncomment this line and it works


Think about where these two stacks are going? They are going on the
stack of main. eCos calls main with a small stack, probably 4K. You
are going off the end of the stack allocated to main and corrupting
what ever follows. You want to put the stacks somewhere else. 

        Andrew

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]