ESP8266_RTOS_SDK v1.4.0

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Macros | Typedefs | Functions
Upgrade APIs
System APIs

Firmware upgrade (FOTA) APIs. More...

## Data Structures
struct | upgrade_server_info

## Macros
#define | SPI_FLASH_SEC_SIZE 4096
#define | USER_BIN1 0x00
#define | USER_BIN2 0x01
#define | UPGRADE_FLAG_IDLE 0x00
#define | UPGRADE_FLAG_START 0x01
#define | UPGRADE_FLAG_FINISH 0x02
#define | UPGRADE_FW_BIN1 0x00
#define | UPGRADE_FW_BIN2 0x01

## Typedefs
typedef void(* | upgrade_states_check_callback) (void *arg)
| Callback of upgrading firmware through WiFi. More...

## Functions
uint8 | system_upgrade_userbin_check (void)
| Check the user bin. More...
void | system_upgrade_reboot (void)
| Reboot system to use the new software. More...
uint8 | system_upgrade_flag_check ()
| Check the upgrade status flag. More...
void | system_upgrade_flag_set (uint8 flag)
| Set the upgrade status flag. More...
void | system_upgrade_init ()
| Upgrade function initialization. More...
void | system_upgrade_deinit ()
| Upgrade function de-initialization. More...
bool | system_upgrade (uint8 *data, uint32 len)
| Upgrade function de-initialization. More...
bool | system_upgrade_start (struct upgrade_server_info *server)
| Start upgrade firmware through WiFi with normal connection. More...

## Detailed Description

Firmware upgrade (FOTA) APIs.

## Macro Definition Documentation

#define SPI_FLASH_SEC_SIZE 4096

SPI Flash sector size

#define UPGRADE_FLAG_FINISH 0x02

flag of upgrading firmware, finish upgrading

#define UPGRADE_FLAG_IDLE 0x00

flag of upgrading firmware, idle

#define UPGRADE_FLAG_START 0x01

flag of upgrading firmware, start upgrade

#define UPGRADE_FW_BIN1 0x00

firmware, user1.bin

#define UPGRADE_FW_BIN2 0x01

firmware, user2.bin

#define USER_BIN1 0x00

firmware, user1.bin

#define USER_BIN2 0x01

firmware, user2.bin

## Typedef Documentation

typedef void(* upgrade_states_check_callback) (void *arg)

Callback of upgrading firmware through WiFi.

Parameters

  void | * arg : information about upgrading server

Returns
  null

## Function Documentation

bool system_upgrade | ( | uint8 * | data,
|  | uint32 | len
| ) |  |

Upgrade function de-initialization.

Parameters

  uint8 | *data : segment of the firmware bin data
  uint32 | len : length of the segment bin data

Returns
  null

void system_upgrade_deinit | ( |  | ) |

Upgrade function de-initialization.

Parameters

  null |

Returns
  null

uint8 system_upgrade_flag_check | ( |  | ) |

Check the upgrade status flag.

Parameters

  null |

Returns
  #define UPGRADE_FLAG_IDLE 0x00
  #define UPGRADE_FLAG_START 0x01
  #define UPGRADE_FLAG_FINISH 0x02

void system_upgrade_flag_set | ( | uint8 | flag | ) |

Set the upgrade status flag.

Attention
  After downloading new softwares, set the flag to UPGRADE_FLAG_FINISH and call system_upgrade_reboot to reboot the system in order to run the new software.

Parameters

  uint8 | flag: UPGRADE_FLAG_IDLE 0x00 UPGRADE_FLAG_START 0x01 UPGRADE_FLAG_FINISH 0x02

Returns
  null

void system_upgrade_init | ( |  | ) |

Upgrade function initialization.

Parameters

  null |

Returns
  null

void system_upgrade_reboot | ( | void |  | ) |

Reboot system to use the new software.

Parameters

  null |

Returns
  null

bool system_upgrade_start | ( | struct upgrade_server_info * | server | ) |

Start upgrade firmware through WiFi with normal connection.

Parameters

  struct | upgrade_server_info *server : the firmware upgrade server info

Returns
  true : succeed
  false : fail

uint8 system_upgrade_userbin_check | ( | void |  | ) |

Check the user bin.

Parameters

  null |

Returns
  0x00 : UPGRADE_FW_BIN1, i.e. user1.bin
  0x01 : UPGRADE_FW_BIN2, i.e. user2.bin