mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-26 22:50:39 +08:00
Merge pull request #1678 from cesanta/esp8266
Improved Makefile to be able to flash
This commit is contained in:
commit
2bf25a1406
@ -1,13 +1,28 @@
|
|||||||
THISDIR = $(realpath $(CURDIR))
|
THISDIR = $(realpath $(CURDIR))
|
||||||
ROOTDIR = $(realpath $(CURDIR)/../..)
|
ROOTDIR = $(realpath $(CURDIR)/../..)
|
||||||
|
DOCKER ?= docker run --rm $(DA) -v $(ROOTDIR):$(ROOTDIR) -w $(THISDIR) docker.io/mdashnet/8266
|
||||||
|
CMD ?= make -C src defconfig app
|
||||||
|
PORT ?= /dev/ttyUSB0
|
||||||
|
|
||||||
all: example
|
all: example
|
||||||
|
|
||||||
example:
|
example:
|
||||||
true
|
true
|
||||||
|
|
||||||
build: src/main/main.c src/main/wifi.c Makefile
|
build: Makefile $(wildcard src/main/*)
|
||||||
docker run --rm -v $(ROOTDIR):$(ROOTDIR) -w $(THISDIR) docker.io/mdashnet/8266 make -C src defconfig app
|
$(DOCKER) $(CMD)
|
||||||
|
|
||||||
|
flash:
|
||||||
|
flash: CMD = python /esp/components/esptool_py/esptool/esptool.py \
|
||||||
|
--chip esp8266 --port $(PORT) --baud 115200 --before default_reset \
|
||||||
|
--after hard_reset write_flash -z --flash_mode dio --flash_freq 40m \
|
||||||
|
--flash_size 2MB 0x10000 $(THISDIR)/src/build/mongoose-example.bin
|
||||||
|
flash: DA = --device $(PORT)
|
||||||
|
flash: build
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
clean: CMD = rm -rf src/build
|
||||||
|
clean: build
|
||||||
|
|
||||||
|
@ -14,5 +14,9 @@ To build this application, follow these steps:
|
|||||||
4. Run `make`. This invokes a Docker-based build. A firmware will be built
|
4. Run `make`. This invokes a Docker-based build. A firmware will be built
|
||||||
in the `src/build/` directory:
|
in the `src/build/` directory:
|
||||||
```sh
|
```sh
|
||||||
make example
|
make build
|
||||||
|
```
|
||||||
|
5. Flash your ESP8266. If you have esptool.py installed, the build process will end telling you the command to flash your device. You can just run `make` again to use Docker:
|
||||||
|
```sh
|
||||||
|
make flash PORT=/your/serial
|
||||||
```
|
```
|
||||||
|
@ -18,7 +18,7 @@ static void cb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|||||||
|
|
||||||
// Event handler for a client connection - fetch the first web page in history
|
// Event handler for a client connection - fetch the first web page in history
|
||||||
// To enable TLS for HTTP,
|
// To enable TLS for HTTP,
|
||||||
// 1. Copy "ca.pem" file to the ESP32 flash FS
|
// 1. Copy "ca.pem" file to the ESP8266 flash FS
|
||||||
// 2. Add TLS init snippet for the connection, see examples/http-client
|
// 2. Add TLS init snippet for the connection, see examples/http-client
|
||||||
static void cb2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
static void cb2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||||
if (ev == MG_EV_CONNECT) {
|
if (ev == MG_EV_CONNECT) {
|
||||||
|
Loading…
Reference in New Issue
Block a user