Hi,
I am using CMSIS RTOS on my project. This project also contains Keil HTTP server.
#define osFeature_MainThread 1 ///< main can be thread
then RTOS will starts main on startup/power on. I can debug it fine but when I power off then power on again. It does not startup
My code is here
int main (void) {
netInitialize (); netSYS_SetHostName (_net_name); netDHCP_Enable(0); netHTTPs_Start (); //osThreadCreate (osThread(RunLeds),&guileds);
osTimerId id; // timer id id = osTimerCreate (osTimer(RunLeds), osTimerPeriodic, &guileds); osTimerStart (id, 1); // start timer osThreadCreate (osThread(RunRelayThread), relay);
osThreadCreate (osThread(RunCommsThread), gwbuilder_);
// display_id = osThreadCreate (osThread(Display), NULL); /* Main terminates here - all other threads remain running */ while(1) { guileds.led(4)->set(); osDelay (1000); } }
Do I need to do
int main (void) { if (osKernelInitialize () != osOK) { // check osStatus for other possible valid values // init }
if (!osKernelRunning ()) { // is the kernel running ? if (osKernelStart () != osOK) { // start the kernel // kernel could not be started } } }
I can seen in debug that osKernelStart () get calls but return immediately. So I need infinite loop to make it running.
Kindly advise me my mistakes.
I found out I have to put delay of atleast 100ms before calling netInitialize then it works.
osDelay (100);
netInitialize (); netHTTPs_Start ();
while(1) { osDelay (1000); }
return 0; }