-->
Page 1 of 4

is possible to use FreeRTOS in ESP8266 Arduino 1.6.5-947

PostPosted: Wed Mar 16, 2016 2:22 pm
by madokapeng
Hi all.

I am using ESP8266 Arduino IDE currently.
..\arduino15\esp8266\1.6.5-947-g39819f0\cores\esp8266 contains all the header files. basically, core_esp8266_main.c calls setup() and loop().
This is using espressif native SDK API which is at ..\arduino15\esp8266\1.6.5-947-g39819f0\tools\sdk\include

This epsressif SDK is nonRTOS SDK. it is not using FreeRTOS. It means the application has a single background polling loop which is not very good. I would prefer to use FreeRTOS.

anyone has change from nonRTOS to RTOS SDK???
Please give a guide how to use FreeRTOS with ESP8266 Arduino IDE.

or it is impossible to use both FreeRTOS SDK with ESP8266 Arduino IDE.

Thanks in advance.

Re: is possible to use FreeRTOS in ESP8266 Arduino 1.6.5-947

PostPosted: Thu Mar 17, 2016 1:02 pm
by madokapeng
any ideas? please advise

Thanks in advance.

Re: is possible to use FreeRTOS in ESP8266 Arduino 1.6.5-947

PostPosted: Thu Mar 17, 2016 6:10 pm
by mrburnette
[url][/url]I thought RTOS was already linked into the Arduino build to perform the task switching magic.... can be forced with delay(0) or yield().

https://raw.githubusercontent.com/esp8266/Arduino/master/tools/sdk/include/os_type.h
Code: Select all*
 * copyright (c) Espressif System 2010
 *
 * mapping to ETS structures
 *
 */
#ifndef _OS_TYPES_H_
#define _OS_TYPES_H_

#include "ets_sys.h"

#define os_signal_t ETSSignal
#define os_param_t  ETSParam
#define os_event_t ETSEvent
#define os_task_t ETSTask
#define os_timer_t  ETSTimer
#define os_timer_func_t ETSTimerFunc

#endif


The relevant PDF on RTOS SDK
Snippet:
Code: Select all// Non-OS SDK: creating a new task
#define Q_NUM (10)
ETSEvent test_q[Q_NUM];
void test_task(ETSEvent *e)
{
 switch(e->sig)
 {
 case 1:
 func1(e->par);
 break;
 case 2:
 func2();
 break;
 case 3:
 func3();
 break;
 default:
 break;
 }
}
void func_send_Sig(void)
{
 ETSSignal sig = 2;
 system_os_post(2,sig,0);
}
void task_ini(void)
{
system_os_task(test_task, 2, test_q,Q_NUM);
// test_q is the corresponding array of test_task.
// (2) is the priority of test_task.
// Q_NUM is the queue length of test_task.
}


Ray

Re: is possible to use FreeRTOS in ESP8266 Arduino 1.6.5-947

PostPosted: Thu Mar 17, 2016 7:02 pm
by malachi
To say an RTOS is active in the Arduino build is somewhat an exaggeration, if the context task switching is used as a basis of judgement. "nonRTOS" seems like a fair assessment, which from what I understand is a layer just under the Arduino compatibility layer (as already mentioned, it amounts to the native SDK)