On Sat, 13 Dec 2003 17:50:54 +0100, Matthias Weingart wrote:

I like it. It's quite simple. But another question, is it enough to push
just R4 to R11? The mspgcc users manual says that R12 to R15 are "clobbered"
registers. Can I use R12 to R15 for my own special purpose?

How do you determine the stack space needed for each task? Can gcc list a
function call tree (show what function is calling what function), and the
stack space that is needed by each function? With no recursive calls
this should be possible at compile time. Add the space needed for the
interrupts and you have the worst case stack size.

-------------------------------------------------------

Because swap() is a function call, the function that calls it must save
R12-R15 if it wants to use tham after the call.  They might be 'clobbered'
by the called function.

One of the things I do is mark the task stacks in main() before starting the
tasker. After running the system for a while I can then examine the stack
space a see how much was used.  Before 'closing' the project, I usually
remove that piece of code.

-Bill

  int i;
  void *stacks[TASK_STACK_SIZE];        // stack space for tasks 

  // mark the task stack space
  for (i = 0; i < TASK_STACK_SIZE; i++)
    stacks[i] = (void *)0xDEADBEEF;

  t0ID = initTasking();                 // initialize the tasker



Reply via email to