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...
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.
- Copyright
- 2015 Richard A Burton
- 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.
Read rBoot configuration from flash.
- Return values
-
- 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
-
uint8 | Index 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
-
conf | pointer to a rboot_config structure containing configuration to save |
- Return values
-
- 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
-
rom | The index of the ROM to use on next boot |
- Return values
-
- 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)
Complete flash write process.
- Parameters
-
- 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
-
status | Pointer to rboot_write_status structure defining the write status |
data | Pointer to a block of uint8 data elements to be written to flash |
len | Quantity 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
Initialise flash write process.
- Parameters
-
start_addr | Address 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.