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.
This commit is contained in:
HuangRui 2015-02-15 02:13:58 +08:00
parent f6b1d3a399
commit 0232c13b83
2 changed files with 12 additions and 1 deletions

View File

@ -57,9 +57,11 @@ uint32_t flash_get_size_byte(void)
case SIZE_32MBIT:
// 32Mbit, 4MByte
flash_size = 4 * 1024 * 1024;
break;
case SIZE_64MBIT:
// 64Mbit, 8MByte
flash_size = 8 * 1024 * 1024;
break;
case SIZE_128MBIT:
// 128Mbit, 16MByte
flash_size = 16 * 1024 * 1024;
@ -132,7 +134,15 @@ bool flash_set_size_byte(uint32_t size)
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)

View File

@ -3,6 +3,7 @@
#include "ets_sys.h"
#include "user_config.h"
#include "cpu_esp8266.h"
#define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS)
/******************************************************************************