diff --git a/.gitignore b/.gitignore index ceec197..56b58f5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build firmware .gdb_history local.mk +local.h diff --git a/README.md b/README.md index 40cc578..77398a5 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ git clone --recursive https://github.com/Superhouse/esp-open-rtos.git cd esp-open-rtos ``` +* To build any examples that use WiFi, create a file "local.h" in the top-level directory and add two macro defines to it: +```c +#define WIFI_SSID "mywifissid" +#define WIFI_PASS "my secret password" +``` + * Build an example project (found in the 'examples' directory) and flash it to a serial port: ``` diff --git a/common.mk b/common.mk index c1ce356..a7767c6 100644 --- a/common.mk +++ b/common.mk @@ -194,7 +194,7 @@ SDK_PROCESSED_LIBS = $(addsuffix .a,$(addprefix $(BUILD_DIR)sdklib/lib,$(SDK_LIB # Make rule for preprocessing each SDK library # -$(BUILD_DIR)sdklib/%.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/allsymbols.rename +$(BUILD_DIR)sdklib/%.a: $(ROOT)lib/%.a $(BUILD_DIR)sdklib/allsymbols.rename $(ROOT)common.mk $(vecho) "Pre-processing SDK library $< -> $@" $(Q) $(OBJCOPY) --redefine-syms $(word 2,$^) --weaken $< $@ @@ -219,6 +219,12 @@ $(BUILD_DIR)sdklib/allsymbols.rename: $(patsubst %.a,%.rename,$(SDK_PROCESSED_LI PROGRAM_SRC_DIR ?= $(PROGRAM_DIR) PROGRAM_ROOT ?= $(PROGRAM_DIR) PROGRAM_MAKEFILE = $(firstword $(MAKEFILE_LIST)) +# if there's a local.h file in either the program dir or the +# root dir, load macros from it (for WIFI_SSID,WIFI_PASS, etc.) +PROGRAM_LOCAL_H = $(lastword $(wildcard $(ROOT)local.h $(PROGRAM_DIR)local.h)) +ifneq ($(PROGRAM_LOCAL_H),) +PROGRAM_CFLAGS = $(CFLAGS) -imacros $(PROGRAM_LOCAL_H) +endif $(eval $(call component_compile_rules,PROGRAM)) ## Include other components (this is where the actual compiler sections are generated) diff --git a/examples/http_get/main.c b/examples/http_get/main.c index 2e68901..bfe945b 100644 --- a/examples/http_get/main.c +++ b/examples/http_get/main.c @@ -20,9 +20,9 @@ #define WEB_PORT 80 #define WEB_URL "http://chainxor.org/" -/* FILL THESE IN!!!!!!!!!! */ -#define WIFI_SSID "SSID Name Here" -#define WIFI_PASS "Wifi Password Here" +#if !defined(WIFI_SSID) || !defined(WIFI_PASS) +#error "Please define macros WIFI_SSID & WIFI_PASS (here, or better in a local.h file at root level or in program dir." +#endif void http_get_task(void *pvParameters) { diff --git a/examples/http_get_ssl/main.c b/examples/http_get_ssl/main.c index 7dfbc97..925c2e8 100644 --- a/examples/http_get_ssl/main.c +++ b/examples/http_get_ssl/main.c @@ -20,14 +20,13 @@ #include "ssl.h" - -#define WEB_SERVER "10.10.10.1" +#define WEB_SERVER "192.168.0.18" #define WEB_PORT "8000" -#define WEB_URL "https://chainxor.org/" +#define WEB_URL "/test" -/* FILL THESE IN!!!!!!!!!! */ -#define WIFI_SSID "esptest" -#define WIFI_PASS "secret passphrase" +#if !defined(WIFI_SSID) || !defined(WIFI_PASS) +#error "Please define macros WIFI_SSID & WIFI_PASS (here, or better in a local.h file at root level or in program dir." +#endif static void display_cipher(SSL *ssl); static void display_session_id(SSL *ssl);