[ECOS] Problems allocating memory in main()

Andrew Lunn andrew.lunn@ascom.ch
Mon Oct 9 03:15:00 GMT 2000


> //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


More information about the Ecos-discuss mailing list