Merge branch 'feature/refactor_esp_sys_deps' into 'master'

esp-system: removed esp_phy and nvs dependencies, change app update and pm to weak dependencies

Closes IDF-4656

See merge request espressif/esp-idf!17092
This commit is contained in:
Marius Vikhammer 2022-03-25 17:17:43 +08:00
commit 5618ba80f9
6 changed files with 40 additions and 27 deletions

View File

@ -40,12 +40,11 @@ else()
# [refactor-todo] requirements due to init code,
# should be removable once using component init functions
# link-time registration is used.
esp_pm app_update nvs_flash pthread
# [refactor-todo] requires "driver" for headers:
# - periph_ctrl.h
# - rtc_cntl.h
# - spi_common_internal.h
esp_phy efuse driver
pthread bootloader_support efuse driver
LDFRAGMENTS "linker.lf" "app.lf")
add_subdirectory(port)
@ -91,3 +90,9 @@ endif()
# [refactor-todo] requirement from the panic handler,
# need to introduce panic "event" concept to remove this dependency (IDF-2194)
idf_component_optional_requires(PRIVATE esp_gdbstub)
idf_component_optional_requires(PRIVATE app_update)
if(CONFIG_PM_ENABLE)
idf_component_optional_requires(PRIVATE pm)
endif()

View File

@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
@ -21,8 +13,11 @@
#include "esp_freertos_hooks.h"
#include "sdkconfig.h"
#if CONFIG_PM_ENABLE
#include "esp_pm.h"
#include "esp_private/pm_impl.h"
#endif
//We use just a static array here because it's not expected many components will need
//an idle or tick hook.
@ -58,9 +53,12 @@ void esp_vApplicationIdleHook(void)
#ifdef CONFIG_PM_ENABLE
esp_pm_impl_idle_hook();
esp_pm_impl_waiti();
#else
cpu_hal_waiti();
#endif
esp_pm_impl_waiti();
}
esp_err_t esp_register_freertos_idle_hook_for_cpu(esp_freertos_idle_cb_t new_idle_cb, UBaseType_t cpuid)

View File

@ -11,7 +11,6 @@
#include "esp_private/system_internal.h"
#include "esp_private/usb_console.h"
#include "esp_ota_ops.h"
#include "esp_cpu.h"
#include "soc/rtc.h"
@ -26,6 +25,11 @@
#include "sdkconfig.h"
#if __has_include("esp_ota_ops.h")
#include "esp_ota_ops.h"
#define HAS_ESP_OTA 1
#endif
#if CONFIG_ESP_COREDUMP_ENABLE
#include "esp_core_dump.h"
#endif
@ -309,11 +313,13 @@ void esp_panic_handler(panic_info_t *info)
PANIC_INFO_DUMP(info, state);
panic_print_str("\r\n");
#if HAS_ESP_OTA
panic_print_str("\r\nELF file SHA256: ");
char sha256_buf[65];
esp_ota_get_app_elf_sha256(sha256_buf, sizeof(sha256_buf));
panic_print_str(sha256_buf);
panic_print_str("\r\n");
#endif //HAS_ESP_OTA
panic_print_str("\r\n");

View File

@ -12,7 +12,6 @@
#include "esp_system.h"
#include "esp_log.h"
#include "esp_ota_ops.h"
#include "sdkconfig.h"
@ -35,10 +34,13 @@
#include "esp_sleep.h"
#include "esp_xt_wdt.h"
#if __has_include("esp_ota_ops.h")
#include "esp_ota_ops.h"
#define HAS_ESP_OTA 1
#endif
/***********************************************/
// Headers for other components init functions
#include "nvs_flash.h"
#include "esp_coexist_internal.h"
#if CONFIG_ESP_COREDUMP_ENABLE
@ -50,8 +52,12 @@
#endif
#include "esp_private/dbg_stubs.h"
#if CONFIG_PM_ENABLE
#include "esp_pm.h"
#include "esp_private/pm_impl.h"
#endif
#include "esp_pthread.h"
#include "esp_vfs_console.h"
#include "esp_private/esp_clk.h"
@ -368,6 +374,7 @@ static void start_cpu0_default(void)
int cpu_freq = esp_clk_cpu_freq();
ESP_EARLY_LOGI(TAG, "cpu freq: %d Hz", cpu_freq);
#if HAS_ESP_OTA // [refactor-todo] find a better way to handle this.
// Display information about the current running image.
if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) {
const esp_app_desc_t *app_desc = esp_ota_get_app_description();
@ -389,6 +396,7 @@ static void start_cpu0_default(void)
ESP_EARLY_LOGI(TAG, "ELF file SHA256: %s...", buf);
ESP_EARLY_LOGI(TAG, "ESP-IDF: %s", app_desc->idf_ver);
}
#endif //HAS_ESP_OTA
// Initialize core components and services.
do_core_init();

View File

@ -673,7 +673,6 @@ components/esp_serial_slave_link/include/essl_spi/esp32c3_defs.h
components/esp_serial_slave_link/include/essl_spi/esp32s2_defs.h
components/esp_serial_slave_link/include/essl_spi/esp32s3_defs.h
components/esp_system/esp_err.c
components/esp_system/freertos_hooks.c
components/esp_system/include/eh_frame_parser.h
components/esp_system/include/esp_expression_with_stack.h
components/esp_system/include/esp_freertos_hooks.h

View File

@ -22,10 +22,8 @@ set(extra_allowed_components
# These components are currently included into "G1" build, but shouldn't.
# After removing the extra dependencies, remove the components from this list as well.
set(extra_components_which_shouldnt_be_included
# app_update gets added because of bootloader_support, spi_flash, espcoredump, esp_system.
# app_update gets added because of bootloader_support, spi_flash, espcoredump.
# bootloader_support, spi_flash, espcoredump should be removed from dependencies;
# esp_system code that reads app version should be made conditional on app_update being included
# (via weak CMake dependency and #if __has_include in C code)
app_update
# of G1 components, bootloader is only included from spi_flash
# [refactor-todo]: see if this dependency from spi_flash can be made weak
@ -50,9 +48,9 @@ set(extra_components_which_shouldnt_be_included
esp_event
# esp_netif is a dependency of lwip and esp_event, should disappear once lwip is removed.
esp_netif
# esp_phy is a dependency of esp_system and esp_wifi. For the former, it can be made a weak dependency.
# esp_phy is a dependency of esp_wifi.
esp_phy
# esp_pm is pulled in by esp_system and freertos, can be made a weak dependency
# esp_pm is pulled in by freertos, can be made a weak dependency
# conditional on related Kconfig option. It is also used by esp_wifi, driver, mbedtls,
# all of which should be removed from G1-only build.
esp_pm
@ -74,7 +72,6 @@ set(extra_components_which_shouldnt_be_included
# it is hard to make it conditional, need to remove bootloader_support.
mbedtls
# nvs_flash is required by:
# esp_system no obvious reason, [refactor-todo] why?
# esp_wifi, esp_phy both should be removed
nvs_flash
# partition_table is pulled in by app_update, esptool_py, bootloader; all to be removed