Merge branch 'backport/rcp_size_opt_config' into 'release/v5.1'

Backport/rcp size opt config

See merge request espressif/esp-idf!26010
This commit is contained in:
Shu Chen 2023-09-20 11:36:21 +08:00
commit ffc8da6ee1
5 changed files with 48 additions and 4 deletions

View File

@ -112,7 +112,7 @@ esp_err_t esp_openthread_auto_start(otOperationalDatasetTlvs *datasetTlvs)
dataset.mComponents.mIsPanIdPresent = true; dataset.mComponents.mIsPanIdPresent = true;
len = strlen(CONFIG_OPENTHREAD_NETWORK_NAME); len = strlen(CONFIG_OPENTHREAD_NETWORK_NAME);
assert(len <= OT_NETWORK_NAME_MAX_SIZE); assert(len <= OT_NETWORK_NAME_MAX_SIZE);
memcpy(dataset.mNetworkName.m8, CONFIG_OPENTHREAD_NETWORK_NAME, len); memcpy(dataset.mNetworkName.m8, CONFIG_OPENTHREAD_NETWORK_NAME, len + 1);
dataset.mComponents.mIsNetworkNamePresent = true; dataset.mComponents.mIsNetworkNamePresent = true;
// Extended Pan ID // Extended Pan ID

View File

@ -1,7 +1,7 @@
## IDF Component Manager Manifest File ## IDF Component Manager Manifest File
dependencies: dependencies:
espressif/esp_ot_cli_extension: espressif/esp_ot_cli_extension:
version: "~0.4.0" version: "~1.0.0"
espressif/mdns: "^1.0.3" espressif/mdns: "^1.0.3"
## Required IDF version ## Required IDF version
idf: idf:

View File

@ -2,4 +2,4 @@
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, 0x9000, 0x6000, nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000, phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1600K, factory, app, factory, 0x10000, 1700K,

1 # Name, Type, SubType, Offset, Size, Flags
2 # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 nvs, data, nvs, 0x9000, 0x6000,
4 phy_init, data, phy, 0xf000, 0x1000,
5 factory, app, factory, 0x10000, 1600K, factory, app, factory, 0x10000, 1700K,

View File

@ -19,6 +19,34 @@ To run this example, a board with IEEE 802.15.4 module (for example ESP32-H2) is
The default communication interface is port 0 of ESP32-H2 UART running at 460800 baud, change the configuration in [esp_ot_config.h](main/esp_ot_config.h) if you want to use another interface or need different communication parameters. The default communication interface is port 0 of ESP32-H2 UART running at 460800 baud, change the configuration in [esp_ot_config.h](main/esp_ot_config.h) if you want to use another interface or need different communication parameters.
### RCP Size Optimization Configuration
To optimize the size of the RCP firmware, the following configurations are enabled by default:
```
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
CONFIG_NEWLIB_NANO_FORMAT=y
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n
CONFIG_OPENTHREAD_LOG_LEVEL_NONE=y
```
Configure them via `idf.py menuconfig` if you need.
The firmware size are as follows (reference value):
```
Before Optimization After Optimization
esp_ot_rcp.bin for esp32h2 314KB 184KB
esp_ot_rcp.bin for esp32c6 299KB 208kb
```
### Build and Flash ### Build and Flash
Build the project and flash it to the board: Build the project and flash it to the board:

View File

@ -19,12 +19,13 @@ CONFIG_PARTITION_TABLE_MD5=y
# #
CONFIG_OPENTHREAD_ENABLED=y CONFIG_OPENTHREAD_ENABLED=y
CONFIG_OPENTHREAD_RADIO=y CONFIG_OPENTHREAD_RADIO=y
CONFIG_OPENTHREAD_DIAG=y CONFIG_OPENTHREAD_DIAG=n
CONFIG_OPENTHREAD_COMMISSIONER=n CONFIG_OPENTHREAD_COMMISSIONER=n
CONFIG_OPENTHREAD_JOINER=n CONFIG_OPENTHREAD_JOINER=n
CONFIG_OPENTHREAD_BORDER_ROUTER=n CONFIG_OPENTHREAD_BORDER_ROUTER=n
CONFIG_OPENTHREAD_CLI=n CONFIG_OPENTHREAD_CLI=n
CONFIG_OPENTHREAD_SRP_CLIENT=n CONFIG_OPENTHREAD_SRP_CLIENT=n
CONFIG_OPENTHREAD_DNS_CLIENT=n
# end of OpenThread # end of OpenThread
@ -34,3 +35,18 @@ CONFIG_OPENTHREAD_SRP_CLIENT=n
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y
CONFIG_LOG_BOOTLOADER_LEVEL_INFO=n CONFIG_LOG_BOOTLOADER_LEVEL_INFO=n
# End of deprecated options # End of deprecated options
#
# Configurations for optimizing the size of ot_rcp firmware
#
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
CONFIG_NEWLIB_NANO_FORMAT=y
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n
CONFIG_OPENTHREAD_LOG_LEVEL_NONE=y