Keil Logo Arm Logo

Problem with os_dly_wait() and printf()

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Alexei Roudometkine
Posted
10-Oct-2006 21:52 GMT
Toolset
ARM
New! Problem with os_dly_wait() and printf()

Hello,

I'm using LPC2119 microcontroller and RV30 with RTX and ran into several problems.

1) If I use printf(...) inside tasks and use os_dly_wait(...) then as soon as context switching occurs then os_stack_overflow() is called. I tried to set up different stack sizes inside startup.s file but it didn't help a bit. I tried to run the same code inside simulator and it works OK without any stack overflow (which I was getting if I didn't include tsk_lock() and tsk_unlock() around printf(...))

2) If I get rid of os_dly_wait(...) calls and have two tasks running, then if I use printf with this kind of code:

int test = 10;
tsk_lock();
printf("test value: %u\n", test);
tsk_unlock();

Then the task, which ran that line of code, will get stuck including not context switching. I didn't get any stack overflows that time but it looks like it gets stuck when it tried to do a context switching. If, on the other hand, I put code like that:

tsk_lock();
printf("test value: %s\n", "just some test");
tsk_unlock();

Then it switches just fine. Thanks in advance with any suggestions or explanations, Alexei

Read-Only
Author
Robert McNamara
Posted
11-Oct-2006 18:12 GMT
Toolset
ARM
New! RE: Problem with os_dly_wait() and printf()

I certainly does sound like a stack issue. None of the stacks defined in "startup.s" are what the task that RL-ARM (the RTX-Kernel) will use for your tasks. You specify what stack you want to use when you create the task. It can be a "default" stack, which will do an alloc_box from a box created in RTX_CONFIG.c The alloc box can fail and give a null pointer for your stack. You may also pass the stack in to os_task_create_user_ex. Since the stack overflow check is only done on a contex switch, I would guess you have a stack size of 0.

Read-Only
Author
Alexei Roudometkine
Posted
12-Oct-2006 04:55 GMT
Toolset
ARM
New! RE: Problem with os_dly_wait() and printf()

Thank you! It really helped. That was the root of the problem.

Once again thank you :-)

Alexei

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.