Skip to content

Commit 6634415

Browse files
Move the spi vendor list from Esp.h to its own header in eboot.
1 parent e2959ee commit 6634415

File tree

4 files changed

+110
-37
lines changed

4 files changed

+110
-37
lines changed

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/Esp.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ uint32_t EspClass::getFlashChipSizeByChipId(void) {
405405
return (64_kB);
406406

407407
// Winbond
408+
case 0x1840EF: // W25Q128
409+
return (16_MB);
408410
case 0x1640EF: // W25Q32
409411
return (4_MB);
410412
case 0x1540EF: // W25Q16
@@ -424,6 +426,10 @@ uint32_t EspClass::getFlashChipSizeByChipId(void) {
424426
case 0x1340E0: // BG25Q40
425427
return (512_kB);
426428

429+
// XMC - Wuhan Xinxin Semiconductor Manufacturing Corp
430+
case 0x164020: // XM25QH32B
431+
return (4_MB);
432+
427433
default:
428434
return 0;
429435
}

cores/esp8266/Esp.h

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,7 @@
2222
#define ESP_H
2323

2424
#include <Arduino.h>
25-
26-
// Vendor IDs taken from Flashrom project
27-
// https://review.coreboot.org/cgit/flashrom.git/tree/flashchips.h?h=1.0.x
28-
typedef enum {
29-
SPI_FLASH_VENDOR_ALLIANCE = 0x52, /* Alliance Semiconductor */
30-
SPI_FLASH_VENDOR_AMD = 0x01, /* AMD */
31-
SPI_FLASH_VENDOR_AMIC = 0x37, /* AMIC */
32-
SPI_FLASH_VENDOR_ATMEL = 0x1F, /* Atmel (now used by Adesto) */
33-
SPI_FLASH_VENDOR_BRIGHT = 0xAD, /* Bright Microelectronics */
34-
SPI_FLASH_VENDOR_CATALYST = 0x31, /* Catalyst */
35-
SPI_FLASH_VENDOR_EON = 0x1C, /* EON Silicon Devices, missing 0x7F prefix */
36-
SPI_FLASH_VENDOR_ESMT = 0x8C, /* Elite Semiconductor Memory Technology (ESMT) / EFST Elite Flash Storage */
37-
SPI_FLASH_VENDOR_EXCEL = 0x4A, /* ESI, missing 0x7F prefix */
38-
SPI_FLASH_VENDOR_FIDELIX = 0xF8, /* Fidelix */
39-
SPI_FLASH_VENDOR_FUJITSU = 0x04, /* Fujitsu */
40-
SPI_FLASH_VENDOR_GIGADEVICE = 0xC8, /* GigaDevice */
41-
SPI_FLASH_VENDOR_HYUNDAI = 0xAD, /* Hyundai */
42-
SPI_FLASH_VENDOR_INTEL = 0x89, /* Intel */
43-
SPI_FLASH_VENDOR_ISSI = 0xD5, /* ISSI Integrated Silicon Solutions, see also PMC. */
44-
SPI_FLASH_VENDOR_MACRONIX = 0xC2, /* Macronix (MX) */
45-
SPI_FLASH_VENDOR_NANTRONICS = 0xD5, /* Nantronics, missing prefix */
46-
SPI_FLASH_VENDOR_PMC = 0x9D, /* PMC, missing 0x7F prefix */
47-
SPI_FLASH_VENDOR_PUYA = 0x85, /* Puya semiconductor (shanghai) co. ltd */
48-
SPI_FLASH_VENDOR_SANYO = 0x62, /* Sanyo */
49-
SPI_FLASH_VENDOR_SHARP = 0xB0, /* Sharp */
50-
SPI_FLASH_VENDOR_SPANSION = 0x01, /* Spansion, same ID as AMD */
51-
SPI_FLASH_VENDOR_SST = 0xBF, /* SST */
52-
SPI_FLASH_VENDOR_ST = 0x20, /* ST / SGS/Thomson / Numonyx (later acquired by Micron) */
53-
SPI_FLASH_VENDOR_SYNCMOS_MVC = 0x40, /* SyncMOS (SM) and Mosel Vitelic Corporation (MVC) */
54-
SPI_FLASH_VENDOR_TENX = 0x5E, /* Tenx Technologies */
55-
SPI_FLASH_VENDOR_TI = 0x97, /* Texas Instruments */
56-
SPI_FLASH_VENDOR_TI_OLD = 0x01, /* TI chips from last century */
57-
SPI_FLASH_VENDOR_WINBOND = 0xDA, /* Winbond */
58-
SPI_FLASH_VENDOR_WINBOND_NEX = 0xEF, /* Winbond (ex Nexcom) serial flashes */
59-
60-
SPI_FLASH_VENDOR_UNKNOWN = 0xFF
61-
} SPI_FLASH_VENDOR_t;
25+
#include "spi_vendors.h"
6226

6327
/**
6428
* AVR macros for WDT managment

cores/esp8266/spi_vendors.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
28+
/* Definitions are placed in eboot. Include them here rather than duplicate them.
29+
* Also, prefer to have eboot standalone as much as possible and have the core depend on it
30+
* rather than have eboot depend on the core.
31+
*/
32+
#include <../../bootloaders/eboot/spi_vendors.h>
33+
34+
35+
#ifdef __cplusplus
36+
}
37+
#endif
38+
39+
40+
#endif // SPI_VENDORS_H

0 commit comments

Comments
 (0)