4.1. RCP Update

The RCP update component updates the RCP from a local file on the host.

API reference

Header File

Functions

esp_err_t esp_rcp_update_init(const esp_rcp_update_config_t *update_config)

This function initializes the RCP update process.

Parameters

update_config[in] The RCP update specific config

Returns

  • ESP_OK

  • ESP_FAIL

  • ESP_ERR_INVALID_ARG If the RCP type is not supported.

esp_err_t esp_rcp_update(void)

This function triggers an RCP firmware update.

Returns

  • ESP_OK

  • ESP_FAIL

  • ESP_ERR_INVALID_STASTE If the RCP update is not initialized.

  • ESP_ERR_NOT_FOUND RCP firmware not found in storage.

const char *esp_rcp_get_firmware_dir(void)

This function acquires the RCP image base directory.

Note

The real RCP image directory should be suffixed the update sequence.

int8_t esp_rcp_get_update_seq(void)

This function retrieves the update image sequence.

The current update image sequence will be used to update the RCP.

int8_t esp_rcp_get_next_update_seq(void)

This function retrieves the next update image sequence.

The next update image sequence will be used for the downloaded image.

void esp_rcp_reset(void)

This function resets the RCP.

esp_err_t esp_rcp_submit_new_image(void)

This function marks the downloaded image as valid.

The image in the next update image sequence will then be used for RCP update.

Returns

  • ESP_OK

  • ESP_ERR_INVALID_STASTE If the RCP update is not initialized.

esp_err_t esp_rcp_mark_image_verified(bool verified)

This function marks previously downloaded image as valid.

Returns

  • ESP_OK

  • ESP_ERR_INVALID_STASTE If the RCP update is not initialized.

esp_err_t esp_rcp_mark_image_unusable(void)

This function marks previously downloaded image as unusable.

Returns

  • ESP_OK

  • ESP_ERR_INVALID_STASTE If the RCP update is not initialized.

esp_err_t esp_rcp_load_version_in_storage(char *version_str, size_t size)

This function loads the RCP version in the current update image.

Parameters
  • version_str[out] The RCP version string output.

  • size[in] Size of version_str.

Returns

  • ESP_OK

  • ESP_ERR_INVALID_STASTE If the RCP update is not initialized.

  • ESP_ERR_NOT_FOUND RCP version not found in update image.

void esp_rcp_update_deinit(void)

This function deinitializes the RCP update process.

Structures

struct esp_rcp_update_config_t

The RCP update config for OpenThread.

Public Members

esp_rcp_type_t rcp_type

RCP type

int uart_rx_pin

UART rx pin

int uart_tx_pin

UART tx pin

int uart_port

UART port

int uart_baudrate

UART baudrate

int reset_pin

RESET pin

int boot_pin

Boot mode select pin

uint32_t update_baudrate

Baudrate when flashing the firmware

char firmware_dir[RCP_FIRMWARE_DIR_SIZE]

The directory storing the RCP firmware

target_chip_t target_chip

The target chip type

Macros

RCP_FIRMWARE_DIR_SIZE
RCP_FILENAME_MAX_SIZE
RCP_URL_MAX_SIZE

Enumerations

enum esp_rcp_type_t

Values:

enumerator RCP_TYPE_INVALID
enumerator RCP_TYPE_ESP32H2_UART