ESP8266_RTOS_SDK  v1.4.0
Macros | Enumerations | Functions
Boot APIs

boot APIs More...

Macros

#define SYS_BOOT_ENHANCE_MODE   0
 
#define SYS_BOOT_NORMAL_MODE   1
 
#define SYS_BOOT_NORMAL_BIN   0
 
#define SYS_BOOT_TEST_BIN   1
 
#define SYS_CPU_80MHZ   80
 
#define SYS_CPU_160MHZ   160
 

Enumerations

enum  flash_size_map {
  FLASH_SIZE_4M_MAP_256_256 = 0, FLASH_SIZE_2M, FLASH_SIZE_8M_MAP_512_512, FLASH_SIZE_16M_MAP_512_512,
  FLASH_SIZE_32M_MAP_512_512, FLASH_SIZE_16M_MAP_1024_1024, FLASH_SIZE_32M_MAP_1024_1024
}
 

Functions

uint8 system_get_boot_version (void)
 Get information of the boot version. More...
 
uint32 system_get_userbin_addr (void)
 Get the address of the current running user bin (user1.bin or user2.bin). More...
 
uint8 system_get_boot_mode (void)
 Get the boot mode. More...
 
bool system_restart_enhance (uint8 bin_type, uint32 bin_addr)
 Restarts the system, and enters the enhanced boot mode. More...
 
flash_size_map system_get_flash_size_map (void)
 Get the current Flash size and Flash map. More...
 
bool system_update_cpu_freq (uint8 freq)
 Set CPU frequency. Default is 80MHz. More...
 
uint8 system_get_cpu_freq (void)
 Get CPU frequency. More...
 

Detailed Description

boot APIs

Macro Definition Documentation

#define SYS_BOOT_ENHANCE_MODE   0

It can load and run firmware at any address, for Espressif factory test bin

#define SYS_BOOT_NORMAL_BIN   0

user1.bin or user2.bin

#define SYS_BOOT_NORMAL_MODE   1

It can only load and run at some addresses of user1.bin (or user2.bin)

#define SYS_BOOT_TEST_BIN   1

can only be Espressif test bin

Enumeration Type Documentation

Enumerator
FLASH_SIZE_4M_MAP_256_256 

Flash size : 4Mbits. Map : 256KBytes + 256KBytes

FLASH_SIZE_2M 

Flash size : 2Mbits. Map : 256KBytes

FLASH_SIZE_8M_MAP_512_512 

Flash size : 8Mbits. Map : 512KBytes + 512KBytes

FLASH_SIZE_16M_MAP_512_512 

Flash size : 16Mbits. Map : 512KBytes + 512KBytes

FLASH_SIZE_32M_MAP_512_512 

Flash size : 32Mbits. Map : 512KBytes + 512KBytes

FLASH_SIZE_16M_MAP_1024_1024 

Flash size : 16Mbits. Map : 1024KBytes + 1024KBytes

FLASH_SIZE_32M_MAP_1024_1024 

Flash size : 32Mbits. Map : 1024KBytes + 1024KBytes

Function Documentation

uint8 system_get_boot_mode ( void  )

Get the boot mode.

Parameters
null
Returns
#define SYS_BOOT_ENHANCE_MODE 0
#define SYS_BOOT_NORMAL_MODE 1
uint8 system_get_boot_version ( void  )

Get information of the boot version.

Attention
If boot version >= 1.3 , users can enable the enhanced boot mode (refer to system_restart_enhance).
Parameters
null
Returns
Information of the boot version.
uint8 system_get_cpu_freq ( void  )

Get CPU frequency.

Parameters
null
Returns
CPU frequency, unit : MHz.
flash_size_map system_get_flash_size_map ( void  )

Get the current Flash size and Flash map.

Flash map depends on the selection when compiling, more details in document "2A-ESP8266__IOT_SDK_User_Manual"

Parameters
null
Returns
enum flash_size_map
uint32 system_get_userbin_addr ( void  )

Get the address of the current running user bin (user1.bin or user2.bin).

Parameters
null
Returns
The address of the current running user bin.
bool system_restart_enhance ( uint8  bin_type,
uint32  bin_addr 
)

Restarts the system, and enters the enhanced boot mode.

Attention
SYS_BOOT_TEST_BIN is used for factory test during production; users can apply for the test bin from Espressif Systems.
Parameters
uint8bin_type : type of bin
  • #define SYS_BOOT_NORMAL_BIN 0 // user1.bin or user2.bin
  • #define SYS_BOOT_TEST_BIN 1 // can only be Espressif test bin
uint32bin_addr : starting address of the bin file
Returns
true : succeed
false : fail
bool system_update_cpu_freq ( uint8  freq)

Set CPU frequency. Default is 80MHz.

System bus frequency is 80MHz, will not be affected by CPU frequency. The frequency of UART, SPI, or other peripheral devices, are divided from system bus frequency, so they will not be affected by CPU frequency either.

Parameters
uint8freq : CPU frequency, 80 or 160.
Returns
true : succeed
false : fail