Re: [Mspgcc-users] Stack checking

2011-08-29 Thread Grant Edwards
On 2011-08-29, JMGross wrote: >> I've been reading this thread for a while and it >> makes me wonder if there is some kind of tool >> which can analyze the code and determine the >> stack usage? I think this may be a safer route >> than to depend on a real-time stack check. The >> big questi

Re: [Mspgcc-users] Stack checking

2011-08-29 Thread N. Coesel
At 13:05 29-8-2011, JMGross wrote: >- Ursprüngliche Nachricht - >Von: N. Coesel >Gesendet am: 26 Aug 2011 13:26:47 > > > I've been reading this thread for a while and it > > makes me wonder if there is some kind of tool > > which can analyze the code and determine the > > stack usage? I thi

Re: [Mspgcc-users] Stack checking

2011-08-29 Thread JMGross
- Ursprüngliche Nachricht - Von: N. Coesel Gesendet am: 26 Aug 2011 13:26:47 > I've been reading this thread for a while and it > makes me wonder if there is some kind of tool > which can analyze the code and determine the > stack usage? I think this may be a safer route > than to

Re: [Mspgcc-users] Stack checking

2011-08-26 Thread Radu Rendec
On Fri, 2011-08-26 at 13:12 +0200, JMGross wrote: > If the local array is still on the stack, the task switch code will detect > that the SP is out-of-bounds and act as if the guard code were > overwritten. (In my implementation, it will not detect which other > thread might have been affected, if

Re: [Mspgcc-users] Stack checking

2011-08-26 Thread Radu Rendec
On Fri, 2011-08-26 at 13:26 +0200, N. Coesel wrote: > I've been reading this thread for a while and it > makes me wonder if there is some kind of tool > which can analyze the code and determine the > stack usage? I think this may be a safer route > than to depend on a real-time stack check. The

Re: [Mspgcc-users] Stack checking

2011-08-26 Thread N. Coesel
At 13:12 26-8-2011, JMGross wrote: >- Ursprüngliche Nachricht - >Von: Radu Rendec >Gesendet am: 25 Aug 2011 23:28:02 > > > I have only one question, though. Suppose you have a function that > > allocates let's say 40 bytes on the stack. An example could be declaring > > "char foo[40]" as a

Re: [Mspgcc-users] Stack checking

2011-08-26 Thread JMGross
- Ursprüngliche Nachricht - Von: Radu Rendec Gesendet am: 25 Aug 2011 23:28:02 > I have only one question, though. Suppose you have a function that > allocates let's say 40 bytes on the stack. An example could be declaring > "char foo[40]" as a local variable. Let's say R1/SP is only a fe

Re: [Mspgcc-users] Stack checking

2011-08-25 Thread Radu Rendec
On Thu, 2011-08-25 at 12:21 +0200, JMGross wrote: > I had a similar problem but came up with a completely different solution. > When my (preemptive) multitasker creates a new thread, it reserves some > organizational space as well as the stack for the new > thread. > The orignaizational data is a

Re: [Mspgcc-users] Stack checking

2011-08-25 Thread Radu Rendec
On Wed, 2011-08-24 at 16:05 -0500, Peter Bigot wrote: > Look at msp430-builtins.c in the implementation for delay cycles for > examples of generating local labels, comparison, and jump > instructions. You can probably use something like gen_rtx_MEM (Pmode, > gen_rtx_SYMBOL_REF (HImode, "__stack_ba

Re: [Mspgcc-users] Stack checking

2011-08-25 Thread JMGross
- Ursprüngliche Nachricht - Von: Radu Rendec Gesendet am: 24 Aug 2011 22:27:32 > I'm trying to implement a simple stack checking mechanism in an MSP430 > multi-task environment (task scheduling/switching is subject to a custom > "OS"). > Each task has its own stack space, but since there'

Re: [Mspgcc-users] Stack checking

2011-08-24 Thread Peter Bigot
Look at msp430-builtins.c in the implementation for delay cycles for examples of generating local labels, comparison, and jump instructions. You can probably use something like gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (HImode, "__stack_base")) and use that to compare against stack_pointer_rtx rather

[Mspgcc-users] Stack checking

2011-08-24 Thread Radu Rendec
Hello, I'm trying to implement a simple stack checking mechanism in an MSP430 multi-task environment (task scheduling/switching is subject to a custom "OS"). Each task has its own stack space, but since there's a single address space and the memory is small, tasks can easily overflow their stack