forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
DIR=~/.platformio/packages/framework-arduinoespressif8266 | ||
PATCH=puya.patch | ||
|
||
#not applied yet? (in upstream or otherwise) | ||
if ! grep FLASH_QUIRK_WRITE_0_TO_1 $DIR/cores/esp8266/Esp.cpp >/dev/null; then | ||
patch -p1 -d $DIR < $PATCH | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
cores/esp8266/Esp.cpp | 16 +++++++++++++++- | ||
1 file changed, 15 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/cores/esp8266/Esp.cpp b/cores/esp8266/Esp.cpp | ||
index f4c0b220..c5c32f74 100644 | ||
--- a/cores/esp8266/Esp.cpp | ||
+++ b/cores/esp8266/Esp.cpp | ||
@@ -501,7 +501,21 @@ bool EspClass::flashEraseSector(uint32_t sector) { | ||
|
||
bool EspClass::flashWrite(uint32_t offset, uint32_t *data, size_t size) { | ||
ets_isr_mask(FLASH_INT_MASK); | ||
- int rc = spi_flash_write(offset, (uint32_t*) data, size); | ||
+ int rc; | ||
+ uint32_t* ptr = data; | ||
+#ifdef FLASH_QUIRK_WRITE_0_TO_1 | ||
+ static uint32_t read_buf[SPI_FLASH_SEC_SIZE / 4]; | ||
+ rc = spi_flash_read(offset, read_buf, size); | ||
+ if (rc != 0) { | ||
+ ets_isr_unmask(FLASH_INT_MASK); | ||
+ return false; | ||
+ } | ||
+ for (size_t i = 0; i < size / 4; ++i) { | ||
+ read_buf[i] &= data[i]; | ||
+ } | ||
+ ptr = read_buf; | ||
+#endif // FLASH_QUIRK_WRITE_0_TO_1 | ||
+ rc = spi_flash_write(offset, ptr, size); | ||
ets_isr_unmask(FLASH_INT_MASK); | ||
return rc == 0; | ||
} | ||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,3 +119,13 @@ framework = arduino | |
board = esp8285 | ||
upload_speed=460800 | ||
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.1m128.ld -D PLUGIN_BUILD_TESTING -D PLUGIN_BUILD_DEV -DESP8285 | ||
|
||
|
||
|
||
#special patched version for PUYA flash chips, see https://github.com/letscontrolit/ESPEasy/issues/650 | ||
[env:dev_ESP8266PUYA_1024] | ||
platform = [email protected] | ||
framework = arduino | ||
board = esp12e | ||
upload_speed=460800 | ||
build_flags = ${common.build_flags} -Wl,-Tesp8266.flash.1m128.ld -D PLUGIN_BUILD_TESTING -D PLUGIN_BUILD_DEV -D FLASH_QUIRK_WRITE_0_TO_1 |