Skip to content

Commit 964711e

Browse files
committed
WIP
1 parent 005cd42 commit 964711e

File tree

7 files changed

+31
-9
lines changed

7 files changed

+31
-9
lines changed

libraries/ESP8266WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ ESP8266WebServer server(80);
4040

4141
const int led = 13;
4242

43+
void drawGraph();
44+
4345
void handleRoot() {
4446
digitalWrite(led, 1);
4547
char temp[400];

tests/host/Makefile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ CORE_CPP_FILES := $(addprefix $(CORE_PATH)/,\
2121
WString.cpp \
2222
Print.cpp \
2323
FS.cpp \
24-
spiffs_api.cpp \
2524
pgmspace.cpp \
2625
MD5Builder.cpp \
2726
)
27+
# spiffs_api.cpp \
2828
2929
CORE_C_FILES := $(addprefix $(CORE_PATH)/,\
3030
core_esp8266_noniso.c \
@@ -189,8 +189,6 @@ ARDUINO_LIBS := \
189189
ESP8266HTTPClient/src/ESP8266HTTPClient.cpp \
190190
) \
191191

192-
193-
194192
MOCK_ARDUINO_LIBS := \
195193
common/MockClientContextSocket.cpp \
196194
common/MockClientContext.cpp \
@@ -210,7 +208,12 @@ CPP_SOURCES_CORE_EMU = \
210208
$(MOCK_ARDUINO_LIBS) \
211209
$(ARDUINO_LIBS) \
212210

213-
CPP_OBJECTS_CORE_EMU = $(CPP_SOURCES_CORE_EMU:.cpp=.cpp.o)
211+
212+
ULIBPATHS = $(shell echo $(ULIBDIR) | sed 's,:, ,g')
213+
USERLIBDIR = $(shell test -z "$(ULIBPATHS)" || for d in $(ULIBPATHS)/* $(ULIBPATHS)/*/src; do test -d $$d && echo -I$$d; done)
214+
INC_PATHS += $(USERLIBDIR)
215+
216+
CPP_OBJECTS_CORE_EMU = $(CPP_SOURCES_CORE_EMU:.cpp=.cpp.o) $(USERLIB:.cpp=.cpp.o)
214217

215218
bin/fullcore.a: $(C_OBJECTS) $(CPP_OBJECTS_CORE_EMU)
216219
ar -rcu $@ $^
@@ -219,9 +222,9 @@ bin/fullcore.a: $(C_OBJECTS) $(CPP_OBJECTS_CORE_EMU)
219222
.PRECIOUS: %.cpp.o
220223
%: %.ino.cpp.o bin/fullcore.a
221224
$(CXX) $(LDFLAGS) $< bin/fullcore.a -o $@
222-
ln -sf ../$@ $(BINDIR)
225+
test -r $@ && ln -sf ../$@ $(BINDIR) || ln -sf $@ $(BINDIR)
223226

224-
.PRECIOUS: %.cpp
227+
.PRECIOUS: %.ino.cpp
225228
%.ino.cpp: %.ino
226229
@s=$<; \
227230
n=$${s##*/}; \

tests/host/README

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Host emulation (WIP)
33
--------------------
44

5+
All results are stored or linked from ./bin/ .
6+
57
Regular host test:
68
make <no argument>
79

@@ -16,7 +18,6 @@ Build one example
1618
run it:
1719
./bin/Blink -h
1820

19-
2021
Interesting examples:
2122
make D=1 ../../libraries/esp8266/examples/Blink/Blink
2223
make D=1 ../../libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient
@@ -25,3 +26,7 @@ Interesting examples:
2526
Needs tweaking:
2627
make D=1 ../../libraries/ESP8266WebServer/examples/AdvancedWebServer/AdvancedWebServer
2728
(declare 'void drawGraph();' on top of file)
29+
30+
Compile your sketches (remove the .ino part of the sketch file name):
31+
make D=1 ULIBDIR=/path/to/your/arduino/libraries:/path/to/another/one /path/to/your/sketchdir/sketch
32+

tests/host/common/HardwareSerial.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ void HardwareSerial::begin (unsigned long baud, SerialConfig config, SerialMode
1717
fprintf(stderr, MOCK "FIXME HardwareSerial::begin(baud=%ld config=0x%x mode=0x%x)\n", baud, (int)config, (int)mode);
1818
}
1919

20+
void HardwareSerial::setDebugOutput (bool on)
21+
{
22+
(void)on;
23+
}
24+
2025
int HardwareSerial::available (void)
2126
{
2227
printf(MOCK "TODO HardwareSerial::available\n");

tests/host/common/MockEsp.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,9 @@ uint32_t EspClass::getFlashChipRealSize(void)
135135
uint32_t EspClass::getFlashChipSize(void)
136136
{
137137
return magicFlashChipSize(4);
138-
}
138+
}
139+
140+
String EspClass::getFullVersion ()
141+
{
142+
return "host-emulation";
143+
}

tests/host/common/mock.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ class InterruptLock { };
7676

7777
//
7878

79-
#define ESP8266
79+
#define ARDUINO 1
80+
#define ESP8266 1
8081
#define A0 0
8182
#define LED_BUILTIN 0
8283

tests/host/common/user_interface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ bool wifi_station_scan(struct scan_config *config, scan_done_cb_t cb)
363363
return false;
364364
}
365365

366+
uint32_t core_version = 1;
366367

367368
///////////////////////////////////////
368369
// not user_interface

0 commit comments

Comments
 (0)