diff --git a/boards/ESP32/ESP32-C6/Kconfig b/boards/ESP32/ESP32-C6/Kconfig new file mode 100644 index 000000000..49bc72182 --- /dev/null +++ b/boards/ESP32/ESP32-C6/Kconfig @@ -0,0 +1,26 @@ +config CHIP_CHOICE + string + default "esp32c6" + +config BOARD_CHOICE + string + default "ESP32-C6" + +config BOARD_CONFIG + bool + default y + select PLATFORM_FLASHSIZE_16M + +config UART_NUM0_TX_PIN + int "UART_NUM0_TX_PIN" + range 0 44 + default 16 + ---help--- + esp32-c6 default 16 + +config UART_NUM0_RX_PIN + int "UART_NUM0_RX_PIN" + range 0 44 + default 17 + ---help--- + esp32-c6 default 17 \ No newline at end of file diff --git a/boards/ESP32/Kconfig b/boards/ESP32/Kconfig index 779fbafba..9d5f1de6a 100755 --- a/boards/ESP32/Kconfig +++ b/boards/ESP32/Kconfig @@ -53,6 +53,12 @@ choice rsource "./ESP32-C3/Kconfig" endif + config BOARD_CHOICE_ESP32_C6 + bool "ESP32-C6" + if (BOARD_CHOICE_ESP32_C6) + rsource "./ESP32-C6/Kconfig" + endif + config BOARD_CHOICE_ESP32_S3 bool "ESP32-S3" if (BOARD_CHOICE_ESP32_S3) @@ -96,6 +102,13 @@ choice rsource "./DNESP32S3_BOX2_WIFI/Kconfig" endif + + config BOARD_CHOICE_WAVESHARE_ESP32C6_DEV_KIT_N16 + bool "WAVESHARE_ESP32C6_DEV_KIT_N16" + if (BOARD_CHOICE_WAVESHARE_ESP32C6_DEV_KIT_N16) + rsource "./WAVESHARE_ESP32C6_DEV_KIT_N16/Kconfig" + endif + # endchoice diff --git a/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/CMakeLists.txt b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/CMakeLists.txt new file mode 100755 index 000000000..ca72c8242 --- /dev/null +++ b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/CMakeLists.txt @@ -0,0 +1,44 @@ +## +# @file CMakeLists.txt +# @brief +#/ + +# MODULE_PATH +set(MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +# MODULE_NAME +get_filename_component(MODULE_NAME ${MODULE_PATH} NAME) + +# LIB_SRCS +aux_source_directory(${MODULE_PATH} LIB_SRCS) + +# LIB_PUBLIC_INC +set(LIB_PUBLIC_INC ${MODULE_PATH}) + + +######################################## +# Target Configure +######################################## +add_library(${MODULE_NAME}) + +target_sources(${MODULE_NAME} + PRIVATE + ${LIB_SRCS} + ) + +target_include_directories(${MODULE_NAME} + PRIVATE + ${LIB_PRIVATE_INC} + + PUBLIC + ${LIB_PUBLIC_INC} + ) + + +######################################## +# Layer Configure +######################################## +list(APPEND COMPONENT_LIBS ${MODULE_NAME}) +set(COMPONENT_LIBS "${COMPONENT_LIBS}" PARENT_SCOPE) +list(APPEND COMPONENT_PUBINC ${LIB_PUBLIC_INC}) +set(COMPONENT_PUBINC "${COMPONENT_PUBINC}" PARENT_SCOPE) diff --git a/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/Kconfig b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/Kconfig new file mode 100644 index 000000000..35b2e561b --- /dev/null +++ b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/Kconfig @@ -0,0 +1,27 @@ +config CHIP_CHOICE + string + default "esp32c6" + +config BOARD_CHOICE + string + default "WAVESHARE_ESP32C6_DEV_KIT_N16" + +config BOARD_CONFIG + bool + default y + select ENABLE_BUTTON + select PLATFORM_FLASHSIZE_16M + +config UART_NUM0_TX_PIN + int "UART_NUM0_TX_PIN" + range 0 44 + default 16 + ---help--- + esp32-c6 default 16 + +config UART_NUM0_RX_PIN + int "UART_NUM0_RX_PIN" + range 0 44 + default 17 + ---help--- + esp32-c6 default 17 \ No newline at end of file diff --git a/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/board_com_api.c b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/board_com_api.c new file mode 100644 index 000000000..415d5989e --- /dev/null +++ b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/board_com_api.c @@ -0,0 +1,63 @@ +/** + * @file board_com_api.c + * @author Tuya Inc. + * @brief Implementation of common board-level hardware registration APIs for audio, button, and LED peripherals. + * + * @copyright Copyright (c) 2021-2025 Tuya Inc. All Rights Reserved. + */ + +#include "tuya_cloud_types.h" +#include "tal_api.h" + +#include "tdd_button_gpio.h" + +/*********************************************************** +************************macro define************************ +***********************************************************/ +#define BOARD_BUTTON_PIN TUYA_GPIO_NUM_9 +#define BOARD_BUTTON_ACTIVE_LV TUYA_GPIO_LEVEL_LOW + +/*********************************************************** +***********************typedef define*********************** +***********************************************************/ + +/*********************************************************** +********************function declaration******************** +***********************************************************/ + +/*********************************************************** +***********************variable define********************** +***********************************************************/ + +/*********************************************************** +***********************function define********************** +***********************************************************/ + +static OPERATE_RET __board_register_button(void) +{ + OPERATE_RET rt = OPRT_OK; + + BUTTON_GPIO_CFG_T button_hw_cfg = { + .pin = BOARD_BUTTON_PIN, + .level = BOARD_BUTTON_ACTIVE_LV, + .mode = BUTTON_TIMER_SCAN_MODE, + .pin_type.gpio_pull = TUYA_GPIO_PULLUP, + }; + + TUYA_CALL_ERR_RETURN(tdd_gpio_button_register(BUTTON_NAME, &button_hw_cfg)); +} + +/** + * @brief Registers all the hardware peripherals (audio, button, LED) on the board. + * + * @return Returns OPERATE_RET_OK on success, or an appropriate error code on failure. + */ +OPERATE_RET board_register_hardware(void) +{ + OPERATE_RET rt = OPRT_OK; + + TUYA_CALL_ERR_LOG(__board_register_button()); + TUYA_CALL_ERR_LOG(__board_register_led()); + + return rt; +} diff --git a/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/board_com_api.h b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/board_com_api.h new file mode 100644 index 000000000..0dfdaed7b --- /dev/null +++ b/boards/ESP32/WAVESHARE_ESP32C6_DEV_KIT_N16/board_com_api.h @@ -0,0 +1,41 @@ +/** + * @file board_com_api.h + * @author Tuya Inc. + * @brief Header file for common board-level hardware registration APIs. + * + * @copyright Copyright (c) 2021-2025 Tuya Inc. All Rights Reserved. + */ + +#ifndef __BOARD_COM_API_H__ +#define __BOARD_COM_API_H__ + +#include "tuya_cloud_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*********************************************************** +************************macro define************************ +***********************************************************/ + +/*********************************************************** +***********************typedef define*********************** +***********************************************************/ + +/*********************************************************** +********************function declaration******************** +***********************************************************/ + +/** + * @brief Registers all the hardware peripherals (audio, button, LED) on the board. + * + * @return Returns OPERATE_RET_OK on success, or an appropriate error code on failure. + */ +OPERATE_RET board_register_hardware(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __BOARD_COM_API_H__ */ diff --git a/boards/ESP32/config/ESP32-C6.config b/boards/ESP32/config/ESP32-C6.config new file mode 100644 index 000000000..a1d6b8c84 --- /dev/null +++ b/boards/ESP32/config/ESP32-C6.config @@ -0,0 +1,2 @@ +CONFIG_BOARD_CHOICE_ESP32=y +CONFIG_BOARD_CHOICE_ESP32_C6=y \ No newline at end of file diff --git a/platform/platform_config.yaml b/platform/platform_config.yaml index 0811aba85..144bf113c 100755 --- a/platform/platform_config.yaml +++ b/platform/platform_config.yaml @@ -22,7 +22,7 @@ platforms: - name: ESP32 repo: https://github.com/tuya/TuyaOpen-esp32 branch: dev-esp32 - commit: 5c3818c370f9653b90c71d7d1b82b7949d0d9066 + commit: 35bb1fc21a63f7bb2a2ee3bba348099e191179d7 - name: LN882H repo: https://github.com/tuya/TuyaOpen-ln882h diff --git a/src/tal_bluetooth/nimble/host/tuya_ble_mbuf.c b/src/tal_bluetooth/nimble/host/tuya_ble_mbuf.c index 595c0dadb..fa355e18a 100755 --- a/src/tal_bluetooth/nimble/host/tuya_ble_mbuf.c +++ b/src/tal_bluetooth/nimble/host/tuya_ble_mbuf.c @@ -50,7 +50,7 @@ * @{ */ -STAILQ_HEAD(, os_mbuf_pool) g_msys_pool_list = +static STAILQ_HEAD(, os_mbuf_pool) g_msys_pool_list = STAILQ_HEAD_INITIALIZER(g_msys_pool_list); struct os_mbuf *os_dyna_mbuf_get(struct os_mbuf_pool *omp, uint16_t leadingspace); diff --git a/src/tal_bluetooth/nimble/host/tuya_ble_mempool.c b/src/tal_bluetooth/nimble/host/tuya_ble_mempool.c index bfae0cf91..4541a3328 100755 --- a/src/tal_bluetooth/nimble/host/tuya_ble_mempool.c +++ b/src/tal_bluetooth/nimble/host/tuya_ble_mempool.c @@ -188,7 +188,7 @@ static void os_dyna_msys_init_once(struct os_mempool *mempool, struct os_mbuf_po BLE_PANIC_ASSERT(rc == 0); } -void os_msys_init(void) +void ty_os_msys_init(void) { os_msys_reset(); @@ -208,7 +208,6 @@ void os_msys_init(void) #endif } - static stats_error_t os_mempool_init_internal(struct os_mempool *mp, uint16_t blocks, uint32_t block_size, void *membuf, char *name, uint8_t flags) diff --git a/src/tal_bluetooth/nimble/host/tuya_hs_port.c b/src/tal_bluetooth/nimble/host/tuya_hs_port.c index f2c202a5c..0da1400e4 100755 --- a/src/tal_bluetooth/nimble/host/tuya_hs_port.c +++ b/src/tal_bluetooth/nimble/host/tuya_hs_port.c @@ -30,7 +30,7 @@ static void* host_main_thread_hdl = NULL; static tuya_ble_eventq g_eventq_dflt; static int pre_init_flag = 0; -extern void os_msys_init(void); +extern void ty_os_msys_init(void); extern void os_mempool_module_init(void); void tuya_ble_host_pre_init(void *param) { @@ -41,7 +41,7 @@ void tuya_ble_host_pre_init(void *param) /* Initialize the global memory pool */ os_mempool_module_init(); - os_msys_init(); + ty_os_msys_init(); /* Initialize the host */ ble_hs_init(); }