From e1629036154f4f6c8b88d330207f88974f701d35 Mon Sep 17 00:00:00 2001 From: "sonika.rathi" Date: Tue, 23 Jan 2024 12:09:57 +0100 Subject: [PATCH] fix(esp_vfs_console): add esp_vfs_console component move vfs_console related init steps from vfs component to new esp_vfs_console component --- components/console/CMakeLists.txt | 2 +- .../include/driver/esp_private/uart_vfs.h | 27 +++++ components/esp_driver_uart/src/uart_vfs.c | 10 +- .../driver/esp_private/usb_serial_jtag_vfs.h | 27 +++++ .../src/usb_serial_jtag_vfs.c | 6 +- components/esp_system/system_init_fn.txt | 2 +- .../main/test_reset_reason.c | 2 +- components/esp_vfs_console/CMakeLists.txt | 22 ++++ .../include/esp_private/esp_vfs_cdcacm.h | 27 +++++ .../include/esp_vfs_cdcacm.h | 2 +- .../include/esp_vfs_console.h | 0 .../{vfs => esp_vfs_console}/vfs_cdcacm.c | 2 - .../{vfs => esp_vfs_console}/vfs_console.c | 106 +++++++----------- components/vfs/CMakeLists.txt | 12 +- .../vfs/include/esp_private/esp_vfs_console.h | 41 ------- .../vfs/private_include/esp_vfs_private.h | 22 +--- .../esp_event/default_event_loop/main/main.c | 2 +- 17 files changed, 161 insertions(+), 151 deletions(-) create mode 100644 components/esp_driver_uart/include/driver/esp_private/uart_vfs.h create mode 100644 components/esp_driver_usb_serial_jtag/include/driver/esp_private/usb_serial_jtag_vfs.h create mode 100644 components/esp_vfs_console/CMakeLists.txt create mode 100644 components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h rename components/{vfs => esp_vfs_console}/include/esp_vfs_cdcacm.h (95%) rename components/{vfs => esp_vfs_console}/include/esp_vfs_console.h (100%) rename components/{vfs => esp_vfs_console}/vfs_cdcacm.c (99%) rename components/{vfs => esp_vfs_console}/vfs_console.c (58%) delete mode 100644 components/vfs/include/esp_private/esp_vfs_console.h diff --git a/components/console/CMakeLists.txt b/components/console/CMakeLists.txt index 9f8aaa5397..0e188d6f88 100644 --- a/components/console/CMakeLists.txt +++ b/components/console/CMakeLists.txt @@ -31,7 +31,7 @@ idf_component_register(SRCS ${srcs} ${argtable_srcs} INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} PRIV_INCLUDE_DIRS private_include - REQUIRES vfs + REQUIRES vfs esp_vfs_console PRIV_REQUIRES esp_driver_uart esp_driver_usb_serial_jtag ) diff --git a/components/esp_driver_uart/include/driver/esp_private/uart_vfs.h b/components/esp_driver_uart/include/driver/esp_private/uart_vfs.h new file mode 100644 index 0000000000..c83e513ab5 --- /dev/null +++ b/components/esp_driver_uart/include/driver/esp_private/uart_vfs.h @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "esp_vfs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief get pointer of uart vfs. + * + * This function is called in vfs_console in order to get the vfs implementation + * of uart. + * + * @return pointer to structure esp_vfs_t + */ +const esp_vfs_t *esp_vfs_uart_get_vfs(void); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_driver_uart/src/uart_vfs.c b/components/esp_driver_uart/src/uart_vfs.c index 146e96cf84..6e5a0dbfaf 100644 --- a/components/esp_driver_uart/src/uart_vfs.c +++ b/components/esp_driver_uart/src/uart_vfs.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -19,7 +19,6 @@ #include "esp_rom_uart.h" #include "hal/uart_ll.h" #include "soc/soc_caps.h" -#include "esp_private/esp_vfs_console.h" #include "esp_vfs_dev.h" // Old headers for the aliasing functions #include "esp_private/startup_internal.h" @@ -1010,6 +1009,11 @@ static const esp_vfs_t uart_vfs = { #endif // CONFIG_VFS_SUPPORT_TERMIOS }; +const esp_vfs_t *esp_vfs_uart_get_vfs(void) +{ + return &uart_vfs; +} + void uart_vfs_dev_register(void) { ESP_ERROR_CHECK(esp_vfs_register("/dev/uart", &uart_vfs, NULL)); @@ -1074,7 +1078,7 @@ void uart_vfs_dev_use_driver(int uart_num) #if CONFIG_ESP_CONSOLE_UART ESP_SYSTEM_INIT_FN(init_vfs_uart, CORE, BIT(0), 110) { - esp_vfs_set_primary_dev_vfs_def_struct(&uart_vfs); + uart_vfs_dev_register(); return ESP_OK; } #endif diff --git a/components/esp_driver_usb_serial_jtag/include/driver/esp_private/usb_serial_jtag_vfs.h b/components/esp_driver_usb_serial_jtag/include/driver/esp_private/usb_serial_jtag_vfs.h new file mode 100644 index 0000000000..7a94728580 --- /dev/null +++ b/components/esp_driver_usb_serial_jtag/include/driver/esp_private/usb_serial_jtag_vfs.h @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "esp_vfs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief get pointer of usb_serial_jtag vfs. + * + * This function is called in vfs_console in order to get the vfs implementation + * of usb_serial_jtag. + * + * @return pointer to structure esp_vfs_t + */ +const esp_vfs_t *esp_vfs_usb_serial_jtag_get_vfs(void); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c b/components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c index 1976d4bfb7..9446a6d24e 100644 --- a/components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c +++ b/components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c @@ -18,7 +18,6 @@ #include "esp_vfs.h" #include "esp_vfs_dev.h" // Old headers for the aliasing functions #include "esp_vfs_usb_serial_jtag.h" // Old headers for the aliasing functions -#include "esp_private/esp_vfs_console.h" #include "esp_attr.h" #include "esp_log.h" #include "sdkconfig.h" @@ -395,7 +394,7 @@ esp_err_t usb_serial_jtag_vfs_register(void) #if CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG ESP_SYSTEM_INIT_FN(init_vfs_usj, CORE, BIT(0), 111) { - esp_vfs_set_primary_dev_vfs_def_struct(&usj_vfs); + usb_serial_jtag_vfs_register(); return ESP_OK; } #endif @@ -403,7 +402,8 @@ ESP_SYSTEM_INIT_FN(init_vfs_usj, CORE, BIT(0), 111) #if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG ESP_SYSTEM_INIT_FN(init_vfs_usj_sec, CORE, BIT(0), 112) { - esp_vfs_set_secondary_dev_vfs_def_struct(&usj_vfs); + // "/dev/seccondary_usb_serial_jtag" unfortunately is too long for vfs + esp_vfs_register("/dev/secondary", &usj_vfs, NULL); return ESP_OK; } #endif diff --git a/components/esp_system/system_init_fn.txt b/components/esp_system/system_init_fn.txt index beb3c458df..55cea6a358 100644 --- a/components/esp_system/system_init_fn.txt +++ b/components/esp_system/system_init_fn.txt @@ -50,7 +50,7 @@ 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: 114: init_vfs_console in components/vfs/vfs_console.c on BIT(0) +CORE: 114: init_vfs_console in components/esp_vfs_console/vfs_console.c on BIT(0) CORE: 115: init_newlib_stdio in components/newlib/newlib_init.c on BIT(0) CORE: 120: init_pthread in components/pthread/pthread.c on BIT(0) diff --git a/components/esp_system/test_apps/esp_system_unity_tests/main/test_reset_reason.c b/components/esp_system/test_apps/esp_system_unity_tests/main/test_reset_reason.c index 211ca2084c..68eb591372 100644 --- a/components/esp_system/test_apps/esp_system_unity_tests/main/test_reset_reason.c +++ b/components/esp_system/test_apps/esp_system_unity_tests/main/test_reset_reason.c @@ -389,7 +389,7 @@ TEST_CASE_MULTIPLE_STAGES("reset reason ESP_RST_BROWNOUT after brownout event", #include "xt_instr_macros.h" #include "xtensa/config/specreg.h" -static int size_stack = 1024 * 3; +static int size_stack = 1024 * 4; static StackType_t *start_addr_stack; static int fibonacci(int n, void* func(void)) diff --git a/components/esp_vfs_console/CMakeLists.txt b/components/esp_vfs_console/CMakeLists.txt new file mode 100644 index 0000000000..50954747a7 --- /dev/null +++ b/components/esp_vfs_console/CMakeLists.txt @@ -0,0 +1,22 @@ +idf_build_get_property(target IDF_TARGET) + +if(${target} STREQUAL "linux") + return() # This component is not supported by the POSIX/Linux simulator +endif() + +set(srcs "vfs_console.c") + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS include + PRIV_REQUIRES vfs esp_driver_uart esp_driver_usb_serial_jtag + ) + +if(CONFIG_ESP_CONSOLE_USB_CDC) + target_sources(${COMPONENT_LIB} PRIVATE "vfs_cdcacm.c") +endif() + +if(CONFIG_VFS_SUPPORT_IO) + target_link_libraries(${COMPONENT_LIB} PUBLIC idf::vfs) + # Make sure esp_vfs_console_register gets called at startup stage + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_vfs_include_console_register") +endif() diff --git a/components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h b/components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h new file mode 100644 index 0000000000..b93d1a4da0 --- /dev/null +++ b/components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include "esp_vfs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief get pointer of cdcacm vfs. + * + * This function is called in vfs_console in order to get the vfs implementation + * of cdcacm. + * + * @return pointer to structure esp_vfs_t + */ +const esp_vfs_t *esp_vfs_cdcacm_get_vfs(void); + +#ifdef __cplusplus +} +#endif diff --git a/components/vfs/include/esp_vfs_cdcacm.h b/components/esp_vfs_console/include/esp_vfs_cdcacm.h similarity index 95% rename from components/vfs/include/esp_vfs_cdcacm.h rename to components/esp_vfs_console/include/esp_vfs_cdcacm.h index 416efb35a4..8bd0121363 100644 --- a/components/vfs/include/esp_vfs_cdcacm.h +++ b/components/esp_vfs_console/include/esp_vfs_cdcacm.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/vfs/include/esp_vfs_console.h b/components/esp_vfs_console/include/esp_vfs_console.h similarity index 100% rename from components/vfs/include/esp_vfs_console.h rename to components/esp_vfs_console/include/esp_vfs_console.h diff --git a/components/vfs/vfs_cdcacm.c b/components/esp_vfs_console/vfs_cdcacm.c similarity index 99% rename from components/vfs/vfs_cdcacm.c rename to components/esp_vfs_console/vfs_cdcacm.c index 874c3af317..01545d96b5 100644 --- a/components/vfs/vfs_cdcacm.c +++ b/components/esp_vfs_console/vfs_cdcacm.c @@ -160,7 +160,6 @@ static ssize_t cdcacm_read(int fd, void *data, size_t size) xSemaphoreTake(s_rx_semaphore, portMAX_DELAY); } - if (s_rx_mode == ESP_LINE_ENDINGS_CR || s_rx_mode == ESP_LINE_ENDINGS_LF) { /* This is easy. Just receive, and if needed replace \r by \n. */ received = esp_usb_console_read_buf(data_c, size); @@ -266,7 +265,6 @@ static int cdcacm_disable_blocking(void) return 0; } - static int cdcacm_fcntl(int fd, int cmd, int arg) { assert(fd == 0); diff --git a/components/vfs/vfs_console.c b/components/esp_vfs_console/vfs_console.c similarity index 58% rename from components/vfs/vfs_console.c rename to components/esp_vfs_console/vfs_console.c index eb65baf88d..946c8bb6af 100644 --- a/components/vfs/vfs_console.c +++ b/components/esp_vfs_console/vfs_console.c @@ -4,13 +4,15 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include "esp_err.h" #include "esp_rom_sys.h" #include "esp_vfs_cdcacm.h" -#include "esp_vfs_private.h" +#include "esp_private/esp_vfs_cdcacm.h" +#include "driver/esp_private/usb_serial_jtag_vfs.h" +#include "driver/esp_private/uart_vfs.h" #include "esp_private/usb_console.h" #include "esp_vfs_console.h" -#include "esp_private/esp_vfs_console.h" #include "sdkconfig.h" #include "esp_private/startup_internal.h" @@ -31,41 +33,30 @@ typedef struct { } vfs_console_context_t; #if CONFIG_VFS_SUPPORT_IO -// Primary register part. -#ifdef CONFIG_ESP_CONSOLE_UART -const static char *primary_path = "/dev/uart"; -#elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG -const static char *primary_path = "/dev/usbserjtag"; -#elif CONFIG_ESP_CONSOLE_USB_CDC -const static char *primary_path = "/dev/cdcacm"; -#endif // Secondary register part. #if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG -const static char *secondary_path = "/dev/secondary"; -static int secondary_vfs_index; const static esp_vfs_t *secondary_vfs = NULL; #endif // Secondary part -static int primary_vfs_index; const static esp_vfs_t *primary_vfs = NULL; -static vfs_console_context_t vfs_console= {0}; +static vfs_console_context_t vfs_console = {0}; int console_open(const char * path, int flags, int mode) { // Primary port open #if CONFIG_ESP_CONSOLE_UART - vfs_console.fd_primary = get_vfs_for_path(primary_path)->vfs.open("/"STRINGIFY(CONFIG_ESP_CONSOLE_UART_NUM), flags, mode); + vfs_console.fd_primary = open("/dev/uart/"STRINGIFY(CONFIG_ESP_CONSOLE_UART_NUM), flags, mode); #elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG - vfs_console.fd_primary = get_vfs_for_path(primary_path)->vfs.open("/", flags, mode); + vfs_console.fd_primary = open("/dev/usbserjtag", flags, mode); #elif CONFIG_ESP_CONSOLE_USB_CDC - vfs_console.fd_primary = esp_vfs_cdcacm_get_vfs()->open("/", flags, mode); + vfs_console.fd_primary = open("/dev/cdcacm", flags, mode); #endif // Secondary port open #if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG - vfs_console.fd_secondary = get_vfs_for_path(secondary_path)->vfs.open("/", flags, mode); + vfs_console.fd_secondary = open("/dev/secondary", flags, mode); #endif return 0; } @@ -73,70 +64,70 @@ int console_open(const char * path, int flags, int mode) ssize_t console_write(int fd, const void *data, size_t size) { // All function calls are to primary, except from write and close, which will be forwarded to both primary and secondary. - get_vfs_for_index(primary_vfs_index)->vfs.write(vfs_console.fd_primary, data, size); + write(vfs_console.fd_primary, data, size); #if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG - get_vfs_for_index(secondary_vfs_index)->vfs.write(vfs_console.fd_secondary, data, size); + write(vfs_console.fd_secondary, data, size); #endif return size; } int console_fstat(int fd, struct stat * st) { - return get_vfs_for_index(primary_vfs_index)->vfs.fstat(fd, st); + return fstat(fd, st); } int console_close(int fd) { // All function calls are to primary, except from write and close, which will be forwarded to both primary and secondary. - get_vfs_for_index(primary_vfs_index)->vfs.close(vfs_console.fd_primary); + close(vfs_console.fd_primary); #if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG - get_vfs_for_index(secondary_vfs_index)->vfs.close(vfs_console.fd_secondary); + close(vfs_console.fd_secondary); #endif return 0; } ssize_t console_read(int fd, void * dst, size_t size) { - return get_vfs_for_index(primary_vfs_index)->vfs.read(vfs_console.fd_primary, dst, size); + return read(vfs_console.fd_primary, dst, size); } int console_fcntl(int fd, int cmd, int arg) { - return get_vfs_for_index(primary_vfs_index)->vfs.fcntl(vfs_console.fd_primary, cmd, arg); + return fcntl(vfs_console.fd_primary, cmd, arg); } int console_fsync(int fd) { - return get_vfs_for_index(primary_vfs_index)->vfs.fsync(vfs_console.fd_primary); + return fsync(vfs_console.fd_primary); } #ifdef CONFIG_VFS_SUPPORT_DIR int console_access(const char *path, int amode) { // currently only UART support DIR. - return get_vfs_for_index(primary_vfs_index)->vfs.access("/"STRINGIFY(CONFIG_ESP_CONSOLE_UART_NUM), amode); + return access("/dev/uart/"STRINGIFY(CONFIG_ESP_CONSOLE_UART_NUM), amode); } #endif // CONFIG_VFS_SUPPORT_DIR #ifdef CONFIG_VFS_SUPPORT_SELECT static esp_err_t console_start_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - esp_vfs_select_sem_t select_sem, void **end_select_args) + esp_vfs_select_sem_t select_sem, void **end_select_args) { - const vfs_entry_t* vfs_entry = get_vfs_for_index(primary_vfs_index); // start_select is not guaranteed be implemented even though CONFIG_VFS_SUPPORT_SELECT is enabled in sdkconfig - if (vfs_entry && vfs_entry->vfs.start_select) { - return vfs_entry->vfs.start_select(nfds, readfds, writefds, exceptfds, select_sem, end_select_args); + if (primary_vfs->start_select) { + return primary_vfs->start_select(nfds, readfds, writefds, exceptfds, select_sem, end_select_args); } + return ESP_ERR_NOT_SUPPORTED; } esp_err_t console_end_select(void *end_select_args) { - const vfs_entry_t* vfs_entry = get_vfs_for_index(primary_vfs_index); // end_select is not guaranteed be implemented even though CONFIG_VFS_SUPPORT_SELECT is enabled in sdkconfig - if (vfs_entry && vfs_entry->vfs.end_select) { - return vfs_entry->vfs.end_select(end_select_args); + if (primary_vfs->end_select) { + return primary_vfs->end_select(end_select_args); } + return ESP_ERR_NOT_SUPPORTED; } @@ -146,22 +137,22 @@ esp_err_t console_end_select(void *end_select_args) int console_tcsetattr(int fd, int optional_actions, const struct termios *p) { - return get_vfs_for_index(primary_vfs_index)->vfs.tcsetattr(vfs_console.fd_primary, optional_actions, p); + return tcsetattr(vfs_console.fd_primary, optional_actions, p); } int console_tcgetattr(int fd, struct termios *p) { - return get_vfs_for_index(primary_vfs_index)->vfs.tcgetattr(vfs_console.fd_primary, p); + return tcgetattr(vfs_console.fd_primary, p); } int console_tcdrain(int fd) { - return get_vfs_for_index(primary_vfs_index)->vfs.tcdrain(vfs_console.fd_primary); + return tcdrain(vfs_console.fd_primary); } int console_tcflush(int fd, int select) { - return get_vfs_for_index(primary_vfs_index)->vfs.tcflush(vfs_console.fd_primary, select); + return tcflush(vfs_console.fd_primary, select); } #endif // CONFIG_VFS_SUPPORT_TERMIOS @@ -197,47 +188,32 @@ static esp_err_t esp_vfs_dev_console_register(void) esp_err_t esp_vfs_console_register(void) { esp_err_t err = ESP_OK; -// Primary register part. -#if CONFIG_ESP_CONSOLE_UART || CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG - assert(primary_vfs); +// Primary vfs part. +#if CONFIG_ESP_CONSOLE_UART + primary_vfs = esp_vfs_uart_get_vfs(); +#elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG + 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; } -#endif -#if !CONFIG_ESP_CONSOLE_NONE - err = esp_vfs_register_common(primary_path, strlen(primary_path), primary_vfs, NULL, &primary_vfs_index); + err = esp_vfs_dev_cdcacm_register(); if (err != ESP_OK) { return err; } -#endif // !CONFIG_ESP_CONSOLE_NONE - -// Secondary register part. -#if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG - assert(secondary_vfs); - err = esp_vfs_register_common(secondary_path, strlen(secondary_path), secondary_vfs, NULL, &secondary_vfs_index); - if(err != ESP_OK) { - return err; - } #endif + +// Secondary vfs part. +#if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG + secondary_vfs = esp_vfs_usb_serial_jtag_get_vfs(); +#endif + err = esp_vfs_dev_console_register(); return err; } -void esp_vfs_set_primary_dev_vfs_def_struct(const esp_vfs_t *vfs) -{ - primary_vfs = vfs; -} - -#if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG -void esp_vfs_set_secondary_dev_vfs_def_struct(const esp_vfs_t *vfs) -{ - secondary_vfs = vfs; -} -#endif - ESP_SYSTEM_INIT_FN(init_vfs_console, CORE, BIT(0), 114) { return esp_vfs_console_register(); diff --git a/components/vfs/CMakeLists.txt b/components/vfs/CMakeLists.txt index 96f9c88630..bf884d0178 100644 --- a/components/vfs/CMakeLists.txt +++ b/components/vfs/CMakeLists.txt @@ -7,12 +7,11 @@ endif() list(APPEND sources "vfs.c" "vfs_eventfd.c" "vfs_semihost.c" - "vfs_console.c" ) list(APPEND pr esp_timer # for backwards compatibility (TODO: IDF-8799) - esp_driver_uart esp_driver_usb_serial_jtag + esp_driver_uart esp_driver_usb_serial_jtag esp_vfs_console ) idf_component_register(SRCS ${sources} @@ -21,15 +20,6 @@ idf_component_register(SRCS ${sources} PRIV_INCLUDE_DIRS private_include PRIV_REQUIRES ${pr}) -if(CONFIG_ESP_CONSOLE_USB_CDC) - target_sources(${COMPONENT_LIB} PRIVATE "vfs_cdcacm.c") -endif() - # Some newlib syscalls are implemented in vfs.c, make sure these are always # seen by the linker target_link_libraries(${COMPONENT_LIB} INTERFACE "-u vfs_include_syscalls_impl") - -if(CONFIG_VFS_SUPPORT_IO) - # Make sure esp_vfs_console_register gets called at startup stage - target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_vfs_include_console_register") -endif() diff --git a/components/vfs/include/esp_private/esp_vfs_console.h b/components/vfs/include/esp_private/esp_vfs_console.h deleted file mode 100644 index 4196c451f3..0000000000 --- a/components/vfs/include/esp_private/esp_vfs_console.h +++ /dev/null @@ -1,41 +0,0 @@ - -/* - * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "sdkconfig.h" -#include "esp_vfs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if CONFIG_VFS_SUPPORT_IO -/** - * @brief Set the pointer of primary dev vfs. - * - * This function is called in each vfs dev driver as a system initialization function registered via ESP_SYSTEM_INIT_FN - * - * @param vfs pointer to structure esp_vfs_t - */ -void esp_vfs_set_primary_dev_vfs_def_struct(const esp_vfs_t *vfs); - -#if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG -/** - * @brief Set the pointer of secondary dev vfs. - * - * This function is called in each vfs dev driver as a system initialization function registered via ESP_SYSTEM_INIT_FN - * - * @param vfs pointer to structure esp_vfs_t - */ -void esp_vfs_set_secondary_dev_vfs_def_struct(const esp_vfs_t *vfs); -#endif //CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG -#endif // CONFIG_VFS_SUPPORT_IO - -#ifdef __cplusplus -} -#endif diff --git a/components/vfs/private_include/esp_vfs_private.h b/components/vfs/private_include/esp_vfs_private.h index 8122717314..fda3e9712b 100644 --- a/components/vfs/private_include/esp_vfs_private.h +++ b/components/vfs/private_include/esp_vfs_private.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -26,26 +26,6 @@ typedef struct vfs_entry_ { int offset; // index of this structure in s_vfs array } vfs_entry_t; -/** - * @brief get pointer of cdcacm vfs. - * - * This function is called in vfs_console in order to get the vfs implementation - * of cdcacm. - * - * @return pointer to structure esp_vfs_t - */ -const esp_vfs_t *esp_vfs_cdcacm_get_vfs(void); - -/** - * @brief get pointer of usb_serial_jtag vfs. - * - * This function is called in vfs_console in order to get the vfs implementation - * of usb_serial_jtag. - * - * @return pointer to structure esp_vfs_nonblocking_console_t - */ -const esp_vfs_t *esp_vfs_usb_serial_jtag_get_vfs(void); - /** * Register a virtual filesystem. * diff --git a/examples/system/esp_event/default_event_loop/main/main.c b/examples/system/esp_event/default_event_loop/main/main.c index 4564140327..6462891911 100644 --- a/examples/system/esp_event/default_event_loop/main/main.c +++ b/examples/system/esp_event/default_event_loop/main/main.c @@ -183,7 +183,7 @@ void app_main(void) ESP_LOGI(TAG, "starting event sources"); // Create the event source task with the same priority as the current task - xTaskCreate(task_event_source, "task_event_source", 2048, NULL, uxTaskPriorityGet(NULL), NULL); + xTaskCreate(task_event_source, "task_event_source", 4096, NULL, uxTaskPriorityGet(NULL), NULL); ESP_ERROR_CHECK(esp_timer_start_periodic(TIMER, TIMER_PERIOD));