Hi,

[EMAIL PROTECTED] schrieb:
> [ beware -- list-crosspost ]
> 
> it seems that at least some of the instability that i've been
> seeing is that the interrupt routines (and/or some of the
> routines they call) weren't reentrant, when i thought they would

Could the cause of this "instability" be related to stack overflow?

Does a "stack cookie" remain untouched? you could check like this:



-------8<-------------------------------------------
#define STACK_COOKIE (0xabcd)

static volatile unsigned int irq_count;

void init_this(){}
void init_that(){}

bit do_this(){ return 1; }
bit do_that(){ return 0; }


bit all_up_and_well()
{
     return STACK_COOKIE == *(unsigned int __idata *)0x7e;
}


void core_dump(){}


void irq_routine1(void) __interrupt (1)
{
     irq_count++;
     irq_count %= 1024;
}


void main(void)
{
     *(unsigned int __idata *)0x7e = STACK_COOKIE; // place cookie near or at 
top of stack

     init_this();
     init_that();

     while(1)
     {
         do_this();
         do_that();

         if( !all_up_and_well() )
             core_dump();
     }
}
------->8-------------------------------------------

Which kind of "instability" do you observe?


Greetings,
Frieder


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to