Hello,
Got a problem with an app of mine. There are three tasks in it: The main task, a command processor called from the main task, and a dummy Hello World task, also called from main.
Priorities for the main, command processor, and dummy tasks are MAIN_PRIO, MP + 1, and MP+2, respectively.
My command processor stuff is taken almost exactly from the example, which ends in a while (1) OSTimeDly loop. With that in place, everything works, but the dummy task, which is created after the command processor is run, is obviously never started.
When I remove that while loop, it gets interesting. All tasks are started successfully. I can even connect to the telnet socket I opened with the command processor and enter a username and password for the authentication. But when I hit enter after the password prompt, I get the trap and access error.
I tried to look up the line with the m68k-elf-addr2line command and the program counter, but all I get is "??:0".
Any ideas? Am I missing something obvious here?
Thanks!
Christoph
trap occurred. access error
Re: trap occurred. access error
Not a whole lot of information here. Chances are you have over-run a task stack. Do you have large amounts of memory allocated locally in a stack or your functions (>500bytes). Where is your password being stored and is the array large enough? I would make sure smart traps is enabled. Then you should get a larger trap message and you can walk up the task stacks with addr2line. If this doesn't help try turning on UCOS_STACKCHECK in predef.h. You then must recompile the system files. Now you can use task scan or OSDumpTCBStacks to see how much space is free in your task stacks, and what the least free has been since boot. You may want to just try increasing your task stack sizes in constants.h.
Re: trap occurred. access error
Thanks for taking a shot at this despite the little information.
How big should a task stack be? I did this, just playing around and not really knowing what's up:
All the task does now is print Hello World. Could that cause it?
I'll also look at smart traps, thanks! The password stuff is all provided in the command processor by Netburner, so I assume it's working fine.
Christoph
How big should a task stack be? I did this, just playing around and not really knowing what's up:
Code: Select all
asm( " .align 4 " );
DWORD TaskStack[256] __attribute__( ( aligned( 4 ) ) );
I'll also look at smart traps, thanks! The password stuff is all provided in the command processor by Netburner, so I assume it's working fine.
Christoph
Re: trap occurred. access error
You might want to post some of the code around your main while(1) loop and the OSTaskCreate() calls. Are you creating separate task stacks for each task (you should be)? Is it possible you have an errant semi colon? Something like
that is keeping the tasks from getting any CPU time?
Code: Select all
while(1);
{
OSTimeDly(MAIN_LOOP_WAIT);
}
Re: trap occurred. access error
Hi,
You need a much bigger task stack then 1K. Just the printf will use more then 1K of your stack space. You can use the variable USER_TASK_STK_SIZE, which is set to be 2K... this is an 8K stack. You could also use the macro OSSimpleTaskCreate(), then the task stack is created for you automatically. This macro also uses the USER_TASK_STK_SIZE for ths stack size.
-Larry
You need a much bigger task stack then 1K. Just the printf will use more then 1K of your stack space. You can use the variable USER_TASK_STK_SIZE, which is set to be 2K... this is an 8K stack. You could also use the macro OSSimpleTaskCreate(), then the task stack is created for you automatically. This macro also uses the USER_TASK_STK_SIZE for ths stack size.
-Larry
Re: trap occurred. access error
That was it! Thank you so much!
I am used to smaller stacks. When I program in assembly on the HC12, I use a tiny stack since all that goes on it is back references from subroutines and register values when going into a subroutine. They are cleared pretty quick after.
Anyway, this did the trick. Appreciate it!
Christoph
I am used to smaller stacks. When I program in assembly on the HC12, I use a tiny stack since all that goes on it is back references from subroutines and register values when going into a subroutine. They are cleared pretty quick after.
Anyway, this did the trick. Appreciate it!
Christoph