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 | rboot_get_config (void) |
Read rBoot configuration from flash. More... | |
bool | rboot_set_config (rboot_config *conf) |
Write rBoot configuration to flash memory. More... | |
uint8_t | rboot_get_current_rom (void) |
Get index of current ROM. More... | |
bool | rboot_set_current_rom (uint8_t rom) |
Set the index of current ROM. More... | |
rboot_write_status | rboot_write_init (uint32_t start_addr) |
Initialise flash write process. More... | |
bool | rboot_write_end (rboot_write_status *status) |
Complete flash write process. More... | |
bool | rboot_write_flash (rboot_write_status *status, const uint8_t *data, uint16_t 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.
- Copyright
- 2015 Richard A Burton
- License:\n See licence.txt for license terms.
Function Documentation
◆ rboot_get_config()
rboot_config rboot_get_config | ( | void | ) |
Read rBoot configuration from flash.
- Return values
-
rboot_config Copy of the rBoot configuration
- Note
- Returns rboot_config (defined in rboot.h) allowing you to modify any values in it, including the ROM layout.
◆ rboot_get_current_rom()
uint8_t rboot_get_current_rom | ( | void | ) |
Get index of current ROM.
- Return values
-
uint8_t 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).
◆ rboot_set_config()
bool 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
-
bool True 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.
◆ rboot_set_current_rom()
Set the index of current ROM.
- Parameters
-
rom The index of the ROM to use on next boot
- Return values
-
bool True 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)
◆ rboot_write_end()
bool rboot_write_end | ( | rboot_write_status * | status | ) |
Complete flash write process.
- Parameters
-
status Pointer 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).
◆ rboot_write_flash()
bool rboot_write_flash | ( | rboot_write_status * | status, |
const uint8_t * | data, | ||
uint16_t | 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_t data elements to be written to flash len Quantity of uint8_t 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_init()
rboot_write_status rboot_write_init | ( | uint32_t | start_addr | ) |
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.