Skip to content

Commit d661ac6

Browse files
Merge branch 'master' of https://github.com/esp8266/Arduino into gcc9.1
2 parents 7926828 + a9cf12f commit d661ac6

File tree

91 files changed

+5285
-1570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+5285
-1570
lines changed

boards.txt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,63 @@ esp8285.menu.eesz.1M.build.flash_ld=eagle.flash.1m.ld
625625
esp8285.menu.eesz.1M.build.spiffs_pagesize=256
626626
esp8285.menu.eesz.1M.upload.maximum_size=1023984
627627
esp8285.menu.eesz.1M.build.rfcal_addr=0xFC000
628+
esp8285.menu.eesz.2M64=2MB (FS:64KB OTA:~992KB)
629+
esp8285.menu.eesz.2M64.build.flash_size=2M
630+
esp8285.menu.eesz.2M64.build.flash_size_bytes=0x200000
631+
esp8285.menu.eesz.2M64.build.flash_ld=eagle.flash.2m64.ld
632+
esp8285.menu.eesz.2M64.build.spiffs_pagesize=256
633+
esp8285.menu.eesz.2M64.upload.maximum_size=1044464
634+
esp8285.menu.eesz.2M64.build.rfcal_addr=0x1FC000
635+
esp8285.menu.eesz.2M64.build.spiffs_start=0x1F0000
636+
esp8285.menu.eesz.2M64.build.spiffs_end=0x1FB000
637+
esp8285.menu.eesz.2M64.build.spiffs_blocksize=4096
638+
esp8285.menu.eesz.2M128=2MB (FS:128KB OTA:~960KB)
639+
esp8285.menu.eesz.2M128.build.flash_size=2M
640+
esp8285.menu.eesz.2M128.build.flash_size_bytes=0x200000
641+
esp8285.menu.eesz.2M128.build.flash_ld=eagle.flash.2m128.ld
642+
esp8285.menu.eesz.2M128.build.spiffs_pagesize=256
643+
esp8285.menu.eesz.2M128.upload.maximum_size=1044464
644+
esp8285.menu.eesz.2M128.build.rfcal_addr=0x1FC000
645+
esp8285.menu.eesz.2M128.build.spiffs_start=0x1E0000
646+
esp8285.menu.eesz.2M128.build.spiffs_end=0x1FB000
647+
esp8285.menu.eesz.2M128.build.spiffs_blocksize=4096
648+
esp8285.menu.eesz.2M256=2MB (FS:256KB OTA:~896KB)
649+
esp8285.menu.eesz.2M256.build.flash_size=2M
650+
esp8285.menu.eesz.2M256.build.flash_size_bytes=0x200000
651+
esp8285.menu.eesz.2M256.build.flash_ld=eagle.flash.2m256.ld
652+
esp8285.menu.eesz.2M256.build.spiffs_pagesize=256
653+
esp8285.menu.eesz.2M256.upload.maximum_size=1044464
654+
esp8285.menu.eesz.2M256.build.rfcal_addr=0x1FC000
655+
esp8285.menu.eesz.2M256.build.spiffs_start=0x1C0000
656+
esp8285.menu.eesz.2M256.build.spiffs_end=0x1FB000
657+
esp8285.menu.eesz.2M256.build.spiffs_blocksize=4096
658+
esp8285.menu.eesz.2M512=2MB (FS:512KB OTA:~768KB)
659+
esp8285.menu.eesz.2M512.build.flash_size=2M
660+
esp8285.menu.eesz.2M512.build.flash_size_bytes=0x200000
661+
esp8285.menu.eesz.2M512.build.flash_ld=eagle.flash.2m512.ld
662+
esp8285.menu.eesz.2M512.build.spiffs_pagesize=256
663+
esp8285.menu.eesz.2M512.upload.maximum_size=1044464
664+
esp8285.menu.eesz.2M512.build.rfcal_addr=0x1FC000
665+
esp8285.menu.eesz.2M512.build.spiffs_start=0x180000
666+
esp8285.menu.eesz.2M512.build.spiffs_end=0x1FA000
667+
esp8285.menu.eesz.2M512.build.spiffs_blocksize=8192
668+
esp8285.menu.eesz.2M1M=2MB (FS:1MB OTA:~512KB)
669+
esp8285.menu.eesz.2M1M.build.flash_size=2M
670+
esp8285.menu.eesz.2M1M.build.flash_size_bytes=0x200000
671+
esp8285.menu.eesz.2M1M.build.flash_ld=eagle.flash.2m1m.ld
672+
esp8285.menu.eesz.2M1M.build.spiffs_pagesize=256
673+
esp8285.menu.eesz.2M1M.upload.maximum_size=1044464
674+
esp8285.menu.eesz.2M1M.build.rfcal_addr=0x1FC000
675+
esp8285.menu.eesz.2M1M.build.spiffs_start=0x100000
676+
esp8285.menu.eesz.2M1M.build.spiffs_end=0x1FA000
677+
esp8285.menu.eesz.2M1M.build.spiffs_blocksize=8192
678+
esp8285.menu.eesz.2M=2MB (FS:none OTA:~1019KB)
679+
esp8285.menu.eesz.2M.build.flash_size=2M
680+
esp8285.menu.eesz.2M.build.flash_size_bytes=0x200000
681+
esp8285.menu.eesz.2M.build.flash_ld=eagle.flash.2m.ld
682+
esp8285.menu.eesz.2M.build.spiffs_pagesize=256
683+
esp8285.menu.eesz.2M.upload.maximum_size=1044464
684+
esp8285.menu.eesz.2M.build.rfcal_addr=0x1FC000
628685
esp8285.menu.led.2=2
629686
esp8285.menu.led.2.build.led=-DLED_BUILTIN=2
630687
esp8285.menu.led.0=0

bootloaders/eboot/eboot.c

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <string.h>
1313
#include "flash.h"
1414
#include "eboot_command.h"
15+
#include "spi_vendors.h"
1516
#include <uzlib.h>
1617

1718
extern unsigned char _gzip_dict;
@@ -189,6 +190,28 @@ int copy_raw(const uint32_t src_addr,
189190
return 0;
190191
}
191192

193+
#define XMC_SUPPORT
194+
#ifdef XMC_SUPPORT
195+
// Define a few SPI0 registers we need access to
196+
#define ESP8266_REG(addr) *((volatile uint32_t *)(0x60000000+(addr)))
197+
#define SPI0CMD ESP8266_REG(0x200)
198+
#define SPI0CLK ESP8266_REG(0x218)
199+
#define SPI0C ESP8266_REG(0x208)
200+
#define SPI0W0 ESP8266_REG(0x240)
201+
202+
#define SPICMDRDID (1 << 28)
203+
204+
/* spi_flash_get_id()
205+
Returns the flash chip ID - same as the SDK function.
206+
We need our own version as the SDK isn't available here.
207+
*/
208+
uint32_t __attribute__((noinline)) spi_flash_get_id() {
209+
SPI0W0=0;
210+
SPI0CMD=SPICMDRDID;
211+
while (SPI0CMD) {}
212+
return SPI0W0;
213+
}
214+
#endif // XMC_SUPPORT
192215

193216
int main()
194217
{
@@ -211,9 +234,48 @@ int main()
211234

212235
if (cmd.action == ACTION_COPY_RAW) {
213236
ets_putc('c'); ets_putc('p'); ets_putc(':');
237+
238+
#ifdef XMC_SUPPORT
239+
// save the flash access speed registers
240+
uint32_t spi0clk = SPI0CLK;
241+
uint32_t spi0c = SPI0C;
242+
243+
uint32_t vendor = spi_flash_get_id() & 0x000000ff;
244+
if (vendor == SPI_FLASH_VENDOR_XMC) {
245+
uint32_t flashinfo=0;
246+
if (SPIRead(0, &flashinfo, 4)) {
247+
// failed to read the configured flash speed.
248+
// Do not change anything,
249+
} else {
250+
// select an appropriate flash speed
251+
// Register values are those used by ROM
252+
switch ((flashinfo >> 24) & 0x0f) {
253+
case 0x0: // 40MHz, slow to 20
254+
case 0x1: // 26MHz, slow to 20
255+
SPI0CLK = 0x00003043;
256+
SPI0C = 0x00EAA313;
257+
break;
258+
case 0x2: // 20MHz, no change
259+
break;
260+
case 0xf: // 80MHz, slow to 26
261+
SPI0CLK = 0x00002002;
262+
SPI0C = 0x00EAA202;
263+
break;
264+
default:
265+
break;
266+
}
267+
}
268+
}
269+
#endif // XMC_SUPPORT
214270
ets_wdt_disable();
215271
res = copy_raw(cmd.args[0], cmd.args[1], cmd.args[2]);
216272
ets_wdt_enable();
273+
274+
#ifdef XMC_SUPPORT
275+
// restore the saved flash access speed registers
276+
SPI0CLK = spi0clk;
277+
SPI0C = spi0c;
278+
#endif
217279
ets_putc('0'+res); ets_putc('\n');
218280
if (res == 0) {
219281
cmd.action = ACTION_LOAD_APP;

bootloaders/eboot/eboot.elf

1.98 KB
Binary file not shown.

bootloaders/eboot/spi_vendors.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
spi_vendors.h - Vendor IDs for SPI chips
3+
Copyright (c) 2019 Mike Nix. All rights reserved.
4+
This file is part of the esp8266 core for Arduino environment.
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#ifndef __SPI_VENDORS_H__
22+
#define __SPI_VENDORS_H__
23+
24+
// Vendor IDs taken from Flashrom project
25+
// https://review.coreboot.org/cgit/flashrom.git/tree/flashchips.h?h=1.0.x
26+
// Moved here from ../../cores/esp8266/Esp.h
27+
typedef enum {
28+
SPI_FLASH_VENDOR_ALLIANCE = 0x52, /* Alliance Semiconductor */
29+
SPI_FLASH_VENDOR_AMD = 0x01, /* AMD */
30+
SPI_FLASH_VENDOR_AMIC = 0x37, /* AMIC */
31+
SPI_FLASH_VENDOR_ATMEL = 0x1F, /* Atmel (now used by Adesto) */
32+
SPI_FLASH_VENDOR_BRIGHT = 0xAD, /* Bright Microelectronics */
33+
SPI_FLASH_VENDOR_CATALYST = 0x31, /* Catalyst */
34+
SPI_FLASH_VENDOR_EON = 0x1C, /* EON Silicon Devices, missing 0x7F prefix */
35+
SPI_FLASH_VENDOR_ESMT = 0x8C, /* Elite Semiconductor Memory Technology (ESMT) / EFST Elite Flash Storage */
36+
SPI_FLASH_VENDOR_EXCEL = 0x4A, /* ESI, missing 0x7F prefix */
37+
SPI_FLASH_VENDOR_FIDELIX = 0xF8, /* Fidelix */
38+
SPI_FLASH_VENDOR_FUJITSU = 0x04, /* Fujitsu */
39+
SPI_FLASH_VENDOR_GIGADEVICE = 0xC8, /* GigaDevice */
40+
SPI_FLASH_VENDOR_HYUNDAI = 0xAD, /* Hyundai */
41+
SPI_FLASH_VENDOR_INTEL = 0x89, /* Intel */
42+
SPI_FLASH_VENDOR_ISSI = 0xD5, /* ISSI Integrated Silicon Solutions, see also PMC. */
43+
SPI_FLASH_VENDOR_MACRONIX = 0xC2, /* Macronix (MX) */
44+
SPI_FLASH_VENDOR_NANTRONICS = 0xD5, /* Nantronics, missing prefix */
45+
SPI_FLASH_VENDOR_PMC = 0x9D, /* PMC, missing 0x7F prefix */
46+
SPI_FLASH_VENDOR_PUYA = 0x85, /* Puya semiconductor (shanghai) co. ltd */
47+
SPI_FLASH_VENDOR_SANYO = 0x62, /* Sanyo */
48+
SPI_FLASH_VENDOR_SHARP = 0xB0, /* Sharp */
49+
SPI_FLASH_VENDOR_SPANSION = 0x01, /* Spansion, same ID as AMD */
50+
SPI_FLASH_VENDOR_SST = 0xBF, /* SST */
51+
SPI_FLASH_VENDOR_ST = 0x20, /* ST / SGS/Thomson / Numonyx (later acquired by Micron) */
52+
SPI_FLASH_VENDOR_SYNCMOS_MVC = 0x40, /* SyncMOS (SM) and Mosel Vitelic Corporation (MVC) */
53+
SPI_FLASH_VENDOR_TENX = 0x5E, /* Tenx Technologies */
54+
SPI_FLASH_VENDOR_TI = 0x97, /* Texas Instruments */
55+
SPI_FLASH_VENDOR_TI_OLD = 0x01, /* TI chips from last century */
56+
SPI_FLASH_VENDOR_WINBOND = 0xDA, /* Winbond */
57+
SPI_FLASH_VENDOR_WINBOND_NEX = 0xEF, /* Winbond (ex Nexcom) serial flashes */
58+
SPI_FLASH_VENDOR_XMC = 0x20, /* Wuhan Xinxin Semiconductor Manufacturing Corp */
59+
60+
SPI_FLASH_VENDOR_UNKNOWN = 0xFF
61+
} SPI_FLASH_VENDOR_t;
62+
63+
#endif // __SPI_VENDORS_H__

cores/esp8266/Arduino.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ long secureRandom(long);
271271
long secureRandom(long, long);
272272
long map(long, long, long, long, long);
273273

274+
void setTZ(const char* tz);
275+
274276
void configTime(int timezone, int daylightOffset_sec, const char* server1,
275277
const char* server2 = nullptr, const char* server3 = nullptr);
276278

0 commit comments

Comments
 (0)