Skip to content

Commit

Permalink
Add support for 8 and 16 MB Flash (esp8266#2351)
Browse files Browse the repository at this point in the history
Add to core dev config initially
  • Loading branch information
me-no-dev authored and igrr committed Aug 1, 2016
1 parent b7c7bc0 commit f50a6c0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
19 changes: 19 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1826,9 +1826,28 @@ coredev.menu.FlashSize.4M3M.build.flash_size=4M
coredev.menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
coredev.menu.FlashSize.4M3M.build.spiffs_start=0x100000
coredev.menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
coredev.menu.FlashSize.4M3M.build.spiffs_pagesize=256
coredev.menu.FlashSize.4M3M.build.spiffs_blocksize=8192
coredev.menu.FlashSize.4M3M.upload.maximum_size=1044464

coredev.menu.FlashSize.8M7M=8M (7M SPIFFS)
coredev.menu.FlashSize.8M7M.build.flash_size=8M
coredev.menu.FlashSize.8M7M.build.flash_ld=eagle.flash.8m.ld
coredev.menu.FlashSize.8M7M.build.spiffs_start=0x100000
coredev.menu.FlashSize.8M7M.build.spiffs_end=0x7FB000
coredev.menu.FlashSize.8M7M.build.spiffs_pagesize=256
coredev.menu.FlashSize.8M7M.build.spiffs_blocksize=8192
coredev.menu.FlashSize.8M7M.upload.maximum_size=1044464

coredev.menu.FlashSize.16M15M=16M (15M SPIFFS)
coredev.menu.FlashSize.16M15M.build.flash_size=16M
coredev.menu.FlashSize.16M15M.build.flash_ld=eagle.flash.16m.ld
coredev.menu.FlashSize.16M15M.build.spiffs_start=0x100000
coredev.menu.FlashSize.16M15M.build.spiffs_end=0x17FB000
coredev.menu.FlashSize.16M15M.build.spiffs_pagesize=256
coredev.menu.FlashSize.16M15M.build.spiffs_blocksize=8192
coredev.menu.FlashSize.16M15M.upload.maximum_size=1044464

coredev.menu.ResetMethod.ck=ck
coredev.menu.ResetMethod.ck.upload.resetmethod=ck
coredev.menu.ResetMethod.nodemcu=nodemcu
Expand Down
21 changes: 9 additions & 12 deletions cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,10 @@ uint32_t EspClass::magicFlashChipSize(uint8_t byte) {
return (2_MB);
case 0x4: // 32 MBit (4MB)
return (4_MB);
case 0x5: // 64 MBit (8MB)
case 0x8: // 64 MBit (8MB)
return (8_MB);
case 0x6: // 128 MBit (16MB)
case 0x9: // 128 MBit (16MB)
return (16_MB);
case 0x7: // 256 MBit (32MB)
return (32_MB);
default: // fail?
return 0;
}
Expand Down Expand Up @@ -363,19 +361,19 @@ bool EspClass::checkFlashConfig(bool needsEquals) {

String EspClass::getResetReason(void) {
char buff[32];
if (resetInfo.reason == REASON_DEFAULT_RST) { // normal startup by power on
if (resetInfo.reason == REASON_DEFAULT_RST) { // normal startup by power on
strcpy_P(buff, PSTR("Power on"));
} else if (resetInfo.reason == REASON_WDT_RST) { // hardware watch dog reset
strcpy_P(buff, PSTR("Hardware Watchdog"));
} else if (resetInfo.reason == REASON_EXCEPTION_RST) { // exception reset, GPIO status won’t change
} else if (resetInfo.reason == REASON_EXCEPTION_RST) { // exception reset, GPIO status won’t change
strcpy_P(buff, PSTR("Exception"));
} else if (resetInfo.reason == REASON_SOFT_WDT_RST) { // software watch dog reset, GPIO status won’t change
} else if (resetInfo.reason == REASON_SOFT_WDT_RST) { // software watch dog reset, GPIO status won’t change
strcpy_P(buff, PSTR("Software Watchdog"));
} else if (resetInfo.reason == REASON_SOFT_RESTART) { // software restart ,system_restart , GPIO status won’t change
} else if (resetInfo.reason == REASON_SOFT_RESTART) { // software restart ,system_restart , GPIO status won’t change
strcpy_P(buff, PSTR("Software/System restart"));
} else if (resetInfo.reason == REASON_DEEP_SLEEP_AWAKE) { // wake up from deep-sleep
} else if (resetInfo.reason == REASON_DEEP_SLEEP_AWAKE) { // wake up from deep-sleep
strcpy_P(buff, PSTR("Deep-Sleep Wake"));
} else if (resetInfo.reason == REASON_EXT_SYS_RST) { // external system reset
} else if (resetInfo.reason == REASON_EXT_SYS_RST) { // external system reset
strcpy_P(buff, PSTR("External System"));
} else {
strcpy_P(buff, PSTR("Unknown"));
Expand Down Expand Up @@ -548,5 +546,4 @@ String EspClass::getSketchMD5()
md5.calculate();
result = md5.toString();
return result;
}

}
2 changes: 1 addition & 1 deletion cores/esp8266/flash_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef struct {
/* SPI Flash Interface (0 = QIO, 1 = QOUT, 2 = DIO, 0x3 = DOUT) */
unsigned char flash_mode;

/* High four bits: 0 = 512K, 1 = 256K, 2 = 1M, 3 = 2M, 4 = 4M,
/* High four bits: 0 = 512K, 1 = 256K, 2 = 1M, 3 = 2M, 4 = 4M, 8 = 8M, 9 = 16M
Low four bits: 0 = 40MHz, 1= 26MHz, 2 = 20MHz, 0xf = 80MHz */
unsigned char flash_size_freq;

Expand Down
2 changes: 1 addition & 1 deletion tools/sdk/ld/eagle.flash.16m.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MEMORY
}

PROVIDE ( _SPIFFS_start = 0x40300000 );
PROVIDE ( _SPIFFS_end = 0x41200000 );
PROVIDE ( _SPIFFS_end = 0x411FB000 );
PROVIDE ( _SPIFFS_page = 0x100 );
PROVIDE ( _SPIFFS_block = 0x2000 );

Expand Down
2 changes: 1 addition & 1 deletion tools/sdk/ld/eagle.flash.8m.ld
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MEMORY
}

PROVIDE ( _SPIFFS_start = 0x40300000 );
PROVIDE ( _SPIFFS_end = 0x40A00000 );
PROVIDE ( _SPIFFS_end = 0x409FB000 );
PROVIDE ( _SPIFFS_page = 0x100 );
PROVIDE ( _SPIFFS_block = 0x2000 );

Expand Down

0 comments on commit f50a6c0

Please sign in to comment.