Skip to content

Commit aa68a59

Browse files
committed
Merge branch 'feat/support_configure_rcp_dir' into 'main'
feat(rcp update): support configuring rcp source path See merge request espressif/esp-thread-br!135
2 parents 95e7ec4 + afe6ee1 commit aa68a59

File tree

8 files changed

+38
-20
lines changed

8 files changed

+38
-20
lines changed

.gitlab-ci.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ check_build_result:
219219
script:
220220
- *submodule_update
221221
- chmod 700 ./check_components_version.sh
222-
- ALLOW_FAILURE_OUTPUT=$(./check_components_version.sh)
223-
- echo "$ALLOW_FAILURE_OUTPUT"
224-
- ALLOW_FAILURE_VALUE=$(echo "$ALLOW_FAILURE_OUTPUT" | cut -d'=' -f2)
225-
- echo "ALLOW_FAILURE_VALUE=$ALLOW_FAILURE_VALUE"
222+
- ALLOW_EXT_CMD_FAILURE_OUTPUT=$(./check_components_version.sh "components/esp_ot_cli_extension")
223+
- ALLOW_EXT_CMD_FAILURE_VALUE=$(echo "$ALLOW_EXT_CMD_FAILURE_OUTPUT" | cut -d'=' -f2)
224+
- echo "ALLOW_EXT_CMD_FAILURE_VALUE=$ALLOW_EXT_CMD_FAILURE_VALUE"
225+
- ALLOW_RCP_UPDATE_FAILURE_OUTPUT=$(./check_components_version.sh "components/esp_rcp_update")
226+
- ALLOW_RCP_UPDATE_FAILURE_VALUE=$(echo "$ALLOW_RCP_UPDATE_FAILURE_OUTPUT" | cut -d'=' -f2)
227+
- echo "ALLOW_RCP_UPDATE_FAILURE_VALUE=$ALLOW_RCP_UPDATE_FAILURE_VALUE"
226228
- |
227-
if [ "$ALLOW_FAILURE_VALUE" == "true" ]; then
229+
if [ "$ALLOW_EXT_CMD_FAILURE_VALUE" == "true" ] || [ "$ALLOW_RCP_UPDATE_FAILURE_VALUE" == "true" ]; then
228230
echo "allow failure"
229231
exit 0;
230232
else

check_components_version.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/sh
22

3-
export ESP_EXTCMD_COMPONENTS_PATH="components/esp_ot_cli_extension"
3+
export ESP_COMPONENTS_PATH="$1"
44

5-
if git diff --name-only HEAD~1 | grep -q "${ESP_EXTCMD_COMPONENTS_PATH}/idf_component.yml"; then
6-
OLD_VERSION=$(git show HEAD~1:${ESP_EXTCMD_COMPONENTS_PATH}/idf_component.yml | grep -m 1 "^version: " | awk '{print $2}' | tr -d '"')
7-
NEW_VERSION=$(head -n 1 ${ESP_EXTCMD_COMPONENTS_PATH}/idf_component.yml | grep "^version: " | awk '{print $2}' | tr -d '"')
5+
if git diff --name-only HEAD~1 | grep -q "${ESP_COMPONENTS_PATH}/idf_component.yml"; then
6+
OLD_VERSION=$(git show HEAD~1:${ESP_COMPONENTS_PATH}/idf_component.yml | grep -m 1 "^version: " | awk '{print $2}' | tr -d '"')
7+
NEW_VERSION=$(head -n 1 ${ESP_COMPONENTS_PATH}/idf_component.yml | grep "^version: " | awk '{print $2}' | tr -d '"')
88
if [ -z "$OLD_VERSION" ] || [ -z "$NEW_VERSION" ]; then
9-
echo "Error: version not found or incorrect format in ${ESP_EXTCMD_COMPONENTS_PATH}/idf_component.yml"
9+
echo "Error: version not found or incorrect format in ${ESP_COMPONENTS_PATH}/idf_component.yml"
1010
exit 1
1111
fi
1212
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then

components/esp_rcp_update/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ idf_build_get_property(python PYTHON)
66
if(CONFIG_AUTO_UPDATE_RCP)
77
add_custom_target(rcp_image_generation ALL
88
COMMAND ${python} ${CMAKE_CURRENT_SOURCE_DIR}/create_ota_image.py
9-
--rcp-build-dir $ENV{IDF_PATH}/examples/openthread/ot_rcp/build
9+
--rcp-build-dir ${CONFIG_RCP_SRC_DIR}
1010
--target-file ${CMAKE_CURRENT_BINARY_DIR}/spiffs_image/ot_rcp_0/rcp_image
1111
)
1212

13-
spiffs_create_partition_image(rcp_fw ${CMAKE_CURRENT_BINARY_DIR}/spiffs_image FLASH_IN_PROJECT
13+
spiffs_create_partition_image(${CONFIG_RCP_PARTITION_NAME} ${CMAKE_CURRENT_BINARY_DIR}/spiffs_image FLASH_IN_PROJECT
1414
DEPENDS rcp_image_generation)
1515
endif()
1616

1717
if(CONFIG_CREATE_OTA_IMAGE_WITH_RCP_FW)
1818
add_custom_command(OUTPUT ${build_dir}/ota_with_rcp_image
1919
COMMAND ${python} ${CMAKE_CURRENT_SOURCE_DIR}/create_ota_image.py
20-
--rcp-build-dir $ENV{IDF_PATH}/examples/openthread/ot_rcp/build
20+
--rcp-build-dir ${CONFIG_RCP_SRC_DIR}
2121
--target-file ${build_dir}/ota_with_rcp_image
2222
--br-firmware "${build_dir}/${elf_name}.bin"
2323
DEPENDS "${build_dir}/.bin_timestamp"

components/esp_rcp_update/Kconfig

+15-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ menu "OpenThread RCP Update"
22

33
config AUTO_UPDATE_RCP
44
bool 'Update RCP automatically'
5-
default y
5+
default n
66
help
77
If enabled, the device will store the RCP image in its firmware and
88
compare the stored image version with the running RCP image upon boot. The RCP
@@ -14,4 +14,18 @@ menu "OpenThread RCP Update"
1414
help
1515
If enabled, an ota image will be generated during building.
1616

17+
config RCP_SRC_DIR
18+
depends on AUTO_UPDATE_RCP || CREATE_OTA_IMAGE_WITH_RCP_FW
19+
string "Source folder containing the RCP firmware"
20+
default "$ENV{IDF_PATH}/examples/openthread/ot_rcp/build"
21+
help
22+
The source folder containing the RCP firmware.
23+
24+
config RCP_PARTITION_NAME
25+
depends on AUTO_UPDATE_RCP
26+
string "Name of RCP storage partition"
27+
default "rcp_fw"
28+
help
29+
The name of RCP storage partition.
30+
1731
endmenu

components/esp_rcp_update/idf_component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.1.0"
1+
version: "1.2.0"
22
description: Espressif RCP Update Component for Thread Border Router and Zigbee Gateway
33
url: https://github.com/espressif/esp-thread-br/tree/main/components/esp_rcp_update
44
dependencies:

examples/basic_thread_border_router/main/esp_ot_br.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end");
4141
static esp_err_t init_spiffs(void)
4242
{
4343
#if CONFIG_AUTO_UPDATE_RCP
44-
esp_vfs_spiffs_conf_t rcp_fw_conf = {
45-
.base_path = "/rcp_fw", .partition_label = "rcp_fw", .max_files = 10, .format_if_mount_failed = false};
44+
esp_vfs_spiffs_conf_t rcp_fw_conf = {.base_path = "/" CONFIG_RCP_PARTITION_NAME,
45+
.partition_label = CONFIG_RCP_PARTITION_NAME,
46+
.max_files = 10,
47+
.format_if_mount_failed = false};
4648
ESP_RETURN_ON_ERROR(esp_vfs_spiffs_register(&rcp_fw_conf), TAG, "Failed to mount rcp firmware storage");
4749
#endif
4850
#if CONFIG_OPENTHREAD_BR_START_WEB

examples/basic_thread_border_router/main/esp_ot_config.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
{ \
7676
.rcp_type = RCP_TYPE_ESP32H2_UART, .uart_rx_pin = CONFIG_PIN_TO_RCP_TX, .uart_tx_pin = CONFIG_PIN_TO_RCP_RX, \
7777
.uart_port = 1, .uart_baudrate = 115200, .reset_pin = CONFIG_PIN_TO_RCP_RESET, \
78-
.boot_pin = CONFIG_PIN_TO_RCP_BOOT, .update_baudrate = 460800, .firmware_dir = "/rcp_fw/ot_rcp", \
79-
.target_chip = ESP32H2_CHIP, \
78+
.boot_pin = CONFIG_PIN_TO_RCP_BOOT, .update_baudrate = 460800, \
79+
.firmware_dir = "/" CONFIG_RCP_PARTITION_NAME "/ot_rcp", .target_chip = ESP32H2_CHIP, \
8080
}
8181

8282
#if CONFIG_OPENTHREAD_CONSOLE_TYPE_UART

examples/basic_thread_border_router/main/idf_component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
dependencies:
33
espressif/mdns: "^1.0.0"
44
espressif/esp_ot_cli_extension: "~1.1.0"
5-
espressif/esp_rcp_update: "~1.1.0"
5+
espressif/esp_rcp_update: "~1.2.0"
66
## Required IDF version
77
idf:
88
version: ">=4.1.0"

0 commit comments

Comments
 (0)