diff --git a/Sming/Arch/Esp8266/Components/esp8266/Tools/patch-phy-bin.py b/Sming/Arch/Esp8266/Components/esp8266/Tools/patch-phy-bin.py new file mode 100644 index 0000000000..8f38ce38aa --- /dev/null +++ b/Sming/Arch/Esp8266/Components/esp8266/Tools/patch-phy-bin.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +######################################################## +# +# Simple PHY binary patcher +# Author: Slavey Karadzhov +# +######################################################## +import os +import sys + +def usage(): + print("Usage: \n\t%s [offset]" % sys.argv[0]) + +if __name__ == "__main__": + if len(sys.argv) not in list(range(2,4)): + usage() + sys.exit(1) + + offset = 107 + if len(sys.argv) > 2: + offset = int(sys.argv[2]) + + with os.fdopen(os.open(sys.argv[1], os.O_RDWR | os.O_CREAT), 'rb+') as f: + f.seek(offset) + f.write(bytearray(b'\xff')); diff --git a/Sming/Arch/Esp8266/Components/esp8266/component.mk b/Sming/Arch/Esp8266/Components/esp8266/component.mk index afd77a11da..3b9e3a672f 100644 --- a/Sming/Arch/Esp8266/Components/esp8266/component.mk +++ b/Sming/Arch/Esp8266/Components/esp8266/component.mk @@ -5,7 +5,7 @@ SDK_BASE ?= $(COMPONENT_PATH)/ESP8266_NONOS_SDK SDK_BASE := $(call FixPath,$(SDK_BASE)) FLASH_INIT_DATA = $(SDK_BASE)/bin/esp_init_data_default.bin -FLASH_INIT_DATA_VCC = $(SDK_BASE)/bin/esp_init_data_vcc_default.bin +FLASH_INIT_DATA_VCC = $(SDK_BASE)/bin/esp_init_data_vdd_default.bin CUSTOM_TARGETS += $(FLASH_INIT_DATA) $(FLASH_INIT_DATA_VCC) @@ -25,9 +25,11 @@ else SDK_INTERNAL := 0 endif +PHY_TOOL := $(COMPONENT_PATH)/Tools/patch-phy-bin.py + $(FLASH_INIT_DATA_VCC): $(FLASH_INIT_DATA) $(Q) cp $< $@ - $(Q) printf "\377" | dd of=$@ bs=1 seek=107 count=1 conv=notrunc + $(Q) $(PYTHON) $(PHY_TOOL) $@ DEBUG_VARS += SDK_LIBDIR SDK_INCDIR SDK_LIBDIR := $(SDK_BASE)/lib