Coder Social home page Coder Social logo

espressif / esp8266_rtos_sdk Goto Github PK

View Code? Open in Web Editor NEW
3.2K 269.0 1.6K 64.61 MB

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.

Home Page: http://bbs.espressif.com

License: Apache License 2.0

Makefile 0.82% C 86.23% C++ 4.07% Shell 0.52% Python 6.00% Perl 0.08% Lex 0.04% Yacc 0.08% Assembly 0.25% CMake 1.02% Batchfile 0.04% M4 0.51% Smarty 0.03% Inno Setup 0.02% Pascal 0.27% VBScript 0.01% Dockerfile 0.01%

esp8266_rtos_sdk's Introduction

ESP8266 RTOS Software Development Kit

Documentation Status

** IMPORTANT NOTICE **

About this repository

A new branching model is applied to this repository, which consists of a master branch and release branches.

1. Master branch

The master branch is an integration branch where bug fixes/features are gathered for compiling and functional testing.

2. Release branch

The release branch is where releases are maintained and hot fixes (with names like release/v2.x.x) are added. Please ensure that all your production-related work are tracked with the release branches.

With this new model, we can push out bug fixes more quickly and achieve simpler maintenance.

Roadmap

ESP8266_RTOS_SDK's framework is quite outdated and different from the current esp-idf and we are planning to migrate ESP8266_RTOS_SDK to esp-idf eventually after v2.0.0.

However, we will firstly provide a new version of ESP8266 SDK (ESP8266_RTOS_SDK v3.0), which shares the same framework with esp-idf (esp-idf style), as a work-around, because the multi-CPU architecture is not supported by esp-idf for the time being.

Actions to be taken for ESP8266_RTOS_SDK v3.0 include the following items:

  1. Modify the framework to esp-idf style
  2. Restructure some core libraries including Wi-Fi libraries and libmain
  3. Update some third-party libraries including FreeRTOS, lwIP, mbedTLS, noPoll, libcoap, SPIFFS, cJSON, wolfSSL, etc.
  4. Update some drivers
  5. Others

Developing With the ESP8266_RTOS_SDK

Get toolchain

v8.4.0

If you are still using old version SDK(< 3.0), please use toolchain v4.8.5, as following:

Get ESP8266_RTOS_SDK

Besides the toolchain (that contains programs to compile and build the application), you also need ESP8266 specific API / libraries. They are provided by Espressif in ESP8266_RTOS_SDK repository. To get it, open terminal, navigate to the directory you want to put ESP8266_RTOS_SDK, and clone it using git clone command:

cd ~/esp
git clone https://github.com/espressif/ESP8266_RTOS_SDK.git

ESP8266_RTOS_SDK will be downloaded into ~/esp/ESP8266_RTOS_SDK.

Setup Path to ESP8266_RTOS_SDK

The toolchain programs access ESP8266_RTOS_SDK using IDF_PATH environment variable. This variable should be set up on your PC, otherwise projects will not build. Setting may be done manually, each time PC is restarted. Another option is to set up it permanently by defining IDF_PATH in user profile.

For manually, the command:

export IDF_PATH=~/esp/ESP8266_RTOS_SDK

Start a Project

Now you are ready to prepare your application for ESP8266. To start off quickly, we can use examples/get-started/hello_world project from examples directory in SDK.

Once you've found the project you want to work with, change to its directory and you can configure and build it.

Connect

You are almost there. To be able to proceed further, connect ESP8266 board to PC, check under what serial port the board is visible and verify if serial communication works. Note the port number, as it will be required in the next step.

Configuring the Project

Being in terminal window, go to directory of hello_world application by typing cd ~/esp/ESP8266_RTOS_SDK/examples/get-started/hello_world. Then start project configuration utility menuconfig:

cd ~/esp/ESP8266_RTOS_SDK/examples/get-started/hello_world
make menuconfig

In the menu, navigate to Serial flasher config > Default serial port to configure the serial port, where project will be loaded to. Confirm selection by pressing enter, save configuration by selecting < Save > and then exit application by selecting < Exit >.

Note: On Windows, serial ports have names like COM1. On MacOS, they start with /dev/cu.. On Linux, they start with /dev/tty.

Here are couple of tips on navigation and use of menuconfig:

  • Use up & down arrow keys to navigate the menu.
  • Use Enter key to go into a submenu, Escape key to go out or to exit.
  • Type ? to see a help screen. Enter key exits the help screen.
  • Use Space key, or Y and N keys to enable (Yes) and disable (No) configuration items with checkboxes "[*]"
  • Pressing ? while highlighting a configuration item displays help about that item.
  • Type / to search the configuration items.

Once done configuring, press Escape multiple times to exit and say "Yes" to save the new configuration when prompted.

Compiling the Project

make all

... will compile app based on the config.

Flashing the Project

When make all finishes, it will print a command line to use esptool.py to flash the chip. However you can also do this from make by running:

make flash

This will flash the entire project (app, bootloader and init data bin) to a new chip. The settings for serial port flashing can be configured with make menuconfig.

You don't need to run make all before running make flash, make flash will automatically rebuild anything which needs it.

Viewing Serial Output

The make monitor target uses the idf_monitor tool to display serial output from the ESP32. idf_monitor also has a range of features to decode crash output and interact with the device. Check the documentation page for details.

Exit the monitor by typing Ctrl-].

To flash and monitor output in one pass, you can run:

make flash monitor

Compiling & Flashing Just the App

After the initial flash, you may just want to build and flash just your app, not the bootloader and init data bin:

  • make app - build just the app.
  • make app-flash - flash just the app.

make app-flash will automatically rebuild the app if it needs it.

(In normal development there's no downside to reflashing the bootloader and init data bin each time, if they haven't changed.)

Note: Recommend to use these 2 commands if you have flashed bootloader and init data bin.

Parallel Builds

ESP8266_RTOS_SDK supports compiling multiple files in parallel, so all of the above commands can be run as make -jN where N is the number of parallel make processes to run (generally N should be equal to or one more than the number of CPU cores in your system.)

Multiple make functions can be combined into one. For example: to build the app & bootloader using 5 jobs in parallel, then flash everything, and then display serial output from the ESP32 run:

make -j5 app-flash monitor

Erasing Flash

The make flash target does not erase the entire flash contents. However it is sometimes useful to set the device back to a totally erased state. To erase the entire flash, run make erase_flash.

This can be combined with other targets, ie make erase_flash flash will erase everything and then re-flash the new app, bootloader and init data bin.

Updating ESP8266_RTOS_SDK

After some time of using ESP8266_RTOS_SDK-IDF, you may want to update it to take advantage of new features or bug fixes. The simplest way to do so is by deleting existing ESP8266_RTOS_SDK folder and cloning it again.

Another solution is to update only what has changed. This method is useful if you have a slow connection to GitHub. To do the update run the following commands::

cd ~/esp/ESP8266_RTOS_SDK
git pull

The git pull command is fetching and merging changes from ESP8266_RTOS_SDK repository on GitHub.

esp8266_rtos_sdk's People

Contributors

afellmett avatar berkutta avatar costaud avatar cwespressif avatar donghengqaz avatar esp-coco avatar esp-lqq avatar esp-yjm avatar heyinling avatar honsunrise avatar jack0c avatar jiajia13201845317 avatar jitin17 avatar joy-hao avatar krzychb avatar lhespress avatar ljysp avatar matombo avatar natashali-espressif avatar projectgus avatar shahpiyushv avatar skywxfang avatar supreetd21 avatar trygvis avatar ustccw avatar wujiangang avatar xcguang avatar xiewenxiang avatar xiongyumail avatar zhangyanjiaoesp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp8266_rtos_sdk's Issues

always return -1 when invoke function: connect

Here is my code, based on RTOS SDK1.3, the program works well except TCP client, when invoking function connect always returns -1, what's wrong with it?

#include "esp_common.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "lwip/sockets.h"

#define SERVER_IP       "192.168.1.121"
#define SERVER_PORT     5000
#define TCP_DATA_LEN    256

static int32 sock_fd;

void tcpc_task() {
    int32 ret = 0;
    int32 recbytes;
    char *recv_buf;
    struct sockaddr_in tcpServerAddr;

    memset(&tcpServerAddr, 0, sizeof(tcpServerAddr));
    tcpServerAddr.sin_family = AF_INET;
    tcpServerAddr.sin_addr.s_addr = inet_addr(SERVER_IP);
    tcpServerAddr.sin_len = sizeof(tcpServerAddr);
    tcpServerAddr.sin_port = htons(SERVER_PORT);
    while (1) {
        sock_fd = socket(AF_INET, SOCK_STREAM, 0);
        if (sock_fd == -1) {
            printf("ESP8266 TCP client task > socket error\r\n");
            close(sock_fd);
            vTaskDelay(1000 / portTICK_RATE_MS);
            continue;
        }
        printf("ESP8266 TCP client task > create socket: %d\r\n", sock_fd);

        ret = connect(sock_fd, (struct sockaddr* )&tcpServerAddr,
                sizeof(struct sockaddr));
        if (ret != 0) {
            printf("ESP8266 TCP client task > connect fail!\r\n");
            close(sock_fd);
            vTaskDelay(1000 / portTICK_RATE_MS);
            continue;
        }
        printf("ESP8266 TCP client task > connect ok!\r\n");

        char *recv_buf = (char *) zalloc(TCP_DATA_LEN);
        while ((recbytes = read(sock_fd, recv_buf, TCP_DATA_LEN)) > 0) {
            recv_buf[recbytes] = 0;
            printf("ESP8266 TCP client task > recv data %d bytes!\r\n",
                    recbytes);
            write(sock_fd, recv_buf, strlen(recv_buf) + 1);
        }
        free(recv_buf);
        if (recbytes <= 0) {
            printf("ESP8266 TCP client task > read data fail!\n");
            close(sock_fd);
        }
    }
}

GPL License Compliance Request

ATT: Espressif Systems, 456 Bi Bo Road Suite A201 Pudong Zhangjiang Shanghai

Dear Sirs,

You provide a software product, "esp_iot_rtos_sdk" (hereafter - "the Product"), available via publicly accessible World-Wide Web URL https://github.com/espressif/esp_iot_rtos_sdk , licensed under the terms of GNU General Public License, version 3, as included in the Product and also available by the URL https://github.com/espressif/esp_iot_rtos_sdk/blob/master/LICENSE .

I obtained the Product in a legal way by the URL provided above, and found that it contains some binary-only components (see listing below). By the right given to me by GNU General Public License, version 3, I would like to request You to provide complete source code for the Product. Please kindly choose the same sources delivery method as you did for the Product - namely, providing them for download via publicly accessible URL. This will ensure your continued compliance with the license.

Following is the list of components which lack associated source code:

  • lib/libmain.a
  • lib/libnet80211.a
  • lib/libphy.a
  • lib/libpp.a
  • lib/libwpa.a
  • tools/genflashbinv6.exe
  • tools/xxd.exe

Sincerely,
Paul Sokolovsky, on the behalf of Open Source community.

RTOS SDK 1.4.0 smart_config compile error

RTOS SDK 1.4.0 smart_config compile error

In file included from /home/wupf/work/nfsroot/ESP8266_RTOS_SDK/include/espressif/c_types.h:28:0,
                 from /home/wupf/work/nfsroot/ESP8266_RTOS_SDK/include/espressif/esp_common.h:93,
                 from user_main.c:25:
/home/wupf/bin/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                          ^
compilation terminated.
make[1]: *** [.output/eagle/debug/obj/user_main.o] Error 1

where can find <xtensa/xtruntime.h>?

I compile esp-freeRTOS SDK got error:
xt-xcc -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH -I include -I ./ -I ../../include/ets -I ../include -I ./ -I ../../include -I ../../include/eagle -I ./ -I ../../include/lwip -I ../../include/lwip/ipv4 -I ../../include/lwip/ipv6 -I ../../include/espressif -o .output/eagle/debug/obj/user_main.o -c user_main.c
In file included from ../../include/freertos/portable.h:318:0,
from ../../include/freertos/FreeRTOS.h:87,
from user_main.c:13:
../../include/freertos/portmacro.h:75:33: fatal error: xtensa/xtruntime.h: No such file or directory

include <xtensa/xtruntime.h>

^
compilation terminated.

but , where can find <xtensa/xtruntime.h>.
very strange: I am using lubuntu compile success.

Sketch hangs after a few seconds if C++ is used

So I decided to attempt to merge the NonOS Arduino framework, seeing how easy it would be after getting the one for the ESP31B working, but I found to not be able to run any C++ code. Here is an example main.cpp that I used to test this

class MyTestClass {
  public:
    MyTestClass(){
      os_printf("MyTestClass Created\n");
    }
    ~MyTestClass(){
      os_printf("MyTestClass Destructed\n");
    }
    void method(){
      os_printf("MyTestClass Method Called\n");
    }
};

MyTestClass gtest;

void setup() {
  MyTestClass test;
  test.method();
}

void loop() {
  gtest.method();
}

void __loop_task(void *pvParameters){
  os_printf("starting\n");
  setup();
  for(;;){
    os_printf("loop\n");
    loop();
    vTaskDelay(10);//100ms
  }
}

extern "C" void user_init(void) {
  xTaskCreate(__loop_task, (const signed char *)"loop_task", 4096, NULL, 0, NULL);
}

if I do not instantiate the class globally or in setup, the thread will run fine forever, else it hangs in just a second then get's reset (watchdog I imagine).
Otherwise the C++ objects are instantiated and destructed fine. Messages are printed properly to the console and all is good for a second.

I used a known good working toolchain from the ESP8266-Arduino project.
C++ build command is below.

xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -D_POSIX_SOURCE -U__STRICT_ANSI__ "-I../sdk_rtos/include" -c -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections  -D_POSIX_SOURCE -DLWIP_OPEN_SRC -DPBUF_RSV_FOR_WLAN -DEBUF_LWIP   -I"../cores/esp8266_rtos" -I"../variants/generic_rtos" -MMD -MP -MF"arduino/main.cpp.d" -MT"arduino/main.cpp.o" "main.cpp"  -o  "arduino/main.cpp.o"

FreeRTOS SDK SPI API issue

Hi,
I am trying to work with the SPI APIs for esp8266-12f. When reading the SPI device ID using the SPI SDK API for getting the device id, I get 4016E0. It seems the external flash on the board is of size 4Mbytes divided into 4KByte sectors(I did verify this). While reading the flash sectors, I can read the sectors from 0-127 but when reading sector 128,129.., the API returns error. Is this because the flash size is 4Mbit rather than 4Mbyte. Or is there something that I am missing here? The FreeRTOS' API system_get_sdk_version returns the SDK Version as 1.4.0(c599790).

Mem leak in SSL code

ESP8266_RTOS_SDK/third_party/ssl/crypto/ssl_rsa.c

int ICACHE_FLASH_ATTR RSA_decrypt(const RSA_CTX *ctx, const uint8_t *in_data...)

original uses stack allos and can return -1, this implementatoin uses stack, must goto error label and free heap.
Best regards

How to execute large application bin files

Hi,
I am using ESP-12F it has 4MBytes SPI FLASH, looking for firmware upgrade OTA.
My application bin size (user1.4096.new.6.bin is 512kBytes, eagle.irom0text.bin is 260KBytes) is larger than the OTA enabled bin (64KB /180KB) size. So my application is not running. How can I change the application and library bin size limitations? Is it possible to update the boot loader so that I can change the mapping?

Please suggest me how to proceed further.

Is there any stable SDK version?

I'm developing for IoT using ESP RTOS SDK. However, compilation was broken after SDK update due to API changes. I am interested whether some stable SDK (with fixed API) version will be introduced .
Thanks in advance.

UDP multicast not working...... Looks like ESPSDK problem

Hi I am trying to send and receive UDP multicast message from ESP. but not able to send message (ESP sendto API pass, but not able to receive data at other end) and receive messages (in receive mode setsockopt() API fail).

It looks like SDK 0.9.9 having problem with UDP multicast.
probably its been resolved in ESP sdk_v1.0.1_b2 because espconn_igmp_join and leave APIS are documented with it.

Is there any plan to update rtos sdk to 1.0.1 ?

For your reference, following is my code in station mode.

define RX_TEST

void task4(void *pvParameters)
{
int udp_server_sock;
struct sockaddr_in remote_addr;
char *message="Hello, World!";
int recbytes;

ifdef RX_TEST

char msgbuf[64];
struct ip_mreq mreq;
struct sockaddr_in local_addr;
//int addrlen,nbytes;
int nbytes;
u32_t addrlen;
struct ip_info info;

//Using ESP as Station mode, wait  few Time to connect with Access point 
    vTaskDelay(2000);

while (true != wifi_get_ip_info(STATION_IF, &info))
{
    vTaskDelay(100);
}
printf("===========Got IP %x\n",info.ip.addr);

endif

do
{
    if (-1 == (udp_server_sock = socket(AF_INET, SOCK_DGRAM, 0)))
    {
        printf("S > socket error\n");
        break;
    }

    printf("S > create socket: %d\n", udp_server_sock);

    memset(&remote_addr,0,sizeof(remote_addr));
    remote_addr.sin_family=AF_INET;
    remote_addr.sin_addr.s_addr=inet_addr("225.0.0.37");
    remote_addr.sin_port=htons(12345);

    /* use setsockopt() to request that the kernel join a multicast group */

ifdef RX_TEST

    memset(&local_addr,0,sizeof(local_addr));
    local_addr.sin_family=AF_INET;
    local_addr.sin_addr.s_addr=htonl(INADDR_ANY); /* N.B.: differs from sender */
    local_addr.sin_port=htons(12345);

    /* bind to receive address */
    if (bind(udp_server_sock,(struct sockaddr *) &local_addr,sizeof(local_addr)) < 0) {
        printf("bind error");
    }

    mreq.imr_multiaddr.s_addr=inet_addr("225.0.0.37");
    mreq.imr_interface.s_addr=info.ip.addr;
    //mreq.imr_interface.s_addr=htonl(info.ip);
    if (setsockopt(udp_server_sock,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq)) < 0) {
        printf("setsockopt error");
    }
    addrlen = sizeof(addrlen);

endif

    while (1)
    {

ifdef RX_TEST

        if ((nbytes=recvfrom(udp_server_sock,msgbuf,64,0,(struct sockaddr *) &local_addr,&addrlen)) < 0) {
            printf("recvfrom error");
        }
        msgbuf[nbytes] = '\0';
        printf("Rx: %s\n",msgbuf);

endif

        vTaskDelay(100);
        if (sendto(udp_server_sock,message,sizeof(message),0,(struct sockaddr *) &remote_addr, sizeof(remote_addr)) < 0)
        {
            printf("sendto Errro\n");
        }
        else
        {
            printf("send sucess\n");
        }
    }
} while (0);

}

Initializing multicast socket crash

Hi,
I use below code to test receiving multicast message, but the add membership operation will crash.
This test code working fine on PC.

btw, make sure

define LWIP_IGMP 1

in lwip/opt.h, otherwise compilation will failed

unsigned char ssdp_buf[1024];
void ssdp()
{
struct sockaddr_in si = {0};
int ssdp_fdm;
int one = 1;
struct ip_mreq imr;

ssdp_fdm = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (ssdp_fdm < 0) {
    printf("create server socket failed\n");
    return;
}

setsockopt(ssdp_fdm, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int));

si.sin_family = AF_INET;
si.sin_port = htons(1900);

if(bind(ssdp_fdm, (struct sockaddr *)&si, sizeof(struct sockaddr_in)) < 0) {
    close(ssdp_fdm);
    return;
}

memset(&imr, 0, sizeof(imr));
imr.imr_multiaddr.s_addr = inet_addr("239.255.255.250");

   //add membership operation crash the ESP8266
if(setsockopt(ssdp_fdm, IPPROTO_IP, IP_ADD_MEMBERSHIP, &imr, 
    sizeof(struct ip_mreq)) < 0) {
    close(ssdp_fdm);
    return;
}

printf("start listen\n");

while(1) {
    int n = read(ssdp_fdm, ssdp_buf, 1024);
    if (n <= 0)
        break;
    printf("%s\n", ssdp_buf);
}

close(ssdp_fdm);

}

udhcpd not working correctly

udhcpd is working on the first start after flash but its not working if i restart module or power down and up again. its giving 0.0.0.100 on android and its not giving anything on windows.

typo

examples/dirver_lib

examples/driver_lib

restart while dhcp

ApiMsgMutex created
idle_task_hdl : 3fff3f98
tim_task_hdl : 3fff41f0
xPortStartScheduler

OS SDK ver: 0.0.5 compiled @ Dec 25 2014 17:57:07
phy ver: 273, pp ver: 6

SDK version:0.0.5
mode : sta(18:fe:34:99:99:58) + softAP(1a:fe:34:99:99:58)
add if0
add if1
bcn 100
Hello, welcome to client!
C > socket ok!
S > create socket: 2
S > bind port: 80
b
b
b
scandone
add 0
aid 6
aid end
cnt

connected with edgy&di, channel 9
dhcp client start...
Fatal exception (28):
epc1=0x4025ba60
epc2=0x00000000
epc3=0x402430bd
epcvaddr=0x00000098
depc=0x00000000

Firmware update sucks

I have never seen a firmware update so complicated in over 30 years of doing this type of thing!
wth? Why can't you ppl create a simple 1 file bin to be uploaded to the chip?
I don't want to make file, its ridiculous. One chip, one firmware. Is that too much to ask?
None of this 4 segment bullshit.

compiling with gcc looks for xt-nm

I selected compilation with gcc, but it's looking for xt-nm:

make[1]: Leaving directory `/big/home/src/esp8266/esp_iot_rtos_sdk/app/user'
xtensa-lx106-elf-gcc  -L../lib -nostdlib -T../ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lmain -lfreertos -llwip -ludhcp user/.output/eagle/debug/lib/libuser.a -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out

!!!
sh: 1: xt-nm: not found

This referenced in tools/gen_appbin.py:

$ grep -C4 xt-nm tools/gen_appbin.py

    if os.getenv('COMPILE')=='gcc' :
        cmd = 'xtensa-lx106-elf-nm -g ' + elf_file + ' > eagle.app.sym'
    else :
        cmd = 'xt-nm -g ' + elf_file + ' > eagle.app.sym'

Looks like the COMPILE environment variable isn't passed down into the python script...

[SDK8266-86] hw_timer based on NMI does not exist in RTOS SDK?

I'm looking for a way to implement the hw_timer within the NMI. This is available on the non-OS SDK (e.g. void hw_timer_init use with NMI_SOURCE).

Unfortunately it seems that this does not work with the RTOS SDK, and I cannot fix it by just copying some header files because some functions like NmiTimSetFunc are missing from libmain.a.

The reasoning behind NMI timers is that I have a very time-critical code which must not be interrupted by any ISR or even the NMI. By executing this code from within the NMI, I would have a way to guarantee that really nothing can interrupt me there.

Any help is greatly appreciated.

Functions are not stored in CACHE

After the last update (ESP_IOT_RTOS_SDK_V1.1.0_15_08_21) all functions are being allocated in IRAM memory even if you add ICACHE_RODATA_ATTR before each function.

So my code no longer fits on it...

esp8266 crashes when connected to wifi in station mode with wep security key

Hi ,
I find esp8266 to work fine when i connect to my wifi router using wpa/wpa2.
But when i connect esp8266 in station mode to wifi router using wep it crashes at "ieee80211_crypto_decap". I use the latest libnet80211.a in the repo.

Do we have a work around for this or I am missing any thing?

/* need to set opmode before you set config */
wifi_set_opmode(STATION_MODE);

{
    struct station_config *config = (struct station_config *)zalloc(sizeof(struct station_config));
    sprintf(config->ssid, "myssid");
    sprintf(config->password, "my_wep_pass");

    /* need to sure that you are in station mode first,
     * otherwise it will be failed. */
    wifi_station_set_config(config);
    free(config);
}

Missing support for vprintf

I would like to use vprintf but it is not properly redirected to UART like printf. The problem is that I have a va_list that I'd like to pass to vprintf and there is no easy solution without that function. The function is in libcirom.a but nothing is printed out to the hook installed by os_install_putc1().

I tried to map the call to printf using __builtin_apply() but it crashes at runtime. I am not sure why.

Could you provide support for vprintf in the rtos sdk?

If you are using newlib, it should be easy to redirect all stdin/stdout/stderr using hooks similar to os_install_putc1().

netif_create_ip4_linklocal_address

I am unable to build LWIP for the latest rtos SDK because libmain.a references a symbol netif_create_ip4_linklocal_address, which is not provided by LWIP.

While recompiling LWIP would be advantageous for other reasons, I (and many others, it seems) would be happy if IGMP were simply compiled into the provided library.

smartconfig run fail: run smartconfig fail in 4M flash device

I built example/smart_config for my 4M space of flash with modifying the len of irom0_0_seg in ld/eagle.app.v6.ld to 0x4C000. It fail when runing. It ran just several lines of user_init(), than throw large number of unreadable messages(0xFF mainly) to com. Some times it crash after writing "PMODE_PROBEREQRECVED error".
smart_config can run well on nonos_sdk, so I think that maybe something went wrong with codes but not device. I just want to support MQTT protocol in my device, but this problem had stop me a few days for total testing, than ask for help here.

wifi timing

I have a problem using the RTOS SDK. I have the following simple loop waiting for
a wifi connection (see below). It does the job, however it is unusually slow.

I check the status every 10ms. Using the non-os SDK (actually lua) I measured
the time to be mostly around 35ms. I see 1089ms here.

I added printout around the 10ms delay and it is clear that most are about 10ms
but the 12th one takes 953ms (almost 1 second!). I tried this in many ways, using
different probing methods (e.g.os_timer_*, xTimer*) with identical results.

I understand how preemption can vary the actuall time but this is more than I consider
acceptable. This is a big problem for me. My app takes about 300ms to run, then it
sleeps for a few minutes. Raising the timing to 1.5 will use 5 times as much power
from the battery.

Can anyone shed light on this issue? I am new to the RTOS SDK so I probably did
not use it properly - I will appreciate any pointer to some doco. I searched for
documentation and mostly there is little that explains the API in enough technical
depth.

The program section:

uint32 wifi_time = system_get_time();           // reference point
int wifi_count;
for (wifi_count = 0;; ++wifi_count) {
        uint32 delay_time = system_get_time();
        vTaskDelay(10/portTICK_RATE_MS);        // one tick, 10ms
        printf("%d loop %7d %6d \n",
                wifi_count,  delay_time, system_get_time() - delay_time);
}
printf("%2d %7d done\n", wifi_count, system_get_time() - wifi_time);

The log (note the 12th loop):

         start length
            us     us
 0 loop  99439   7381
 1 loop 106890   9921
 2 loop 116876   9935
 3 loop 126876   9943
 4 loop 136884   9927
 5 loop 146876   9935
 6 loop 156876   9939
 7 loop 166885   9928
 8 loop 176884   9928
 9 loop 186878  10018
10 loop 196968   9848
11 loop 206884   9927
scandone
state: 0 -> 2 (b0)
12 loop 216880 953507         <<<<<
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
pm open phy_2,type:2 0 0
cnt 
13 loop 1170478  8060

connected with xxxx, channel 11
ip:192.168.2.48,mask:255.255.255.0,gw:192.168.2.7
14 loop 1178622 10328 
15 1089622 done

Missing includes

Hi,
I'm having trouble using this new SDK.
First, it miss the xtensa/simcall.h header file.
Also, I can't use the gpio, even if I include gpio.h from an older SDK, because it seems to have missing declaration in the libraries.

You are doing an excelent job and I would like to thank all of your team for providing us such wonderfull tools.

Regards

system_get_sdk_version not found

Using the new v0.9.9 I get the following trying to link the unchanged sample app:

user/.output/eagle/debug/lib/libuser.a(user_main.o):(.irom0.text+0x2c): undefined reference to `system_get_sdk_version'

The string isn't found in any library:

$ grep -r system_get_sdk_version .
./app/user/user_main.c:    printf("SDK version:%s\n", system_get_sdk_version());
./bin/eagle.S:    printf("SDK version:%s\n", system_get_sdk_version());
./bin/eagle.S:    printf("SDK version:%s\n", system_get_sdk_version());
./include/espressif/esp_system.h:const char* system_get_sdk_version(void);

Did you perhaps forget to upload the new libraries to esp_iot_rtos_sdk_lib?

Pulse With Modulation

Hi,
I'm trying to port pwm.c (from IOT_exemple) to the RTOS SDK.
But I miss ets_isr_attach and ets_isr_unmask.
I also tried to implement pwm with rtos task and timer but it seems that one tick is 10ms and we need us resolution for pwm.
Any clue ?

multicast setsockopt fail, errno = 92( Protocol not available)

Hi,
this is a old question. I user bellow code to create a udp multicast server, but join a mcast group failed.
the test code is find to PC.

   #define LWIP_IGMP 1         // first, make LWIP_IGMP is 1

// join a mcast group
struct ip_mreq mreq;
mreq.imr_multiaddr.s_addr = inet_addr(MCAST_ADDR);  // mcast group ip
mreq.imr_interface.s_addr = htonl(INADDR_ANY);      // local ip
ret = setsockopt(sock_fd,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq));
if(ret < 0) {
    WARNING("setsockopt() fail-%d:IP ADD MEMBURSHIP", errno);

// goto __exit;
}

the debug msg printf "errno = 92", Macro definition as follows:

define ENOPROTOOPT 92 /* Protocol not available */

Hope that the engineer can solve this problem, Thank you very much.

axTSL client_hello cipher verification failure

I'm trying to verify axTLS library which is used as libssl in RTOS SDK.
It occured that I can't get SSL handshake successfully done due to ciphers are not accepted by axTLS.
axTLS supports following ciphers, but none of them works properly.

#define SSL_AES128_SHA                          0x2f
#define SSL_AES256_SHA                          0x35
#define SSL_RC4_128_SHA                         0x05
#define SSL_RC4_128_MD5                         0x04

I'm using cULR CLI on client side, and none of the following commands don't cause successfull SSL handshake:

curl -kiv --ciphers AES128-SHA <URL>
curl -kiv --ciphers AES256-SHA <URL>
curl -kiv --ciphers RC4-SHA <URL>
curl -kiv --ciphers RC4-MD5 <URL>

Sniffering by wireshark shows that ciphers are sent by client correctly, values are used exactly the same as axTLS expects.

After looking into axTLS code, I found that encoding of cipher bytes is done incorrectly in function process_client_hello.

As a result it's impossible to use TLS connections in RTOS SDK at all.

Fixed it in #65

scanning networks

I have a problem with scanning networks. It seems that the function wifi_station_scan does not work. My code:

static void scan_callback(void *arg, STATUS status)
{
    printf("executing callback..."); // it is never reached
    struct bss_info *info = arg;

    if (info == NULL)
        return;

    for (; info->next.stqe_next; info = info->next.stqe_next)
    {
        printf("BSSID %02x:%02x:%02x:%02x:%02x:%02x channel %02d rssi %02d auth %02d %s\n", 
            MAC2STR(info->bssid),
            info->channel, 
            info->rssi, 
            info->authmode,
            info->ssid
        );
    }
}

void ICACHE_FLASH_ATTR
user_init(void)
{
    wifi_set_opmode(STATION_MODE);

    if (wifi_station_scan(NULL, &scan_callback))
    {
        printf("scan finished");
    }
    else
    {
        printf("something went wrong"); // always returns false
    }

    // ...
}

Unable to make pull down work

I have been unable to enable the internal pull down resistor for any pin. It looks like the following macro should work:

SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLDWN)

but it does not.

Station mode not working with WPA security mode

Find details here http://bbs.espressif.com/viewtopic.php?f=7&t=1113

Code Used:
wifi_set_opmode(STATIONAP_MODE);

{
struct station_config *config = (struct station_config *)zalloc(sizeof(struct station_config));
sprintf(config->ssid, "myWIFI");
sprintf(config->password, "myPassword");
//need not mac address
config->bssid_set = 0;

/* need to sure that you are in station mode first,

  • otherwise it will be failed. */
    wifi_station_set_config(config);
    free(config);
    }

Serial Log:

scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
cnt
ERRRRRR:256,137,137!!!!state: 5 -> 2 (ea0)
rm 0
reconnect
state: 2 -> 0 (0)
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
cnt
ERRRRRR:256,137,137!!!!state: 5 -> 2 (ea0)
rm 0

Crash when using select function with socket

Hi,
When I use select function to handle multiple connection simultaneously, calling of select function crash the ESP8266, the code below works fine on PC.

define SERVER_PORT 9669

define MAX_CONN 10

define BUF_LEN 1024

//declare variables outside of function to avoid stack overflow

static int conn;
static int nready;
static int i;
static int clients[MAX_CONN];
static int listen_fd;
static struct sockaddr_in addr;
static struct sockaddr_in peer_addr;
static socklen_t len = sizeof(peer_addr);
static char sbuf[BUF_LEN] = {0};

int server_loop(int port)
{
listen_fd = socket(AF_INET, SOCK_STREAM, 0);

if (listen_fd < 0) {
    printf("server socket init failed\n");
    return -1;
}

bzero(&addr, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = INADDR_ANY;

printf("@1\n");
if (bind(listen_fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
    close(listen_fd);
    printf("bind server socket failed\n");
    return -1;
}

printf("@2\n");
if (listen(listen_fd, MAX_CONN) < 0) {
    close(listen_fd);
    printf("listen server socket failed\n");
    return -1;
}

printf("@3\n");
for (i = 0; i < MAX_CONN; i++)
    clients[i] = -1;

int max_fd = listen_fd;
fd_set old_set;
fd_set new_set;
FD_ZERO(&old_set);
FD_ZERO(&new_set);
FD_SET(listen_fd, &new_set);

printf("@4\n");
while(1) {
    old_set = new_set;
            // calling of select function will crash here
    nready = select(max_fd + 1, &old_set, NULL, NULL, NULL);
    if (nready == -1) {
        if (errno == EINTR)
            continue;

        printf("select error\n");
        break;
    }

    printf("@5\n");

    if (nready == 0)
        continue;

    if (FD_ISSET(listen_fd, &old_set)) {
        conn = accept(listen_fd, (struct sockaddr*)&peer_addr, &len);
        if (conn == -1) {
            printf("accept error\n");
            break;
        }

        for (i = 0; i < MAX_CONN; i++) {
            if (clients[i] < 0) {
                clients[i] = conn;
                break;
            }
        }

        if (i == MAX_CONN) {
            printf("too many clients\n");
            break;
        }

        FD_SET(conn, &new_set);
        if (conn > max_fd)
            max_fd = conn;

        if (--nready <= 0)
            continue;
    }

    for (i = 0; i < MAX_CONN; i++) {
        conn = clients[i];
        if (conn == -1)
            continue;

        if (FD_ISSET(conn, &old_set)) {

            int n = recv(conn, sbuf, BUF_LEN, 0);
            if (n < 0) {
                printf("recv error\n");
                break;
            } else if (n == 0) {
                printf("client close\n");
                FD_CLR(conn, &new_set);
                clients[i] = -1;
                close(conn);
            } else {
                printf("%s\n", sbuf);
            }

            if (--nready <= 0)
                break;

        }
    }
}

close(listen_fd);
for (i = 0; i < MAX_CONN; i++) {
    conn = clients[i];
    if (conn > 0)
        close(conn);
}

return 0;

}

Cant find ssl_compat.h

plz test all examples before you release a new version....
I fix this problem by copying file:

cp ./include/ssl/ssl_compat-1.0.h ./include/ssl/ssl_compat.h

build fail: build example smart_config fail

I just run gen_musc.sh in example/smart_config/ as default but it fail after print massage like this:

/opt/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: .output/eagle/debug/image/eagle.app.v6.out section `.irom0.text' will not fit in region `irom0_0_seg'
collect2: error: ld returned 1 exit status
make: *** [.output/eagle/debug/image/eagle.app.v6.out] Error 1

I had build project_template and it become success.
My platform is a given virtual mirror ESP8266_lubuntu_20141021.ova. Any advice to me to solve this?

Does the SDK support Wifi Direct (P2P)

In the hardware specs, it states that the unit supports "WiFi Direct (P2P), soft-AP", but I don't see any API in the SDK. Or at least it does not appear to be documented.

Thanks for your reply
Cos

heap4.c doesn't compile

The source file thirdparty/freertos/heap_4.c contains references to ETS_INTR_LOCK and ETS_INTR_UNLOCK, but these don't seem to be defined anywhere in the SDK or exist as symbols in the libraries.

Can you explain what these should be, please?

lack gpio_* uart_*

I copied gpio.h from 0.9.3 SDK, but gpio_* functions were undecleared when I was compiling.
It seems these functions are not in lib.
What should I do if I wanna operate gpio
btw, uart_* does not found too.

gen_misc.sh unexpected operator

I'm getting this error when running gen_misc.sh

STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)
enter (0/1/2, default 0):
1
gen_misc.sh: 62: [: 1: unexpected operator
gen_misc.sh: 71: [: 1: unexpected operator
ignore boot
generate bin: eagle.flash.bin+eagle.irom0text.bin

echo "STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)"
echo "enter (0/1/2, default 0):"
read input

if [ -z "$input" ]; then
if [ $boot != none ]; then
boot=none
echo "ignore boot"
fi
app=0
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
elif [ $input == 1 ]; then
if [ $boot == none ]; then
app=0
echo "choose no boot before"
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
else
app=1
echo "generate bin: user1.bin"
fi
elif [ $input == 2 ]; then
if [ $boot == none ]; then
app=0
echo "choose no boot before"
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
else
app=2
echo "generate bin: user2.bin"
fi
else
if [ $boot != none ]; then
boot=none
echo "ignore boot"
fi
app=0
echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
fi

Missing definition of uart_div_modify

In examples/driver_lib/driver/uart.c there is a reference to a function call called uart_div_modify. At compilation time, the prototype for this function can not be found and the compilation fails.

don't use rtc mem data

Hello,
I tried to compile and flash the "project template" example but the only message I get during boot is "don't use rtc mem data". No other chars are output during boot.

Missing libupgrade.a

I was trying to do the FOTA but seems that libupgrade.a is missing. Does any one how to get the libupgrade.a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.