We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, All I tried to use http web service on MCB1800 eval board with RTX multi-tasking configuration, and found that init_TcpNet() never return if I call it in a task, the following is my code which I followed rtx example codehttp://www.keil.com/support/man/docs/rlarm/rlarm_tn_using_withkernel.htm I set breakpoints on init_TcpNet and it never returns, if I call it on main(), it worked. Any help will be appreciated. Thanks!
__task void tcp_tick (void) { os_itv_set (10); while (1) { os_itv_wait (); /* Timer tick every 1000 ms */ timer_tick (); } } __task void tcp_main (void) { while (1) { main_TcpNet (); os_tsk_pass (); } } __task void Httptcp_init (void) { //system_init (); init_TcpNet (); os_tsk_create (tcp_tick, 2); os_tsk_create_user (tcp_main, 1, Task1_Stack, sizeof(Task1_Stack)); /* Init done, terminate this task. */ os_tsk_delete_self (); } int main (void) { os_sys_init (Httptcp_init); }
Yes, OS_RUNPRIV is 0 by default, after I set it to 1, it works! So do I need to disable it after calling init_TcpNet()? Thanks a lot, have puzzled me for last few days.
Code structure is up to you...
I would create a routine that would handle all inits prior to calling os_sys_init().
ie:
void main(void) { // Routine executes in priv mode PMInit(); // spinup tasks (unpriv mode) os_sys_init(); } // This routine executes in priv mode void PMInit(void) { // Hardware inits... // Task-specific inits... Task1Init(); Task2Init(); init_TCPNet(); // etc.... }
Again, it is you choice on HOW. Personally, I would leave OS_RUNPRIV alone unless you NEED all tasks to run in priv mode.
Just to clarify my last post. The task-specific inits are for any priv mode chores that need to be done prior to task creation (the tasks have not yet been created, obviously).
For example, within Task1Init() could be the call to init_TCPNet() if that task will handle any TCPNet related processing. Sorry if there was any confusion, as I was not really clear on that point.
Thanks for clarification, I understand what you saying. For now, I will probably run on privillege mode since we are going to need update the system once a while.