Keil Logo Arm Logo

Discussion Forum

RTX os_tsk_create_user() ?

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

Details Message
Read-Only
Author
Bobby Ng
Posted
13-Jan-2010 05:57 GMT
Toolset
ARM
New! RTX os_tsk_create_user() ?

Hello,

I'm using the RTX for CM3 and need to create a task with my own defined stack size using os_tsk_create_user(). Below code is quote from RTX manual:

http://www.keil.com/support/man/docs/rlarm/rlarm_os_tsk_create_user.htm

OS_TID os_tsk_create_user(
    void (*task)(void),    /* Task to create */
    U8    priority,        /* Task priority (1-254) */
    void* stk,             /* Pointer to the task's stack */
    U16   size );          /* Number of bytes in the stack */



The stk argument is a pointer to the memory block reserved for the stack of this task.

And and example below:

OS_TID tsk1,tsk2;
static U64 stk2[400/8];

__task void task1 (void) {
   ..
  /* Create task 2 with a bigger stack */
  tsk2 = os_tsk_create_user (task2, 1, &stk2, sizeof(stk2));
   ..
}

I think it should be:

tsk2 = os_tsk_create_user (task2, 1, stk2, sizeof(stk2));

Am I wrong?

Thank you in advance for your answer.

Best regards,

Read-Only
Author
while (1);
Posted
13-Jan-2010 06:20 GMT
Toolset
ARM
New! RE: RTX os_tsk_create_user() ?

Both things should be ok as in case you are suggesting stk2 is handled as address of stack also.

Anyways, "&stk2" is completely correct.

Read-Only
Author
Per Westermark
Posted
13-Jan-2010 06:22 GMT
Toolset
ARM
New! RE: RTX os_tsk_create_user() ?

Both alternatives are correct.

Their alternative is a pointer to an array of U64. Your alternative is a pointer to one U64 - the first element.

In the end, both alternatives work, since they give the same address.

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

arm-logo-small

Keil logo
Important information

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