mirror of
https://github.com/tasmota/esp-idf.git
synced 2025-09-06 18:40:45 +00:00
Merge branch 'feature/cdcacm_vfs_comp' into 'master'
feat(usb_cdc_console): moved usb-cdc ROM console to new component: esp_usb_cdc_rom_console Closes IDF-13797 See merge request espressif/esp-idf!41040
This commit is contained in:
@@ -119,6 +119,7 @@
|
||||
/components/esp_tee/ @esp-idf-codeowners/security
|
||||
/components/esp_timer/ @esp-idf-codeowners/system
|
||||
/components/esp-tls/ @esp-idf-codeowners/app-utilities
|
||||
/components/esp_usb_cdc_rom_console/ @esp-idf-codeowners/system @esp-idf-codeowners/peripherals/usb
|
||||
/components/esp_vfs_*/ @esp-idf-codeowners/storage
|
||||
/components/esp_vfs_console/ @esp-idf-codeowners/storage @esp-idf-codeowners/system
|
||||
/components/esp_wifi/ @esp-idf-codeowners/wifi
|
||||
|
@@ -38,6 +38,7 @@ idf_component_register(SRCS ${srcs}
|
||||
REQUIRES "${requires}"
|
||||
PRIV_REQUIRES esp_driver_uart
|
||||
esp_driver_usb_serial_jtag
|
||||
esp_usb_cdc_rom_console
|
||||
)
|
||||
|
||||
if(CONFIG_COMPILER_STATIC_ANALYZER AND CMAKE_C_COMPILER_ID STREQUAL "GNU") # TODO IDF-10085
|
||||
|
@@ -76,7 +76,7 @@ else()
|
||||
# [refactor-todo] requirements due to init code,
|
||||
# should be removable once using component init functions
|
||||
# link-time registration is used.
|
||||
bootloader_support esp_pm
|
||||
bootloader_support esp_pm esp_usb_cdc_rom_console
|
||||
LDFRAGMENTS "linker.lf" "app.lf")
|
||||
add_subdirectory(port)
|
||||
|
||||
|
@@ -25,7 +25,6 @@ menu "ESP System Settings"
|
||||
- Unified Behavior Sanitizer (UBSAN) hook
|
||||
- Interrupt watchdog handler
|
||||
- XTAL32K watchdog timer
|
||||
- USB CDC functions for the esp_rom_printf (if ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF=y)
|
||||
- IPC and IPC ISR
|
||||
|
||||
choice ESP_SYSTEM_PANIC
|
||||
|
@@ -34,20 +34,6 @@ entries:
|
||||
if COMPILER_STACK_CHECK = y:
|
||||
stack_check:__stack_chk_fail (noflash)
|
||||
|
||||
if ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF:
|
||||
usb_console:esp_usb_console_write_char (noflash)
|
||||
usb_console:esp_usb_console_write_buf (noflash)
|
||||
usb_console:esp_usb_console_flush_internal (noflash)
|
||||
usb_console:esp_usb_console_osglue_wait_proc (noflash)
|
||||
usb_console:esp_usb_console_osglue_dis_int (noflash)
|
||||
usb_console:esp_usb_console_osglue_ena_int (noflash)
|
||||
usb_console:esp_usb_console_interrupt (noflash)
|
||||
usb_console:esp_usb_console_poll_interrupts (noflash)
|
||||
usb_console:esp_usb_console_cdc_acm_cb (noflash)
|
||||
usb_console:esp_usb_console_dfu_detach_cb (noflash)
|
||||
usb_console:esp_usb_console_before_restart (noflash)
|
||||
usb_console:esp_usb_console_on_restart_timeout (noflash)
|
||||
|
||||
if APP_BUILD_TYPE_RAM = n:
|
||||
image_process (noflash)
|
||||
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include "esp_compiler.h"
|
||||
|
||||
#include "esp_private/system_internal.h"
|
||||
#include "esp_private/usb_console.h"
|
||||
|
||||
#include "esp_cpu.h"
|
||||
#include "soc/rtc.h"
|
||||
@@ -64,6 +63,10 @@
|
||||
#include "hal/usb_serial_jtag_ll.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_ESP_CONSOLE_USB_CDC
|
||||
#include "esp_private/usb_console.h"
|
||||
#endif
|
||||
|
||||
#ifdef __XTENSA__
|
||||
#include "xtensa/semihosting.h"
|
||||
#elif __riscv
|
||||
|
@@ -12,10 +12,6 @@ if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
|
||||
list(APPEND srcs "image_process.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP_CONSOLE_USB_CDC)
|
||||
list(APPEND srcs "usb_console.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP_IPC_ISR_ENABLE)
|
||||
list(APPEND srcs "esp_ipc_isr.c")
|
||||
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
|
@@ -55,9 +55,10 @@ CORE: 105: init_newlib_time in components/esp_system/startup_funcs.c on BIT(0)
|
||||
CORE: 110: init_vfs_uart in components/esp_driver_uart/src/uart_vfs.c on BIT(0)
|
||||
CORE: 111: init_vfs_usj in components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c on BIT(0)
|
||||
CORE: 112: init_vfs_usj_sec in components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c on BIT(0)
|
||||
CORE: 113: init_vfs_nullfs in components/vfs/nullfs.c on BIT(0)
|
||||
CORE: 114: init_vfs_console in components/esp_vfs_console/vfs_console.c on BIT(0)
|
||||
CORE: 115: init_libc_stdio in components/newlib/src/init.c on BIT(0)
|
||||
CORE: 113: init_vfs_usb_cdc_rom_console in components/esp_usb_cdc_rom_console/vfs_cdcacm.c on BIT(0)
|
||||
CORE: 118: init_vfs_nullfs in components/vfs/nullfs.c on BIT(0)
|
||||
CORE: 119: init_vfs_console in components/esp_vfs_console/vfs_console.c on BIT(0)
|
||||
CORE: 120: init_libc_stdio in components/newlib/src/init.c on BIT(0)
|
||||
|
||||
CORE: 130: init_flash in components/esp_system/startup_funcs.c on BIT(0)
|
||||
CORE: 140: init_efuse in components/efuse/src/esp_efuse_startup.c on BIT(0)
|
||||
@@ -112,7 +113,7 @@ SECONDARY: 205: init_bootloader_offset in components/esp_system/startup_funcs.c
|
||||
|
||||
# usb_console needs to create an esp_timer at startup.
|
||||
# This can be done only after esp_timer initialization (esp_timer_init_os).
|
||||
SECONDARY: 220: esp_usb_console_init_restart_timer in components/esp_system/port/usb_console.c on BIT(0)
|
||||
SECONDARY: 220: esp_usb_console_init_restart_timer in components/esp_usb_cdc_rom_console/usb_console.c on BIT(0)
|
||||
|
||||
# usb_serial_jtag needs to create and acquire a PM lock at startup.
|
||||
# This makes more sense to be done after esp_pm_impl_init (called from init_pm).
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||
components/esp_vfs_console/test_apps/usb_cdc_vfs:
|
||||
components/esp_usb_cdc_rom_console/test_apps/usb_cdc_vfs:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32s3"] # reason: console components is only implemented on these targets. TODO P4: IDF-9120
|
18
components/esp_usb_cdc_rom_console/CMakeLists.txt
Normal file
18
components/esp_usb_cdc_rom_console/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
|
||||
if(CONFIG_ESP_CONSOLE_USB_CDC)
|
||||
list(APPEND srcs "usb_console.c")
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES esp_timer
|
||||
LDFRAGMENTS linker.lf
|
||||
)
|
||||
|
||||
if(CONFIG_VFS_SUPPORT_IO AND CONFIG_ESP_CONSOLE_USB_CDC)
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC idf::vfs)
|
||||
target_sources(${COMPONENT_LIB} PRIVATE "vfs_cdcacm.c")
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_vfs_dev_cdcacm_include_dev_init")
|
||||
endif()
|
18
components/esp_usb_cdc_rom_console/linker.lf
Normal file
18
components/esp_usb_cdc_rom_console/linker.lf
Normal file
@@ -0,0 +1,18 @@
|
||||
[mapping:esp_usb_cdc_rom_console]
|
||||
archive: libesp_usb_cdc_rom_console.a
|
||||
entries:
|
||||
if ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF:
|
||||
usb_console:esp_usb_console_write_char (noflash)
|
||||
usb_console:esp_usb_console_write_buf (noflash)
|
||||
usb_console:esp_usb_console_flush_internal (noflash)
|
||||
usb_console:esp_usb_console_osglue_wait_proc (noflash)
|
||||
usb_console:esp_usb_console_osglue_dis_int (noflash)
|
||||
usb_console:esp_usb_console_osglue_ena_int (noflash)
|
||||
usb_console:esp_usb_console_interrupt (noflash)
|
||||
usb_console:esp_usb_console_poll_interrupts (noflash)
|
||||
usb_console:esp_usb_console_cdc_acm_cb (noflash)
|
||||
usb_console:esp_usb_console_dfu_detach_cb (noflash)
|
||||
usb_console:esp_usb_console_before_restart (noflash)
|
||||
usb_console:esp_usb_console_on_restart_timeout (noflash)
|
||||
vfs_cdcacm:cdcacm_tx_cb (noflash)
|
||||
vfs_cdcacm:cdcacm_rx_cb (noflash)
|
@@ -1,5 +1,5 @@
|
||||
# This is the project CMakeLists.txt file for the test subproject
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
list(PREPEND SDKCONFIG_DEFAULTS "$ENV{IDF_PATH}/tools/test_apps/configs/sdkconfig.debug_helpers" "sdkconfig.defaults")
|
||||
|
@@ -2,6 +2,6 @@ set(src "test_app_main.c")
|
||||
|
||||
idf_component_register(SRCS ${src}
|
||||
PRIV_INCLUDE_DIRS .
|
||||
PRIV_REQUIRES esp_system esp_vfs_console unity
|
||||
PRIV_REQUIRES esp_system esp_vfs_console unity esp_usb_cdc_rom_console
|
||||
WHOLE_ARCHIVE
|
||||
)
|
@@ -16,9 +16,9 @@
|
||||
#include "esp_attr.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_heap_caps.h"
|
||||
|
||||
#include "esp_private/esp_vfs_cdcacm_select.h"
|
||||
#include "esp_private/usb_console.h"
|
||||
#include "esp_private/startup_internal.h"
|
||||
|
||||
#define USB_CDC_LOCAL_FD 0
|
||||
|
||||
@@ -522,3 +522,19 @@ esp_err_t esp_vfs_dev_cdcacm_register(void)
|
||||
{
|
||||
return esp_vfs_register_fs("/dev/cdcacm", &s_cdcacm_vfs, ESP_VFS_FLAG_STATIC, NULL);
|
||||
}
|
||||
#if CONFIG_ESP_CONSOLE_USB_CDC
|
||||
ESP_SYSTEM_INIT_FN(init_vfs_usb_cdc_rom_console, CORE, BIT(0), 113)
|
||||
{
|
||||
esp_err_t err = esp_usb_console_init();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return esp_vfs_dev_cdcacm_register();
|
||||
}
|
||||
#endif
|
||||
|
||||
void esp_vfs_dev_cdcacm_include_dev_init(void)
|
||||
{
|
||||
// Linker hook function, exists to make the linker examine this file
|
||||
}
|
@@ -8,12 +8,8 @@ set(srcs "vfs_console.c")
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES vfs esp_driver_uart esp_driver_usb_serial_jtag
|
||||
LDFRAGMENTS linker.lf)
|
||||
|
||||
if(CONFIG_ESP_CONSOLE_USB_CDC)
|
||||
target_sources(${COMPONENT_LIB} PRIVATE "vfs_cdcacm.c")
|
||||
endif()
|
||||
PRIV_REQUIRES vfs esp_driver_uart esp_driver_usb_serial_jtag esp_usb_cdc_rom_console
|
||||
)
|
||||
|
||||
if(CONFIG_VFS_SUPPORT_IO)
|
||||
target_link_libraries(${COMPONENT_LIB} PUBLIC idf::vfs)
|
||||
|
@@ -247,14 +247,6 @@ esp_err_t esp_vfs_console_register(void)
|
||||
primary_vfs = esp_vfs_usb_serial_jtag_get_vfs();
|
||||
#elif CONFIG_ESP_CONSOLE_USB_CDC
|
||||
primary_vfs = esp_vfs_cdcacm_get_vfs();
|
||||
err = esp_usb_console_init();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
err = esp_vfs_dev_cdcacm_register();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
#else
|
||||
primary_vfs = esp_vfs_null_get_vfs();
|
||||
#endif
|
||||
@@ -267,7 +259,7 @@ esp_err_t esp_vfs_console_register(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_vfs_console, CORE, BIT(0), 114)
|
||||
ESP_SYSTEM_INIT_FN(init_vfs_console, CORE, BIT(0), 119)
|
||||
{
|
||||
return esp_vfs_console_register();
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ ESP_SYSTEM_INIT_FN(init_libc, CORE, BIT(0), 102)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_libc_stdio, CORE, BIT(0), 115)
|
||||
ESP_SYSTEM_INIT_FN(init_libc_stdio, CORE, BIT(0), 120)
|
||||
{
|
||||
#if CONFIG_VFS_SUPPORT_IO
|
||||
esp_libc_init_global_stdio("/dev/console");
|
||||
|
@@ -15,10 +15,7 @@ list(APPEND sources "vfs.c"
|
||||
"nullfs.c"
|
||||
)
|
||||
|
||||
list(APPEND pr esp_timer
|
||||
# for backwards compatibility (TODO: IDF-8799)
|
||||
esp_driver_uart esp_driver_usb_serial_jtag esp_vfs_console
|
||||
)
|
||||
list(APPEND pr esp_vfs_console)
|
||||
|
||||
idf_component_register(SRCS ${sources}
|
||||
LDFRAGMENTS "linker.lf"
|
||||
|
@@ -318,7 +318,7 @@ static int vfs_null_fsync(int fd)
|
||||
}
|
||||
|
||||
#if defined(CONFIG_VFS_INITIALIZE_DEV_NULL) || defined(CONFIG_ESP_CONSOLE_NONE)
|
||||
ESP_SYSTEM_INIT_FN(init_vfs_nullfs, CORE, BIT(0), 113)
|
||||
ESP_SYSTEM_INIT_FN(init_vfs_nullfs, CORE, BIT(0), 118)
|
||||
{
|
||||
return esp_vfs_null_register();
|
||||
}
|
||||
|
@@ -180,3 +180,9 @@ The ``CONFIG_APPTRACE_GCOV_ENABLE`` option has been renamed to ``CONFIG_ESP_GCOV
|
||||
**Header File Changes**
|
||||
|
||||
For the gcov functionality, include the ``esp_gcov.h`` header file instead of ``esp_app_trace.h``.
|
||||
|
||||
System Console (STDIO)
|
||||
----------------------
|
||||
|
||||
``esp_vfs_cdcacm.h`` has been moved to the new component ``esp_usb_cdc_rom_console``, you will now have to add an explicit ``REQUIRES`` for ``esp_usb_cdc_rom_console`` if using any functions from this header.
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
idf_component_register(SRCS "console_example_main.c" "console_settings.c"
|
||||
PRIV_REQUIRES console esp_driver_uart fatfs esp_driver_usb_serial_jtag
|
||||
nvs_flash cmd_system cmd_wifi cmd_nvs
|
||||
esp_usb_cdc_rom_console nvs_flash cmd_system cmd_wifi cmd_nvs
|
||||
INCLUDE_DIRS ".")
|
||||
|
@@ -68,10 +68,10 @@ set(extra_components_which_shouldnt_be_included
|
||||
|
||||
# esp_timer is a dependency of esp_pm, esp_system, esp_security, esp_hw_support
|
||||
# esp_pm should be removed from G1 build
|
||||
# esp_system's dependency is due to usb_console (used for timeout functionality)
|
||||
# and task_wdt timer implementation on C2, we could possibly place this implementation in esp_timer instead
|
||||
# esp_system's dependency is due to task_wdt timer implementation on C2,
|
||||
# we could possibly place this implementation in esp_timer instead
|
||||
# esp_security uses it for esp_ds (used for timeout functionality)
|
||||
# esp_hw_support uses it for componensating time after sleep (dependency could be reversed) IDF-10416
|
||||
# and for componensating time after sleep (dependency could be reversed) IDF-10416
|
||||
esp_timer
|
||||
|
||||
# esptool_py is a dependency of bootloader, app_update, partition_table, all of which
|
||||
@@ -94,6 +94,10 @@ set(extra_components_which_shouldnt_be_included
|
||||
|
||||
# esp_security is required by mbedtls and spi_flash
|
||||
esp_security
|
||||
|
||||
# esp_usb_cdc_rom_console is used by the panic handler, will be conditional on cdc console option when
|
||||
# the new build-system is implemented
|
||||
esp_usb_cdc_rom_console
|
||||
)
|
||||
|
||||
set(expected_components
|
||||
|
@@ -2,10 +2,6 @@
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import argparse
|
||||
import logging
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Tuple
|
||||
|
||||
g1_g0_components = [
|
||||
'hal',
|
||||
@@ -27,7 +23,7 @@ g1_g0_components = [
|
||||
|
||||
# Global expected dependency violations that apply to all targets
|
||||
expected_dep_violations = {
|
||||
'esp_system': ['esp_timer', 'bootloader_support', 'esp_pm'],
|
||||
'esp_system': ['esp_timer', 'bootloader_support', 'esp_pm', 'esp_usb_cdc_rom_console'],
|
||||
'spi_flash': ['bootloader_support'],
|
||||
'esp_hw_support': ['efuse', 'bootloader_support', 'esp_driver_gpio', 'esp_timer', 'esp_pm'],
|
||||
'cxx': ['pthread'],
|
||||
@@ -46,7 +42,7 @@ target_specific_expected_dep_violations = {
|
||||
}
|
||||
|
||||
|
||||
def merge_expected_violations(target: Optional[str] = None) -> Dict[str, List[str]]:
|
||||
def merge_expected_violations(target: str | None = None) -> dict[str, list[str]]:
|
||||
"""
|
||||
Merge global and target-specific expected dependency violations.
|
||||
|
||||
@@ -75,13 +71,13 @@ def merge_expected_violations(target: Optional[str] = None) -> Dict[str, List[st
|
||||
return merged_violations
|
||||
|
||||
|
||||
def parse_dependencies(file_path: str, target: Optional[str] = None) -> Tuple[Dict[str, List[str]], List[str]]:
|
||||
def parse_dependencies(file_path: str, target: str | None = None) -> tuple[dict[str, list[str]], list[str]]:
|
||||
new_dependency_errors = []
|
||||
|
||||
# Get merged expected violations for the specified target
|
||||
merged_expected_violations = merge_expected_violations(target)
|
||||
|
||||
with open(file_path, 'r') as file:
|
||||
with open(file_path) as file:
|
||||
for line in file:
|
||||
line = line.strip(' ;')
|
||||
|
||||
|
Reference in New Issue
Block a user