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:
www.keil.com/.../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,
Both things should be ok as in case you are suggesting stk2 is handled as address of stack also.
Anyways, "&stk2" is completely correct.
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.