From 970d1a1f7c759ef4c03a3e732b5061cef4e321a0 Mon Sep 17 00:00:00 2001 From: Eren Terzioglu Date: Thu, 28 Nov 2024 14:15:12 +0100 Subject: [PATCH] esp32[c3|c6|h2]: Add efuse support --- arch/risc-v/src/common/espressif/Kconfig | 6 + arch/risc-v/src/common/espressif/Make.defs | 6 +- arch/risc-v/src/common/espressif/esp_efuse.c | 260 ++++++++++++++++++ arch/risc-v/src/common/espressif/esp_efuse.h | 71 +++++ arch/xtensa/src/esp32/Make.defs | 2 +- arch/xtensa/src/esp32s2/Make.defs | 2 +- arch/xtensa/src/esp32s3/Make.defs | 2 +- .../esp32c3-generic/configs/efuse/defconfig | 48 ++++ .../esp32c3-generic/src/esp32c3_bringup.c | 12 + .../esp32c6-devkitc/configs/efuse/defconfig | 50 ++++ .../esp32c6-devkitc/src/esp32c6_bringup.c | 12 + .../esp32c6-devkitm/configs/efuse/defconfig | 50 ++++ .../esp32c6-devkitm/src/esp32c6_bringup.c | 12 + .../esp32h2-devkit/configs/efuse/defconfig | 49 ++++ .../esp32h2-devkit/src/esp32h2_bringup.c | 12 + 15 files changed, 590 insertions(+), 4 deletions(-) create mode 100644 arch/risc-v/src/common/espressif/esp_efuse.c create mode 100644 arch/risc-v/src/common/espressif/esp_efuse.h create mode 100644 boards/risc-v/esp32c3/esp32c3-generic/configs/efuse/defconfig create mode 100644 boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig create mode 100644 boards/risc-v/esp32c6/esp32c6-devkitm/configs/efuse/defconfig create mode 100644 boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig diff --git a/arch/risc-v/src/common/espressif/Kconfig b/arch/risc-v/src/common/espressif/Kconfig index 2e432d08143..264cb088cd8 100644 --- a/arch/risc-v/src/common/espressif/Kconfig +++ b/arch/risc-v/src/common/espressif/Kconfig @@ -389,6 +389,12 @@ config ESPRESSIF_DMA default n select ARCH_DMA +config ESPRESSIF_EFUSE + bool "EFUSE support" + default n + ---help--- + Enable efuse support. + config ESPRESSIF_HR_TIMER bool default RTC_DRIVER diff --git a/arch/risc-v/src/common/espressif/Make.defs b/arch/risc-v/src/common/espressif/Make.defs index 0051b28a9d4..93517ae2832 100644 --- a/arch/risc-v/src/common/espressif/Make.defs +++ b/arch/risc-v/src/common/espressif/Make.defs @@ -73,6 +73,10 @@ ifeq ($(CONFIG_ESPRESSIF_DMA),y) CHIP_CSRCS += esp_dma.c endif +ifeq ($(CONFIG_ESPRESSIF_EFUSE),y) + CHIP_CSRCS += esp_efuse.c +endif + ifeq ($(CONFIG_ESPRESSIF_TWAI),y) CHIP_CSRCS += esp_twai.c endif @@ -152,7 +156,7 @@ endif ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty ifndef ESP_HAL_3RDPARTY_VERSION - ESP_HAL_3RDPARTY_VERSION = e3899a2324c8e326db20f99f208e890fdd7a5b92 + ESP_HAL_3RDPARTY_VERSION = 87ccbf88b6fd490dae1993524e70f51bb2ea181d endif ifndef ESP_HAL_3RDPARTY_URL diff --git a/arch/risc-v/src/common/espressif/esp_efuse.c b/arch/risc-v/src/common/espressif/esp_efuse.c new file mode 100644 index 00000000000..be846f8dab4 --- /dev/null +++ b/arch/risc-v/src/common/espressif/esp_efuse.c @@ -0,0 +1,260 @@ +/**************************************************************************** + * arch/risc-v/src/common/espressif/esp_efuse.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "chip.h" + +#include "riscv_internal.h" +#include "espressif/esp_efuse.h" + +#include "esp_efuse.h" +#include "esp_clk.h" +#include "hal/efuse_hal.h" +#include "esp_efuse_table.h" +#include "esp_efuse_chip.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct esp_efuse_lowerhalf_s +{ + const struct efuse_ops_s *ops; /* Lower half operations */ + void *upper; /* Pointer to efuse_upperhalf_s */ +}; + +/**************************************************************************** + * Private Functions Prototypes + ****************************************************************************/ + +/* "Lower half" driver methods */ + +static int esp_efuse_lowerhalf_read(struct efuse_lowerhalf_s *lower, + const efuse_desc_t *field[], + uint8_t *data, size_t bits_len); +static int esp_efuse_lowerhalf_write(struct efuse_lowerhalf_s *lower, + const efuse_desc_t *field[], + const uint8_t *data, + size_t bits_len); +static int esp_efuse_lowerhalf_ioctl(struct efuse_lowerhalf_s *lower, + int cmd, unsigned long arg); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* "Lower half" driver methods */ + +static const struct efuse_ops_s g_esp_efuse_ops = +{ + .read_field = esp_efuse_lowerhalf_read, + .write_field = esp_efuse_lowerhalf_write, + .ioctl = esp_efuse_lowerhalf_ioctl, +}; + +/* EFUSE lower-half */ + +static struct esp_efuse_lowerhalf_s g_esp_efuse_lowerhalf = +{ + .ops = &g_esp_efuse_ops, + .upper = NULL, +}; + +/**************************************************************************** + * Private functions + ****************************************************************************/ + +/**************************************************************************** + * Name: esp_efuse_lowerhalf_read + * + * Description: + * Read value from EFUSE, writing it into an array. + * + * Input Parameters: + * lower - A pointer the publicly visible representation of + * the "lower-half" driver state structure + * field - A pointer to describing the fields of efuse + * dst - A pointer to array that contains the data for reading + * bits_len - The number of bits required to read + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise -1 (ERROR). + * + ****************************************************************************/ + +static int esp_efuse_lowerhalf_read(struct efuse_lowerhalf_s *lower, + const efuse_desc_t *field[], + uint8_t *data, size_t bits_len) +{ + int ret = OK; + + /* Read the requested field */ + + ret = esp_efuse_read_field_blob((const esp_efuse_desc_t**)field, + data, + bits_len); + + return ret; +} + +/**************************************************************************** + * Name: esp_efuse_lowerhalf_write + * + * Description: + * Write array to EFUSE. + * + * Input Parameters: + * lower - A pointer the publicly visible representation of + * the "lower-half" driver state structure + * field - A pointer to describing the fields of efuse + * data - A pointer to array that contains the data for writing + * bits_len - The number of bits required to write + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise -1 (ERROR). + * + ****************************************************************************/ + +static int esp_efuse_lowerhalf_write(struct efuse_lowerhalf_s *lower, + const efuse_desc_t *field[], + const uint8_t *data, + size_t bits_len) +{ + irqstate_t flags; + int ret = OK; + + flags = enter_critical_section(); + + ret = esp_efuse_write_field_blob((const esp_efuse_desc_t**)field, + data, + bits_len); + + leave_critical_section(flags); + + if (ret != OK) + { + return ERROR; + } + + return ret; +} + +/**************************************************************************** + * Name: esp_efuse_lowerhalf_ioctl + * + * Description: + * Initialize the efuse driver. The efuse is initialized + * and registered as 'devpath'. + * + * Input Parameters: + * lower - A pointer the publicly visible representation of + * the "lower-half" driver state structure + * cmd - The ioctl command value + * arg - The optional argument that accompanies the 'cmd' + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise -1 (ERROR). + * + ****************************************************************************/ + +static int esp_efuse_lowerhalf_ioctl(struct efuse_lowerhalf_s *lower, + int cmd, unsigned long arg) +{ + int ret = OK; + + switch (cmd) + { + /* We don't have proprietary EFUSE ioctls */ + + default: + { + minfo("Unrecognized cmd: %d\n", cmd); + ret = -ENOTTY; + } + break; + } + + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: esp_efuse_initialize + * + * Description: + * Initialize the efuse driver. The efuse is initialized + * and registered as 'devpath'. + * + * Input Parameters: + * devpath - The full path to the efuse device. + * This should be of the form /dev/efuse + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise -1 (ERROR). + * + ****************************************************************************/ + +int esp_efuse_initialize(const char *devpath) +{ + struct esp_efuse_lowerhalf_s *lower = NULL; + int ret = OK; + + DEBUGASSERT(devpath != NULL); + + lower = &g_esp_efuse_lowerhalf; + + /* Register the efuse upper driver */ + + lower->upper = efuse_register(devpath, + (struct efuse_lowerhalf_s *)lower); + + if (lower->upper == NULL) + { + /* The actual cause of the failure may have been a failure to allocate + * perhaps a failure to register the efuse driver (such as if the + * 'devpath' were not unique). We know here but we return EEXIST to + * indicate the failure (implying the non-unique devpath). + */ + + ret = -EEXIST; + } + + return ret; +} diff --git a/arch/risc-v/src/common/espressif/esp_efuse.h b/arch/risc-v/src/common/espressif/esp_efuse.h new file mode 100644 index 00000000000..396ca31975d --- /dev/null +++ b/arch/risc-v/src/common/espressif/esp_efuse.h @@ -0,0 +1,71 @@ +/**************************************************************************** + * arch/risc-v/src/common/espressif/esp_efuse.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +#ifndef __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_EFUSE_H +#define __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_EFUSE_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Functions Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: esp_efuse_initialize + * + * Description: + * Initialize the efuse driver. The efuse is initialized + * and registered as 'devpath'. + * + * Input Parameters: + * devpath - The full path to the efuse device. + * This should be of the form /dev/efuse + * + * Returned Value: + * Zero (OK) is returned on success. Otherwise -1 (ERROR). + * + ****************************************************************************/ + +int esp_efuse_initialize(const char *devpath); + +#ifdef __cplusplus +} +#endif +#undef EXTERN + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_RISCV_SRC_COMMON_ESPRESSIF_ESP_EFUSE_H */ diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs index ad4f9112c9d..3cd9cf8723c 100644 --- a/arch/xtensa/src/esp32/Make.defs +++ b/arch/xtensa/src/esp32/Make.defs @@ -218,7 +218,7 @@ endif ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty ifndef ESP_HAL_3RDPARTY_VERSION - ESP_HAL_3RDPARTY_VERSION = e3899a2324c8e326db20f99f208e890fdd7a5b92 + ESP_HAL_3RDPARTY_VERSION = 87ccbf88b6fd490dae1993524e70f51bb2ea181d endif ifndef ESP_HAL_3RDPARTY_URL diff --git a/arch/xtensa/src/esp32s2/Make.defs b/arch/xtensa/src/esp32s2/Make.defs index fffbc8a12a8..7859102243a 100644 --- a/arch/xtensa/src/esp32s2/Make.defs +++ b/arch/xtensa/src/esp32s2/Make.defs @@ -147,7 +147,7 @@ endif ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty ifndef ESP_HAL_3RDPARTY_VERSION - ESP_HAL_3RDPARTY_VERSION = e3899a2324c8e326db20f99f208e890fdd7a5b92 + ESP_HAL_3RDPARTY_VERSION = 87ccbf88b6fd490dae1993524e70f51bb2ea181d endif ifndef ESP_HAL_3RDPARTY_URL diff --git a/arch/xtensa/src/esp32s3/Make.defs b/arch/xtensa/src/esp32s3/Make.defs index 358be60518e..0732ee0465c 100644 --- a/arch/xtensa/src/esp32s3/Make.defs +++ b/arch/xtensa/src/esp32s3/Make.defs @@ -220,7 +220,7 @@ endif ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty ifndef ESP_HAL_3RDPARTY_VERSION - ESP_HAL_3RDPARTY_VERSION = e3899a2324c8e326db20f99f208e890fdd7a5b92 + ESP_HAL_3RDPARTY_VERSION = 87ccbf88b6fd490dae1993524e70f51bb2ea181d endif ifndef ESP_HAL_3RDPARTY_URL diff --git a/boards/risc-v/esp32c3/esp32c3-generic/configs/efuse/defconfig b/boards/risc-v/esp32c3/esp32c3-generic/configs/efuse/defconfig new file mode 100644 index 00000000000..eed3ded991c --- /dev/null +++ b/boards/risc-v/esp32c3/esp32c3-generic/configs/efuse/defconfig @@ -0,0 +1,48 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="risc-v" +CONFIG_ARCH_BOARD="esp32c3-generic" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32C3_GENERIC=y +CONFIG_ARCH_CHIP="esp32c3" +CONFIG_ARCH_CHIP_ESP32C3_GENERIC=y +CONFIG_ARCH_INTERRUPTSTACK=1536 +CONFIG_ARCH_RISCV=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_RESET=y +CONFIG_BOARD_LOOPSPERMSEC=15000 +CONFIG_BUILTIN=y +CONFIG_DEV_ZERO=y +CONFIG_EFUSE=y +CONFIG_ESPRESSIF_EFUSE=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_PERROR_STDOUT=y +CONFIG_LIBC_STRERROR=y +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_NSH_STRERROR=y +CONFIG_PREALLOC_TIMERS=0 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_BACKTRACE=y +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=29 +CONFIG_START_MONTH=11 +CONFIG_START_YEAR=2019 +CONFIG_SYSTEM_DUMPSTACK=y +CONFIG_SYSTEM_NSH=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/risc-v/esp32c3/esp32c3-generic/src/esp32c3_bringup.c b/boards/risc-v/esp32c3/esp32c3-generic/src/esp32c3_bringup.c index a7eb27444c6..1f6edcd855c 100644 --- a/boards/risc-v/esp32c3/esp32c3-generic/src/esp32c3_bringup.c +++ b/boards/risc-v/esp32c3/esp32c3-generic/src/esp32c3_bringup.c @@ -65,6 +65,10 @@ # include #endif +#ifdef CONFIG_ESPRESSIF_EFUSE +# include "espressif/esp_efuse.h" +#endif + #ifdef CONFIG_ESP_RMT # include "esp_board_rmt.h" #endif @@ -157,6 +161,14 @@ int esp_bringup(void) } #endif +#if defined(CONFIG_ESPRESSIF_EFUSE) + ret = esp_efuse_initialize("/dev/efuse"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %d\n", ret); + } +#endif + #ifdef CONFIG_ESPRESSIF_MWDT0 ret = esp_wdt_initialize("/dev/watchdog0", ESP_WDT_MWDT0); if (ret < 0) diff --git a/boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig b/boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig new file mode 100644 index 00000000000..6210930b2dc --- /dev/null +++ b/boards/risc-v/esp32c6/esp32c6-devkitc/configs/efuse/defconfig @@ -0,0 +1,50 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="risc-v" +CONFIG_ARCH_BOARD="esp32c6-devkitc" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32C6_DEVKITC=y +CONFIG_ARCH_CHIP="esp32c6" +CONFIG_ARCH_CHIP_ESP32C6=y +CONFIG_ARCH_CHIP_ESP32C6WROOM1=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_RISCV=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_RESET=y +CONFIG_BOARD_LOOPSPERMSEC=15000 +CONFIG_BUILTIN=y +CONFIG_DEV_ZERO=y +CONFIG_EFUSE=y +CONFIG_ESPRESSIF_EFUSE=y +CONFIG_ESPRESSIF_ESP32C6=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_PERROR_STDOUT=y +CONFIG_LIBC_STRERROR=y +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_NSH_STRERROR=y +CONFIG_PREALLOC_TIMERS=0 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_BACKTRACE=y +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=29 +CONFIG_START_MONTH=11 +CONFIG_START_YEAR=2019 +CONFIG_SYSTEM_DUMPSTACK=y +CONFIG_SYSTEM_NSH=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c b/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c index 56020f210f3..dd70866ed84 100644 --- a/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c +++ b/boards/risc-v/esp32c6/esp32c6-devkitc/src/esp32c6_bringup.c @@ -65,6 +65,10 @@ # include #endif +#ifdef CONFIG_ESPRESSIF_EFUSE +# include "espressif/esp_efuse.h" +#endif + #ifdef CONFIG_ESP_RMT # include "esp_board_rmt.h" #endif @@ -161,6 +165,14 @@ int esp_bringup(void) } #endif +#if defined(CONFIG_ESPRESSIF_EFUSE) + ret = esp_efuse_initialize("/dev/efuse"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %d\n", ret); + } +#endif + #ifdef CONFIG_ESPRESSIF_MWDT0 ret = esp_wdt_initialize("/dev/watchdog0", ESP_WDT_MWDT0); if (ret < 0) diff --git a/boards/risc-v/esp32c6/esp32c6-devkitm/configs/efuse/defconfig b/boards/risc-v/esp32c6/esp32c6-devkitm/configs/efuse/defconfig new file mode 100644 index 00000000000..c24afe7a530 --- /dev/null +++ b/boards/risc-v/esp32c6/esp32c6-devkitm/configs/efuse/defconfig @@ -0,0 +1,50 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="risc-v" +CONFIG_ARCH_BOARD="esp32c6-devkitm" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32C6_DEVKITM=y +CONFIG_ARCH_CHIP="esp32c6" +CONFIG_ARCH_CHIP_ESP32C6=y +CONFIG_ARCH_CHIP_ESP32C6MINI1=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_RISCV=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_RESET=y +CONFIG_BOARD_LOOPSPERMSEC=15000 +CONFIG_BUILTIN=y +CONFIG_DEV_ZERO=y +CONFIG_EFUSE=y +CONFIG_ESPRESSIF_EFUSE=y +CONFIG_ESPRESSIF_ESP32C6=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_PERROR_STDOUT=y +CONFIG_LIBC_STRERROR=y +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_NSH_STRERROR=y +CONFIG_PREALLOC_TIMERS=0 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_BACKTRACE=y +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=29 +CONFIG_START_MONTH=11 +CONFIG_START_YEAR=2019 +CONFIG_SYSTEM_DUMPSTACK=y +CONFIG_SYSTEM_NSH=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c b/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c index e66ad98d8b0..7e6dc2dfffb 100644 --- a/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c +++ b/boards/risc-v/esp32c6/esp32c6-devkitm/src/esp32c6_bringup.c @@ -65,6 +65,10 @@ # include #endif +#ifdef CONFIG_ESPRESSIF_EFUSE +# include "espressif/esp_efuse.h" +#endif + #ifdef CONFIG_ESP_RMT # include "esp_board_rmt.h" #endif @@ -157,6 +161,14 @@ int esp_bringup(void) } #endif +#if defined(CONFIG_ESPRESSIF_EFUSE) + ret = esp_efuse_initialize("/dev/efuse"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %d\n", ret); + } +#endif + #ifdef CONFIG_ESPRESSIF_MWDT0 ret = esp_wdt_initialize("/dev/watchdog0", ESP_WDT_MWDT0); if (ret < 0) diff --git a/boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig b/boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig new file mode 100644 index 00000000000..33f43d6ab8a --- /dev/null +++ b/boards/risc-v/esp32h2/esp32h2-devkit/configs/efuse/defconfig @@ -0,0 +1,49 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="risc-v" +CONFIG_ARCH_BOARD="esp32h2-devkit" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32H2_DEVKIT=y +CONFIG_ARCH_CHIP="esp32h2" +CONFIG_ARCH_CHIP_ESP32H2=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_RISCV=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_RESET=y +CONFIG_BOARD_LOOPSPERMSEC=15000 +CONFIG_BUILTIN=y +CONFIG_DEV_ZERO=y +CONFIG_EFUSE=y +CONFIG_ESPRESSIF_EFUSE=y +CONFIG_ESPRESSIF_ESP32H2=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_PERROR_STDOUT=y +CONFIG_LIBC_STRERROR=y +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_NSH_STRERROR=y +CONFIG_PREALLOC_TIMERS=0 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_BACKTRACE=y +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=29 +CONFIG_START_MONTH=11 +CONFIG_START_YEAR=2019 +CONFIG_SYSTEM_DUMPSTACK=y +CONFIG_SYSTEM_NSH=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c b/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c index 4080618618d..41b3b93cb4a 100644 --- a/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c +++ b/boards/risc-v/esp32h2/esp32h2-devkit/src/esp32h2_bringup.c @@ -65,6 +65,10 @@ # include #endif +#ifdef CONFIG_ESPRESSIF_EFUSE +# include "espressif/esp_efuse.h" +#endif + #ifdef CONFIG_ESP_RMT # include "esp_board_rmt.h" #endif @@ -149,6 +153,14 @@ int esp_bringup(void) } #endif +#if defined(CONFIG_ESPRESSIF_EFUSE) + ret = esp_efuse_initialize("/dev/efuse"); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to init EFUSE: %d\n", ret); + } +#endif + #ifdef CONFIG_ESPRESSIF_MWDT0 ret = esp_wdt_initialize("/dev/watchdog0", ESP_WDT_MWDT0); if (ret < 0)