Browse Source

More information about the flash layout on boot log

fastled
Xose Pérez 7 years ago
parent
commit
8f05054f55
6 changed files with 40 additions and 14 deletions
  1. +1
    -1
      code/esp8266.flash.1m0.ld
  2. +1
    -0
      code/espurna/config/general.h
  3. +28
    -10
      code/espurna/espurna.ino
  4. +2
    -2
      code/espurna/ota.ino
  5. +7
    -0
      code/espurna/settings.ino
  6. +1
    -1
      code/espurna/wifi.ino

+ 1
- 1
code/esp8266.flash.1m0.ld View File

@ -1,5 +1,5 @@
/* Flash Split for 1M chips */ /* Flash Split for 1M chips */
/* sketch 999KB */
/* sketch 1004KB */
/* eeprom 20KB */ /* eeprom 20KB */
MEMORY MEMORY


+ 1
- 0
code/espurna/config/general.h View File

@ -55,6 +55,7 @@
// EEPROM // EEPROM
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#define EEPROM_SIZE 4096 // EEPROM size in bytes
#define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte) #define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte)
#define EEPROM_ENERGY_COUNT 1 // Address for the energy counter (4 bytes) #define EEPROM_ENERGY_COUNT 1 // Address for the energy counter (4 bytes)
#define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte) #define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte)


+ 28
- 10
code/espurna/espurna.ino View File

@ -119,9 +119,9 @@ unsigned char customReset() {
void hardwareSetup() { void hardwareSetup() {
EEPROM.begin(4096);
EEPROM.begin(EEPROM_SIZE);
#ifdef DEBUG_PORT
#if ENABLE_SERIAL_DEBUG
DEBUG_PORT.begin(SERIAL_BAUDRATE); DEBUG_PORT.begin(SERIAL_BAUDRATE);
if (customReset() == CUSTOM_RESET_HARDWARE) { if (customReset() == CUSTOM_RESET_HARDWARE) {
DEBUG_PORT.setDebugOutput(true); DEBUG_PORT.setDebugOutput(true);
@ -151,13 +151,35 @@ void hardwareLoop() {
// BOOTING // BOOTING
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
unsigned int sectors(size_t size) {
return (int) (size + SPI_FLASH_SEC_SIZE - 1) / SPI_FLASH_SEC_SIZE;
}
void welcome() { void welcome() {
DEBUG_MSG_P(PSTR("\n\n"));
DEBUG_MSG_P(PSTR("%s %s\n"), (char *) APP_NAME, (char *) APP_VERSION); DEBUG_MSG_P(PSTR("%s %s\n"), (char *) APP_NAME, (char *) APP_VERSION);
DEBUG_MSG_P(PSTR("%s\n%s\n\n"), (char *) APP_AUTHOR, (char *) APP_WEBSITE); DEBUG_MSG_P(PSTR("%s\n%s\n\n"), (char *) APP_AUTHOR, (char *) APP_WEBSITE);
DEBUG_MSG_P(PSTR("ChipID: %06X\n"), ESP.getChipId());
DEBUG_MSG_P(PSTR("CPU chip ID: 0x%06X\n"), ESP.getChipId());
DEBUG_MSG_P(PSTR("CPU frequency: %d MHz\n"), ESP.getCpuFreqMHz()); DEBUG_MSG_P(PSTR("CPU frequency: %d MHz\n"), ESP.getCpuFreqMHz());
DEBUG_MSG_P(PSTR("SDK version: %s\n"), ESP.getSdkVersion());
DEBUG_MSG_P(PSTR("Core version: %s\n"), ESP.getCoreVersion().c_str());
DEBUG_MSG_P(PSTR("\n"));
FlashMode_t mode = ESP.getFlashChipMode();
DEBUG_MSG_P(PSTR("Flash chip ID: 0x%06X\n"), ESP.getFlashChipId());
DEBUG_MSG_P(PSTR("Flash speed: %u Hz\n"), ESP.getFlashChipSpeed());
DEBUG_MSG_P(PSTR("Flash mode: %s\n"), mode == FM_QIO ? "QIO" : mode == FM_QOUT ? "QOUT" : mode == FM_DIO ? "DIO" : mode == FM_DOUT ? "DOUT" : "UNKNOWN");
DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("Flash sector size: %8u bytes\n"), SPI_FLASH_SEC_SIZE);
DEBUG_MSG_P(PSTR("Flash size (SDK): %8u bytes\n"), ESP.getFlashChipSize());
DEBUG_MSG_P(PSTR("Flash size (CHIP): %8u bytes / %4d sectors\n"), ESP.getFlashChipRealSize(), sectors(ESP.getFlashChipRealSize()));
DEBUG_MSG_P(PSTR("Firmware size: %8u bytes / %4d sectors\n"), ESP.getSketchSize(), sectors(ESP.getSketchSize()));
DEBUG_MSG_P(PSTR("OTA size: %8u bytes / %4d sectors\n"), ESP.getFreeSketchSpace(), sectors(ESP.getFreeSketchSpace()));
DEBUG_MSG_P(PSTR("EEPROM size: %8u bytes / %4d sectors\n"), settingsMaxSize(), sectors(settingsMaxSize()));
DEBUG_MSG_P(PSTR("Empty space: %8u bytes / 4 sectors\n"), 4 * SPI_FLASH_SEC_SIZE);
DEBUG_MSG_P(PSTR("\n"));
unsigned char custom_reset = customReset(); unsigned char custom_reset = customReset();
if (custom_reset > 0) { if (custom_reset > 0) {
char buffer[32]; char buffer[32];
@ -166,16 +188,12 @@ void welcome() {
} else { } else {
DEBUG_MSG_P(PSTR("Last reset reason: %s\n"), (char *) ESP.getResetReason().c_str()); DEBUG_MSG_P(PSTR("Last reset reason: %s\n"), (char *) ESP.getResetReason().c_str());
} }
DEBUG_MSG_P(PSTR("Memory size (SDK): %d bytes\n"), ESP.getFlashChipSize());
DEBUG_MSG_P(PSTR("Memory size (CHIP): %d bytes\n"), ESP.getFlashChipRealSize());
DEBUG_MSG_P(PSTR("Free heap: %d bytes\n"), ESP.getFreeHeap());
DEBUG_MSG_P(PSTR("Firmware size: %d bytes\n"), ESP.getSketchSize());
DEBUG_MSG_P(PSTR("Free firmware space: %d bytes\n"), ESP.getFreeSketchSpace());
DEBUG_MSG_P(PSTR("Free heap: %u bytes\n"), ESP.getFreeHeap());
#if ENABLE_SPIFFS #if ENABLE_SPIFFS
FSInfo fs_info; FSInfo fs_info;
if (SPIFFS.info(fs_info)) { if (SPIFFS.info(fs_info)) {
DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("File system total size: %d bytes\n"), fs_info.totalBytes); DEBUG_MSG_P(PSTR("File system total size: %d bytes\n"), fs_info.totalBytes);
DEBUG_MSG_P(PSTR(" used size : %d bytes\n"), fs_info.usedBytes); DEBUG_MSG_P(PSTR(" used size : %d bytes\n"), fs_info.usedBytes);
DEBUG_MSG_P(PSTR(" block size: %d bytes\n"), fs_info.blockSize); DEBUG_MSG_P(PSTR(" block size: %d bytes\n"), fs_info.blockSize);


+ 2
- 2
code/espurna/ota.ino View File

@ -39,8 +39,8 @@ void otaSetup() {
}); });
ArduinoOTA.onError([](ota_error_t error) { ArduinoOTA.onError([](ota_error_t error) {
#if DEBUG_PORT
DEBUG_MSG_P(PSTR("\n[OTA] Error[%u]: "), error);
#if ENABLE_SERIAL_DEBUG || ENABLE_UDP_DEBUG
DEBUG_MSG_P(PSTR("\n[OTA] Error #%u: "), error);
if (error == OTA_AUTH_ERROR) DEBUG_MSG_P(PSTR("Auth Failed\n")); if (error == OTA_AUTH_ERROR) DEBUG_MSG_P(PSTR("Auth Failed\n"));
else if (error == OTA_BEGIN_ERROR) DEBUG_MSG_P(PSTR("Begin Failed\n")); else if (error == OTA_BEGIN_ERROR) DEBUG_MSG_P(PSTR("Begin Failed\n"));
else if (error == OTA_CONNECT_ERROR) DEBUG_MSG_P(PSTR("Connect Failed\n")); else if (error == OTA_CONNECT_ERROR) DEBUG_MSG_P(PSTR("Connect Failed\n"));


+ 7
- 0
code/espurna/settings.ino View File

@ -23,6 +23,13 @@ Embedis embedis(Serial);
// Settings // Settings
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
size_t settingsMaxSize() {
size_t size = EEPROM_SIZE;
if (size > SPI_FLASH_SEC_SIZE) size = SPI_FLASH_SEC_SIZE;
size = (size + 3) & (~3);
return size;
}
unsigned long settingsSize() { unsigned long settingsSize() {
unsigned pos = SPI_FLASH_SEC_SIZE - 1; unsigned pos = SPI_FLASH_SEC_SIZE - 1;
while (size_t len = EEPROM.read(pos)) { while (size_t len = EEPROM.read(pos)) {


+ 1
- 1
code/espurna/wifi.ino View File

@ -123,7 +123,7 @@ void wifiSetup() {
// Message callbacks // Message callbacks
jw.onMessage([](justwifi_messages_t code, char * parameter) { jw.onMessage([](justwifi_messages_t code, char * parameter) {
#ifdef DEBUG_PORT
#if ENABLE_SERIAL_DEBUG || ENABLE_UDP_DEBUG
if (code == MESSAGE_SCANNING) { if (code == MESSAGE_SCANNING) {
DEBUG_MSG_P(PSTR("[WIFI] Scanning\n")); DEBUG_MSG_P(PSTR("[WIFI] Scanning\n"));


Loading…
Cancel
Save