Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fabd169

Browse files
d-a-vdevyte
authored andcommittedOct 7, 2019
Puyafix (#6619)
* PUYA was not correctly enabled * remove duplicate
1 parent 75c3834 commit fabd169

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed
 

‎cores/esp8266/Arduino.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,6 @@ void configTime(const char* tz, const char* server1,
285285

286286
#include "pins_arduino.h"
287287

288-
#ifndef PUYA_SUPPORT
289-
#define PUYA_SUPPORT 1
290-
#endif
291-
292288
#endif
293289

294290
#ifdef DEBUG_ESP_OOM

‎cores/esp8266/Esp.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21-
#include "Arduino.h"
21+
#include "Esp.h"
2222
#include "flash_utils.h"
2323
#include "eboot_command.h"
2424
#include <memory>
@@ -36,6 +36,14 @@ extern struct rst_info resetInfo;
3636

3737
//#define DEBUG_SERIAL Serial
3838

39+
#ifndef PUYA_SUPPORT
40+
#define PUYA_SUPPORT 1
41+
#endif
42+
#ifndef PUYA_BUFFER_SIZE
43+
// Good alternative for buffer size is: SPI_FLASH_SEC_SIZE (= 4k)
44+
// Always use a multiple of flash page size (256 bytes)
45+
#define PUYA_BUFFER_SIZE 256
46+
#endif
3947

4048
/**
4149
* User-defined Literals
@@ -577,7 +585,7 @@ bool EspClass::flashEraseSector(uint32_t sector) {
577585
}
578586

579587
#if PUYA_SUPPORT
580-
static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
588+
static SpiFlashOpResult spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
581589
if (data == nullptr) {
582590
return SPI_FLASH_RESULT_ERR;
583591
}
@@ -607,7 +615,7 @@ static int spi_flash_write_puya(uint32_t offset, uint32_t *data, size_t size) {
607615
}
608616
rc = spi_flash_read(pos, flash_write_puya_buf, bytesNow);
609617
if (rc != SPI_FLASH_RESULT_OK) {
610-
return (int)rc;
618+
return rc;
611619
}
612620
for (size_t i = 0; i < bytesNow / 4; ++i) {
613621
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) {
616624
rc = spi_flash_write(pos, flash_write_puya_buf, bytesNow);
617625
pos += bytesNow;
618626
}
619-
return (int)rc;
627+
return rc;
620628
}
621629
#endif
622630

‎cores/esp8266/Esp.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@
2323

2424
#include <Arduino.h>
2525

26-
#ifndef PUYA_SUPPORT
27-
#define PUYA_SUPPORT 0
28-
#endif
29-
#ifndef PUYA_BUFFER_SIZE
30-
// Good alternative for buffer size is: SPI_FLASH_SEC_SIZE (= 4k)
31-
// Always use a multiple of flash page size (256 bytes)
32-
#define PUYA_BUFFER_SIZE 256
33-
#endif
34-
3526
// Vendor IDs taken from Flashrom project
3627
// https://review.coreboot.org/cgit/flashrom.git/tree/flashchips.h?h=1.0.x
3728
typedef enum {

0 commit comments

Comments
 (0)
Please sign in to comment.