espressif / esp8266_rtos_sdk Goto Github PK
View Code? Open in Web Editor NEWLatest ESP8266 SDK based on FreeRTOS, esp-idf style.
Home Page: http://bbs.espressif.com
License: Apache License 2.0
Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
Home Page: http://bbs.espressif.com
License: Apache License 2.0
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
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);
}
I was trying to do the FOTA but seems that libupgrade.a is missing. Does any one how to get the libupgrade.a
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...
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 ?
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.
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.
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
So far I have stumbled on 3 duplicate implementations in both libraries and opted to remove them from libcircom in order to compile.
lib_a-printf.o
lib_a-putchar.o
lib_a-puts.o
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);
}
}
}
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
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?
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.
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.
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
^
compilation terminated.
but , where can find <xtensa/xtruntime.h>.
very strange: I am using lubuntu compile success.
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
it seems the function can not write data to flash.
how can i store my data to flash?
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.
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.
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?
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
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().
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.
void task4(void *pvParameters)
{
int udp_server_sock;
struct sockaddr_in remote_addr;
char *message="Hello, World!";
int recbytes;
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);
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 */
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);
while (1)
{
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);
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);
}
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.
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
I looked back through the commits and did not see it anywhere?
I got one from the NONOS ESP8266-Arduino
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
}
// ...
}
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
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...
I haven't seen any API could do this.
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:
Hope that the engineer can solve this problem, Thank you very much.
we build the sdk in linux environment.
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.
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
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
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);
}
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,
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
hw_timer.c:79:5: error: passing argument 2 of '_xt_isr_attach' from incompatible pointer type [-Werror]
Hi,
Is it possible to perform multicasting in ESP8266? If so, how?
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:
Sincerely,
Paul Sokolovsky, on the behalf of Open Source community.
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).
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?
examples/dirver_lib
examples/driver_lib
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.
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.
//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;
}
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.
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"
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
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.
FreeRTOS_socket, FreeRTOS_connect, FreeRTOS_closesocket and so on...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.