Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
762 Views

Trying to understand MicroC/OS-II

Hello i have a NEEK Board and i've runned web server example with sucess. 

However now i want to do other stuffs in my program, like a PIO read. 

 

i don't know how can i do it, i took a look at the webserver.c code and it's like that 

 

int main (int argc, char* argv, char* envp) { /* Initialize the current flash block, for flash programming. */ current_flash_block = -1; INT8U error_code; /* Clear the RTOS timer */ OSTimeSet(0); /* WSInitialTask will initialize the NicheStack TCP/IP Stack and then * initialize the rest of the web server's tasks. */ error_code = OSTaskCreateExt(WSInitialTask, NULL, (void *)&WSInitialTaskStk, WS_INITIAL_TASK_PRIO, WS_INITIAL_TASK_PRIO, WSInitialTaskStk, TASK_STACKSIZE, NULL, 0); alt_uCOSIIErrorHandler(error_code, 0); /* * As with all MicroC/OS-II designs, once the initial thread(s) and * associated RTOS resources are declared, we start the RTOS. That's it! */ OSStart(); while(1); /* Correct Program Flow never gets here. */ return -1; } 

 

Where should my C code go? Before OSStart? Is the ethernet set up and running before it? How can i manipulate it? I can't see OSStart function in the code. 

 

I've already programmed a lot in pure C for NIOS2 and uCLinux but never with uCOS, any tips from where i should begin?
0 Kudos
2 Replies
Highlighted
Valued Contributor III
4 Views

You might want to look inside WSInitialTask function and try a simpler uC-OSII example, like "hello_ucosii". :-) 

 

Cheers! 

 

slacker
0 Kudos
Highlighted
Valued Contributor III
4 Views

Hi aprado 

you should check "WSInitialTask" thread as slacker written but answer of your question 

 

"Where should my C code go? Before OSStart? Is the ethernet set up and running before it? How can i manipulate it? I can't see OSStart function in the code." 

Before OS start it is initialize the Hardware but it is not running Ethernet setup for communication if you want to use Ethernet and using InterNiche Stack then you should use netmain() function after OSStart(); in other task this function initialize Ethernet  

You can find OSStart code in you BSP package in ucos folder. 

 

Cheers, 

Meet shah
0 Kudos