Commit 0232c13b authored by HuangRui's avatar HuangRui
Browse files

Emergency update, fix flash size auto detection bug.

64Mbit and 128Mbit supported by hardware, but not supported by this SDK 0.9.5. Waiting SDK update.
parent f6b1d3a3
...@@ -57,9 +57,11 @@ uint32_t flash_get_size_byte(void) ...@@ -57,9 +57,11 @@ uint32_t flash_get_size_byte(void)
case SIZE_32MBIT: case SIZE_32MBIT:
// 32Mbit, 4MByte // 32Mbit, 4MByte
flash_size = 4 * 1024 * 1024; flash_size = 4 * 1024 * 1024;
break;
case SIZE_64MBIT: case SIZE_64MBIT:
// 64Mbit, 8MByte // 64Mbit, 8MByte
flash_size = 8 * 1024 * 1024; flash_size = 8 * 1024 * 1024;
break;
case SIZE_128MBIT: case SIZE_128MBIT:
// 128Mbit, 16MByte // 128Mbit, 16MByte
flash_size = 16 * 1024 * 1024; flash_size = 16 * 1024 * 1024;
...@@ -132,7 +134,15 @@ bool flash_set_size_byte(uint32_t size) ...@@ -132,7 +134,15 @@ bool flash_set_size_byte(uint32_t size)
uint16_t flash_get_sec_num(void) uint16_t flash_get_sec_num(void)
{ {
return flash_get_size_byte() / SPI_FLASH_SEC_SIZE; //static uint16_t sec_num = 0;
// return flash_get_size_byte() / (SPI_FLASH_SEC_SIZE);
// c_printf("\nflash_get_size_byte()=%d\n", ( flash_get_size_byte() / (SPI_FLASH_SEC_SIZE) ));
// if( sec_num == 0 )
//{
// sec_num = 4 * 1024 * 1024 / (SPI_FLASH_SEC_SIZE);
//}
//return sec_num;
return ( flash_get_size_byte() / (SPI_FLASH_SEC_SIZE) );
} }
uint8_t flash_get_mode(void) uint8_t flash_get_mode(void)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "ets_sys.h" #include "ets_sys.h"
#include "user_config.h" #include "user_config.h"
#include "cpu_esp8266.h" #include "cpu_esp8266.h"
#define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS) #define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS)
/****************************************************************************** /******************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment