ESP8266 Developer Zone The Official ESP8266 Forum 2018-08-03T15:59:56+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=10924 2018-08-03T15:59:56+08:00 2018-08-03T15:59:56+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10924&p=22383#p22383 <![CDATA[Re: Creating a Blocking Thread on espconn_gethostbyname]]>
https://github.com/esp8266/Arduino/blob ... 266/cont.S

Statistics: Posted by Pato — Fri Aug 03, 2018 3:59 pm


]]>
2018-08-02T23:08:29+08:00 2018-08-02T23:08:29+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10924&p=22367#p22367 <![CDATA[Re: Creating a Blocking Thread on espconn_gethostbyname]]>
Pato wrote:
Hey,

I am also studying a way to do a kind of wait() or delay() that would block the execution of my function while letting the SDK do its background tasks like Wifi and TCP processing.

I've found very intersesting things in the ESP support for Arduino IDE: their great guys heve build this exact same function with some pieces of assembler to switch context and stack (https://github.com/esp8266/Arduino/blob ... 6_main.cpp)

You can grep "esp_yield" on this whole Git repo to see how they achieved this, I'm also doing so to understand their tricks, ou may figure out a solution for you :)
Good luck


Yeah, In X86 ASM we use PUSHAD and POPAD to store all the CPU Vars onto the stack You can then set your pointer to another function to pop the var's and assume that it's pretty much where it left off. Not sure if we have that here as a possibility.

*Update* After searching the forum I did find this sniblet so it's doable in 'C'. Maybe we can do a pushpop trick to resume where we started. Tottally a unsupported hack attempt but could be fun :)

For turning on GPIO

Code:

__asm__ volatile ("movi a2, 0x60000304\n"
"movi a4, %0\n"
"memw\n"
"s32i a4, a2, 0\n"
::"r" (setbits):"a2", "a4");
setbits is a static uint16;

Statistics: Posted by AgentSmithers — Thu Aug 02, 2018 11:08 pm


]]>
2018-08-03T15:55:37+08:00 2018-08-02T22:24:46+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10924&p=22365#p22365 <![CDATA[Re: Creating a Blocking Thread on espconn_gethostbyname]]>
I am also studying a way to do a kind of wait() or delay() that would block the execution of my function while letting the SDK do its background tasks like Wifi and TCP processing.

I've found very intersesting things in the ESP support for Arduino IDE: their great guys have built this exact same function with some pieces of assembler to switch context and stack (https://github.com/esp8266/Arduino/blob ... 6_main.cpp)

You can grep "esp_yield" on this whole Git repo to see how they achieved this, I'm also doing so to understand their tricks, you may figure out a solution for you :)
Good luck

Statistics: Posted by Pato — Thu Aug 02, 2018 10:24 pm


]]>
2018-07-31T07:22:55+08:00 2018-07-31T07:22:55+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10924&p=22277#p22277 <![CDATA[Re: Creating a Blocking Thread on espconn_gethostbyname]]> Statistics: Posted by AgentSmithers — Tue Jul 31, 2018 7:22 am


]]>
2018-07-08T07:41:59+08:00 2018-07-08T07:41:59+08:00 https://bbs.espressif.com:443/viewtopic.php?t=10924&p=21504#p21504 <![CDATA[Creating a Blocking Thread on espconn_gethostbyname]]> Statistics: Posted by AgentSmithers — Sun Jul 08, 2018 7:41 am


]]>