Hi,
I am trying to use the RTC of LPC2378 and the RTX kernel of KEIL.
The below is the code of one of my tasks.
void job3 (void) __task { while(1) { snprintf(FMTstring, 29, "%04d-%02d-%02d Y%03d-W%01d %02d:%02d:%02d\r", RTC_YEAR, RTC_MONTH, RTC_DOM, RTC_DOY, RTC_DOW, RTC_HOUR, RTC_MIN, RTC_SEC ); UART0sbWRITE( (BYTE *)FMTstring, 29 ); UART0sendKICK(); os_dly_wait (100); } }
I found that, I need to set the "Task stack size" to 348 bytes, otherwise I will get a stack overflow. Since I do not declare any variable in this task, why it needs so large stack?
A thread is what your OS calls a task. It runs concurrently with other threads in shared memory, i.e. all threads has a common set of global variables. This is very light-weight, which is the reason why RTOS in embedded environments implements threads. On the other hand, it means that the developer must be very careful when accessing common variables so one thread doesn't overwrite the output of another thread, or reads data that has been only half-way updated.
Hi Per,
Many thanks to your explanation.
Tasks/Threads of RTX kernel sounds different from what I heard about the threads on X86 platform. Looks like RTX's thread does not belong to any process.
Thread is also a mystery to me.
In this case, you don't have a GUI or command line to handle programs that ends or to send in parameters to main().
So in this case, you can see your application as a single process where the tasks are almost identical to the threads inside a process in Windows.