1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00
* PUYA was not correctly enabled

* remove duplicate
This commit is contained in:
david gauchard 2019-10-08 00:31:30 +02:00 committed by Develo
parent 75c3834c8f
commit fabd169abc
3 changed files with 12 additions and 17 deletions

View File

@ -285,10 +285,6 @@ void configTime(const char* tz, const char* server1,
#include "pins_arduino.h" #include "pins_arduino.h"
#ifndef PUYA_SUPPORT
#define PUYA_SUPPORT 1
#endif
#endif #endif
#ifdef DEBUG_ESP_OOM #ifdef DEBUG_ESP_OOM

View File

@ -18,7 +18,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "Arduino.h" #include "Esp.h"
#include "flash_utils.h" #include "flash_utils.h"
#include "eboot_command.h" #include "eboot_command.h"
#include <memory> #include <memory>
@ -36,6 +36,14 @@ extern struct rst_info resetInfo;
//#define DEBUG_SERIAL Serial //#define DEBUG_SERIAL Serial
#ifndef PUYA_SUPPORT
#define PUYA_SUPPORT 1
#endif
#ifndef PUYA_BUFFER_SIZE
// Good alternative for buffer size is: SPI_FLASH_SEC_SIZE (= 4k)
// Always use a multiple of flash page size (256 bytes)
#define PUYA_BUFFER_SIZE 256
#endif
/** /**
* User-defined Literals * User-defined Literals
@ -577,7 +585,7 @@ bool EspClass::flashEraseSector(uint32_t sector) {
} }
#if PUYA_SUPPORT #if PUYA_SUPPORT
static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) { static SpiFlashOpResult spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
if (data == nullptr) { if (data == nullptr) {
return SPI_FLASH_RESULT_ERR; return SPI_FLASH_RESULT_ERR;
} }
@ -607,7 +615,7 @@ static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
} }
rc = spi_flash_read(pos, flash_write_puya_buf, bytesNow); rc = spi_flash_read(pos, flash_write_puya_buf, bytesNow);
if (rc != SPI_FLASH_RESULT_OK) { if (rc != SPI_FLASH_RESULT_OK) {
return (int)rc; return rc;
} }
for (size_t i = 0; i < bytesNow / 4; ++i) { for (size_t i = 0; i < bytesNow / 4; ++i) {
flash_write_puya_buf[i] &= *ptr; flash_write_puya_buf[i] &= *ptr;
@ -616,7 +624,7 @@ static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
rc = spi_flash_write(pos, flash_write_puya_buf, bytesNow); rc = spi_flash_write(pos, flash_write_puya_buf, bytesNow);
pos += bytesNow; pos += bytesNow;
} }
return (int)rc; return rc;
} }
#endif #endif

View File

@ -23,15 +23,6 @@
#include <Arduino.h> #include <Arduino.h>
#ifndef PUYA_SUPPORT
#define PUYA_SUPPORT 0
#endif
#ifndef PUYA_BUFFER_SIZE
// Good alternative for buffer size is: SPI_FLASH_SEC_SIZE (= 4k)
// Always use a multiple of flash page size (256 bytes)
#define PUYA_BUFFER_SIZE 256
#endif
// Vendor IDs taken from Flashrom project // Vendor IDs taken from Flashrom project
// https://review.coreboot.org/cgit/flashrom.git/tree/flashchips.h?h=1.0.x // https://review.coreboot.org/cgit/flashrom.git/tree/flashchips.h?h=1.0.x
typedef enum { typedef enum {