Skip to content

Commit

Permalink
Merge branch 'backport/rcp_size_opt_config' into 'release/v5.1'
Browse files Browse the repository at this point in the history
Backport/rcp size opt config

See merge request espressif/esp-idf!26010
  • Loading branch information
chshu committed Sep 20, 2023
2 parents b8d3ee9 + 6140241 commit ffc8da6
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/openthread/src/esp_openthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ esp_err_t esp_openthread_auto_start(otOperationalDatasetTlvs *datasetTlvs)
dataset.mComponents.mIsPanIdPresent = true;
len = strlen(CONFIG_OPENTHREAD_NETWORK_NAME);
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;

// Extended Pan ID
Expand Down
2 changes: 1 addition & 1 deletion examples/openthread/ot_br/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## IDF Component Manager Manifest File
dependencies:
espressif/esp_ot_cli_extension:
version: "~0.4.0"
version: "~1.0.0"
espressif/mdns: "^1.0.3"
## Required IDF version
idf:
Expand Down
2 changes: 1 addition & 1 deletion examples/openthread/ot_br/partitions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1600K,
factory, app, factory, 0x10000, 1700K,
28 changes: 28 additions & 0 deletions examples/openthread/ot_rcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

### 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 the project and flash it to the board:
Expand Down
18 changes: 17 additions & 1 deletion examples/openthread/ot_rcp/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ CONFIG_PARTITION_TABLE_MD5=y
#
CONFIG_OPENTHREAD_ENABLED=y
CONFIG_OPENTHREAD_RADIO=y
CONFIG_OPENTHREAD_DIAG=y
CONFIG_OPENTHREAD_DIAG=n
CONFIG_OPENTHREAD_COMMISSIONER=n
CONFIG_OPENTHREAD_JOINER=n
CONFIG_OPENTHREAD_BORDER_ROUTER=n
CONFIG_OPENTHREAD_CLI=n
CONFIG_OPENTHREAD_SRP_CLIENT=n
CONFIG_OPENTHREAD_DNS_CLIENT=n
# end of OpenThread


Expand All @@ -34,3 +35,18 @@ CONFIG_OPENTHREAD_SRP_CLIENT=n
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y
CONFIG_LOG_BOOTLOADER_LEVEL_INFO=n
# 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

0 comments on commit ffc8da6

Please sign in to comment.