Skip to content

Commit

Permalink
Merge branch 'v2.0' into mega
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Feb 14, 2018
2 parents b2db97e + d835ef6 commit fec069b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ script:
# - ./memanalyzer.py ~/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-objdump
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -s

# patch platformio core libs for PUYA bug (https://github.com/letscontrolit/ESPEasy/issues/650)
- cd patches; ./check_puya_patch; cd ..
- PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -s --environment dev_ESP8266PUYA_1024


before_deploy:
- ./before_deploy
- export RELEASE_FILE=$(ls ESPEasy*.zip)
Expand Down
3 changes: 2 additions & 1 deletion before_deploy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ for ENV in \
test_ESP8285_1024\
dev_ESP8266_1024\
dev_ESP8266_4096\
dev_ESP8285_1024;\
dev_ESP8285_1024\
dev_ESP8266PUYA_1024;\
do
echo
echo "### Deploying environment $ENV for version $VERSION"
Expand Down
9 changes: 9 additions & 0 deletions patches/check_puya_patch
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
32 changes: 32 additions & 0 deletions patches/puya.patch
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;
}
--
10 changes: 10 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fec069b

Please sign in to comment.