openthread: Add some flash optimization options for openthread component

openthread: use a certain version of esp_openthread_cli_extension managed component
This commit is contained in:
WanqQixiang
2022-09-27 14:30:46 +08:00
parent 1005c3b9d5
commit 1d826c7a2b
11 changed files with 120 additions and 35 deletions
+3 -7
View File
@@ -43,7 +43,6 @@
#define TAG "ot_esp_cli"
#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
static esp_netif_t *init_openthread_netif(const esp_openthread_platform_config_t *config)
{
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_OPENTHREAD();
@@ -53,7 +52,6 @@ static esp_netif_t *init_openthread_netif(const esp_openthread_platform_config_t
return netif;
}
#endif // CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
static void ot_task_worker(void *aContext)
{
@@ -66,16 +64,18 @@ static void ot_task_worker(void *aContext)
// Initialize the OpenThread stack
ESP_ERROR_CHECK(esp_openthread_init(&config));
#if CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC
// The OpenThread log level directly matches ESP log level
(void)otLoggingSetLevel(CONFIG_LOG_DEFAULT_LEVEL);
#endif
// Initialize the OpenThread cli
esp_openthread_cli_init();
#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
esp_netif_t *openthread_netif;
// Initialize the esp_netif bindings
openthread_netif = init_openthread_netif(&config);
#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
esp_cli_custom_command_init();
#endif // CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
@@ -84,10 +84,8 @@ static void ot_task_worker(void *aContext)
esp_openthread_launch_mainloop();
// Clean up
#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
esp_netif_destroy(openthread_netif);
esp_openthread_netif_glue_deinit();
#endif // CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
esp_vfs_eventfd_unregister();
vTaskDelete(NULL);
@@ -104,9 +102,7 @@ void app_main(void)
};
ESP_ERROR_CHECK(esp_event_loop_create_default());
#if CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
ESP_ERROR_CHECK(esp_netif_init());
#endif // CONFIG_OPENTHREAD_CLI_ESP_EXTENSION
ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config));
xTaskCreate(ot_task_worker, "ot_cli_main", 10240, xTaskGetCurrentTaskHandle(), 5, NULL);
}