Skip to content

Commit

Permalink
esp: Check in sources for flasher stub
Browse files Browse the repository at this point in the history
Recovered from https://github.com/cesanta/mongoose-os/tree/f626b5113861634e9a4acc96bdb73de29ed8a4d0/common/platforms/
refactored the build system.

Example to rebuild and test esp8266 stub (read flash):
```
  $ make stubs mos && ./mos flash-read --platform esp8266 --esp-baud-rate=1500000 test.bin --v 4 --logtostderr
```

Signed-off-by: Deomid "rojer" Ryabkov <rojer@rojer.me>
  • Loading branch information
rojer committed Oct 24, 2021
1 parent f51db66 commit 7ec8632
Show file tree
Hide file tree
Showing 41 changed files with 11,106 additions and 110 deletions.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.DEFAULT_GOAL := mos
.PHONY: all build clean clean-tools clean-version deploy-fwbuild deploy-mos-binary deps downloads fwbuild-instance fwbuild-manager generate install linux mac mos version win
.PHONY: all build clean clean-tools clean-version deploy-fwbuild deploy-mos-binary deps downloads fwbuild-instance fwbuild-manager generate genstubs install linux mac mos stubs version win

TAG ?= latest

Expand Down Expand Up @@ -57,6 +57,15 @@ vendor/modules.txt:

deps: vendor/modules.txt

genstubs:
cli/flash/esp32/stub/genstub.sh
cli/flash/esp8266/stub/genstub.sh

# Build the flasher stubs
# E.g.:
# make stubs mos && ./mos flash-read --platform esp8266 --esp-baud-rate=1500000 test.bin --v 4 --logtostderr
stubs: genstubs generate

generate: $(GOBIN)/go-bindata $(GOBIN)/go-bindata-assetfs
$(GO) generate \
github.com/mongoose-os/mos/cli/... \
Expand Down
22 changes: 11 additions & 11 deletions cli/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli/flash/esp/flasher/flasher_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ func (fc *FlasherClient) connect(romBaudRate, baudRate uint) error {
var stubJSON []byte
switch fc.ct {
case esp.ChipESP8266:
stubJSON = esp8266.MustAsset("data/stub_flasher.json")
stubJSON = esp8266.MustAsset("stub/stub.json")
case esp.ChipESP32:
stubJSON = esp32.MustAsset("data/stub_flasher.json")
stubJSON = esp32.MustAsset("stub/stub.json")
default:
return errors.Errorf("unknown chip type %d", fc.ct)
}
Expand Down
Loading

0 comments on commit 7ec8632

Please sign in to comment.