Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
rBoot API

rBoot for ESP8266 API allows runtime code to access the rBoot configuration. Configuration may be read to use within the main firmware or updated to affect next boot behavior. More...

Classes

struct  rboot_write_status
 Structure defining flash write status. More...
 
struct  rboot_config
 Structure containing rBoot configuration. More...
 

Functions

rboot_config ICACHE_FLASH_ATTR rboot_get_config (void)
 Read rBoot configuration from flash. More...
 
bool ICACHE_FLASH_ATTR rboot_set_config (rboot_config *conf)
 Write rBoot configuration to flash memory. More...
 
uint8 ICACHE_FLASH_ATTR rboot_get_current_rom (void)
 Get index of current ROM. More...
 
bool ICACHE_FLASH_ATTR rboot_set_current_rom (uint8 rom)
 Set the index of current ROM. More...
 
rboot_write_status ICACHE_FLASH_ATTR rboot_write_init (uint32 start_addr)
 Initialise flash write process. More...
 
bool ICACHE_FLASH_ATTR rboot_write_end (rboot_write_status *status)
 Complete flash write process. More...
 
bool ICACHE_FLASH_ATTR rboot_write_flash (rboot_write_status *status, uint8 *data, uint16 len)
 Write data to flash memory. More...
 

Detailed Description

rBoot for ESP8266 API allows runtime code to access the rBoot configuration. Configuration may be read to use within the main firmware or updated to affect next boot behavior.

Author
richa.nosp@m.rdab.nosp@m.urton.nosp@m.@gma.nosp@m.il.co.nosp@m.m
OTA code based on SDK sample from Espressif
License:
See licence.txt for license terms.

Function Documentation

rboot_config ICACHE_FLASH_ATTR rboot_get_config ( void  )

Read rBoot configuration from flash.

Return values
rboot_configCopy of the rBoot configuration
Note
Returns rboot_config (defined in rboot.h) allowing you to modify any values in it, including the ROM layout.
uint8 ICACHE_FLASH_ATTR rboot_get_current_rom ( void  )

Get index of current ROM.

Return values
uint8Index of the current ROM
Note
Get the currently selected boot ROM (this will be the currently running ROM, as long as you haven't changed it since boot or rBoot booted the rom in temporary boot mode, see rboot_get_last_boot_rom).
bool ICACHE_FLASH_ATTR rboot_set_config ( rboot_config conf)

Write rBoot configuration to flash memory.

Parameters
confpointer to a rboot_config structure containing configuration to save
Return values
boolTrue on success
Note
Saves the rboot_config structure back to configuration sector (BOOT_CONFIG_SECTOR) of the flash, while maintaining the contents of the rest of the sector. You can use the rest of this sector for your app settings, as long as you protect this structure when you do so.
bool ICACHE_FLASH_ATTR rboot_set_current_rom ( uint8  rom)

Set the index of current ROM.

Parameters
romThe index of the ROM to use on next boot
Return values
boolTrue on success
Note
Set the current boot ROM, which will be used when next restarted.
This function re-writes the whole configuration to flash memory (not just the current ROM index)
bool ICACHE_FLASH_ATTR rboot_write_end ( rboot_write_status status)

Complete flash write process.

Parameters
statusPointer to rboot_write_status structure defining the write status
Note
Call at the completion of flash writing. This ensures any outstanding bytes are written (if data so far hasn't been a multiple of 4 bytes there will be a few bytes unwritten, until you call this function).
bool ICACHE_FLASH_ATTR rboot_write_flash ( rboot_write_status status,
uint8 *  data,
uint16  len 
)

Write data to flash memory.

Parameters
statusPointer to rboot_write_status structure defining the write status
dataPointer to a block of uint8 data elements to be written to flash
lenQuantity of uint8 data elements to write to flash
Note
Call repeatedly to write data to the flash, starting at the address specified on the prior call to rboot_write_init. Current write position is tracked automatically. This method is likely to be called each time a packet of OTA data is received over the network.
Call rboot_write_init before calling this function to get the rboot_write_status structure
rboot_write_status ICACHE_FLASH_ATTR rboot_write_init ( uint32  start_addr)

Initialise flash write process.

Parameters
start_addrAddress on the SPI flash to begin write to
Note
Call once before starting to pass data to write to flash memory with rboot_write_flash function. start_addr is the address on the SPI flash to write from. Returns a status structure which must be passed back on each write. The contents of the structure should not be modified by the calling code.