Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketch emulation on host #5342

Merged
merged 55 commits into from
Nov 20, 2018
Merged

Sketch emulation on host #5342

merged 55 commits into from
Nov 20, 2018

Conversation

d-a-v
Copy link
Collaborator

@d-a-v d-a-v commented Nov 15, 2018

Sketch emulation on host

This environment let compile esp8266/Arduino sketches into native
environment. Network (tcp, udp, including ssl and multicast) is linked to
local host interfaces. WiFi is trivialy emulated and reported as "just"
already connected and usable.

Currently network emulation is a complete rewrite of
WiFiClient+WiFiServer/ClientContext and WifiUdp/UdpContext using socket
posix API. Further work will optionally propose native lwIP library
instead.

(readme)

@d-a-v
Copy link
Collaborator Author

d-a-v commented Nov 15, 2018

#1715

Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great stuff, but I haven't had a chance to try it myself yet. This weekend I'm home and will make time, though!

I think maybe defining what the end goal is would help. I think my idea of why we'd want this (run more of core through host-based testing and code analysis) is different than yours (allow people to build working copies of ESP8266 sketches on their PCs), so some of my comments spring from that.

libraries/ESP8266WebServer/src/ESP8266WebServer.cpp Outdated Show resolved Hide resolved
libraries/ESP8266mDNS/ESP8266mDNS.cpp Show resolved Hide resolved
tests/common.sh Outdated Show resolved Hide resolved
tests/host/Makefile Outdated Show resolved Hide resolved
tests/host/common/ArduinoMain.cpp Show resolved Hide resolved
tests/host/common/MockEEPROM.cpp Outdated Show resolved Hide resolved
tests/host/common/user_interface.cpp Show resolved Hide resolved
tools/sdk/ssl/Makefile Show resolved Hide resolved
@penfold42
Copy link

This is cool - top work.

Running on a pi you could even support real gpio, spi, i2c, i2s for much quicker dev cycles (with much less flash wear !)

Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just able to build and run BearSSL_Validation against valgrind on my host. Very cool and useful! Approving, even though there's much left to go.

One suggestion might be to have some sort of "host_exit()" call which will end the app when run on the host but cause the built app to sleep forever. Makes it simple to run one-and-done examples as test cases.

libraries/ESP8266WiFi/src/BearSSLHelpers.cpp Show resolved Hide resolved
tests/host/common/ArduinoWire.cpp Outdated Show resolved Hide resolved
cores/esp8266/Updater.cpp Outdated Show resolved Hide resolved
cores/esp8266/Updater.cpp Outdated Show resolved Hide resolved
cores/esp8266/Updater.cpp Outdated Show resolved Hide resolved
libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp Outdated Show resolved Hide resolved
tests/host/common/MockUDPSocket.cpp Outdated Show resolved Hide resolved
@earlephilhower
Copy link
Collaborator

Per: https://en.wikipedia.org/wiki/Printf_format_string , "%zd"/"%zu" === size_t format specifier, if there are still issues w/printfs.

@devyte devyte merged commit 74ca42f into esp8266:master Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants