diff --git a/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst b/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst index c4685a347b0b4..0951e242e879b 100644 --- a/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst +++ b/Documentation/platforms/risc-v/esp32c3/boards/esp32c3-generic/index.rst @@ -142,6 +142,43 @@ disables the NuttShell to get the best possible score. .. note:: As the NSH is disabled, the application will start as soon as the system is turned on. +efuse +----- + +This configuration demonstrates the use of the eFuse driver. It can be accessed +through the ``/dev/efuse`` device file. +Virtual eFuse mode can be used by enabling `CONFIG_ESPRESSIF_EFUSE_VIRTUAL` +option to prevent possible damages on chip. + +The following snippet demonstrates how to read MAC address: + +.. code-block:: C + + int fd; + int ret; + uint8_t mac[6]; + struct efuse_param_s param; + struct efuse_desc_s mac_addr = + { + .bit_offset = 1, + .bit_count = 48 + }; + + const efuse_desc_t* desc[] = + { + &mac_addr, + NULL + }; + param.field = desc; + param.size = 48; + param.data = mac; + + fd = open("/dev/efuse", O_RDONLY); + ret = ioctl(fd, EFUSEIOC_READ_FIELD, ¶m); + +To find offset and count variables for related eFuse, +please refer to Espressif's Technical Reference Manuals. + gpio ---- diff --git a/Documentation/platforms/risc-v/esp32c3/index.rst b/Documentation/platforms/risc-v/esp32c3/index.rst index 39873414813b2..f25d19a4bd639 100644 --- a/Documentation/platforms/risc-v/esp32c3/index.rst +++ b/Documentation/platforms/risc-v/esp32c3/index.rst @@ -291,7 +291,7 @@ Bluetooth No CAN/TWAI Yes CDC Console Yes Rev.3 DMA Yes -eFuse No +eFuse Yes Also virtual mode supported GPIO Yes I2C Yes LED_PWM Yes diff --git a/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitc/index.rst b/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitc/index.rst index da2233c17b1a0..05afe6720bf45 100644 --- a/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitc/index.rst +++ b/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitc/index.rst @@ -125,6 +125,43 @@ disables the NuttShell to get the best possible score. .. note:: As the NSH is disabled, the application will start as soon as the system is turned on. +efuse +----- + +This configuration demonstrates the use of the eFuse driver. It can be accessed +through the ``/dev/efuse`` device file. +Virtual eFuse mode can be used by enabling `CONFIG_ESPRESSIF_EFUSE_VIRTUAL` +option to prevent possible damages on chip. + +The following snippet demonstrates how to read MAC address: + +.. code-block:: C + + int fd; + int ret; + uint8_t mac[6]; + struct efuse_param_s param; + struct efuse_desc_s mac_addr = + { + .bit_offset = 1, + .bit_count = 48 + }; + + const efuse_desc_t* desc[] = + { + &mac_addr, + NULL + }; + param.field = desc; + param.size = 48; + param.data = mac; + + fd = open("/dev/efuse", O_RDONLY); + ret = ioctl(fd, EFUSEIOC_READ_FIELD, ¶m); + +To find offset and count variables for related eFuse, +please refer to Espressif's Technical Reference Manuals. + gpio ---- diff --git a/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitm/index.rst b/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitm/index.rst index 700991a75b3b1..e8a5f19c00272 100644 --- a/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitm/index.rst +++ b/Documentation/platforms/risc-v/esp32c6/boards/esp32c6-devkitm/index.rst @@ -109,6 +109,43 @@ disables the NuttShell to get the best possible score. .. note:: As the NSH is disabled, the application will start as soon as the system is turned on. +efuse +----- + +This configuration demonstrates the use of the eFuse driver. It can be accessed +through the ``/dev/efuse`` device file. +Virtual eFuse mode can be used by enabling `CONFIG_ESPRESSIF_EFUSE_VIRTUAL` +option to prevent possible damages on chip. + +The following snippet demonstrates how to read MAC address: + +.. code-block:: C + + int fd; + int ret; + uint8_t mac[6]; + struct efuse_param_s param; + struct efuse_desc_s mac_addr = + { + .bit_offset = 1, + .bit_count = 48 + }; + + const efuse_desc_t* desc[] = + { + &mac_addr, + NULL + }; + param.field = desc; + param.size = 48; + param.data = mac; + + fd = open("/dev/efuse", O_RDONLY); + ret = ioctl(fd, EFUSEIOC_READ_FIELD, ¶m); + +To find offset and count variables for related eFuse, +please refer to Espressif's Technical Reference Manuals. + gpio ---- diff --git a/Documentation/platforms/risc-v/esp32c6/index.rst b/Documentation/platforms/risc-v/esp32c6/index.rst index b418eb0f18b31..197be4219d6e3 100644 --- a/Documentation/platforms/risc-v/esp32c6/index.rst +++ b/Documentation/platforms/risc-v/esp32c6/index.rst @@ -278,7 +278,7 @@ Bluetooth No CAN/TWAI Yes DMA Yes ECC No -eFuse No +eFuse Yes GPIO Yes HMAC No I2C Yes diff --git a/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst b/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst index 604b87e81a239..5909c36f548c7 100644 --- a/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst +++ b/Documentation/platforms/risc-v/esp32h2/boards/esp32h2-devkit/index.rst @@ -108,6 +108,43 @@ disables the NuttShell to get the best possible score. .. note:: As the NSH is disabled, the application will start as soon as the system is turned on. +efuse +----- + +This configuration demonstrates the use of the eFuse driver. It can be accessed +through the ``/dev/efuse`` device file. +Virtual eFuse mode can be used by enabling `CONFIG_ESPRESSIF_EFUSE_VIRTUAL` +option to prevent possible damages on chip. + +The following snippet demonstrates how to read MAC address: + +.. code-block:: C + + int fd; + int ret; + uint8_t mac[6]; + struct efuse_param_s param; + struct efuse_desc_s mac_addr = + { + .bit_offset = 1, + .bit_count = 48 + }; + + const efuse_desc_t* desc[] = + { + &mac_addr, + NULL + }; + param.field = desc; + param.size = 48; + param.data = mac; + + fd = open("/dev/efuse", O_RDONLY); + ret = ioctl(fd, EFUSEIOC_READ_FIELD, ¶m); + +To find offset and count variables for related eFuse, +please refer to Espressif's Technical Reference Manuals. + gpio ---- diff --git a/Documentation/platforms/risc-v/esp32h2/index.rst b/Documentation/platforms/risc-v/esp32h2/index.rst index 137b38e679fe7..bf261e553803c 100644 --- a/Documentation/platforms/risc-v/esp32h2/index.rst +++ b/Documentation/platforms/risc-v/esp32h2/index.rst @@ -278,7 +278,7 @@ Bluetooth No CAN/TWAI Yes DMA Yes ECC No -eFuse No +eFuse Yes GPIO Yes HMAC No I2C Yes diff --git a/arch/risc-v/src/common/espressif/Kconfig b/arch/risc-v/src/common/espressif/Kconfig index 2e432d08143b0..4ced0c7982059 100644 --- a/arch/risc-v/src/common/espressif/Kconfig +++ b/arch/risc-v/src/common/espressif/Kconfig @@ -389,6 +389,19 @@ config ESPRESSIF_DMA default n select ARCH_DMA +config ESPRESSIF_EFUSE + bool "EFUSE support" + default n + ---help--- + Enable efuse support. + +config ESPRESSIF_EFUSE_VIRTUAL + bool "Virtual EFUSE support" + depends on ESPRESSIF_EFUSE + default n + ---help--- + Enable virtual efuse support to simulate eFuse operations in RAM, changes will be reverted each reboot + 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 0051b28a9d46c..93517ae2832d8 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 0000000000000..ce6b5cbfb55de --- /dev/null +++ b/arch/risc-v/src/common/espressif/esp_efuse.c @@ -0,0 +1,265 @@ +/**************************************************************************** + * 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" +#include "esp_efuse_utility.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; + } + +#ifdef CONFIG_ESPRESSIF_EFUSE_VIRTUAL + esp_efuse_utility_update_virt_blocks(); +#endif + + 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 0000000000000..396ca31975d45 --- /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 ad4f9112c9d75..3cd9cf8723cff 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 fffbc8a12a822..7859102243aff 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 358be60518e6e..0732ee0465c23 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/common/scripts/esp32c3_sections.ld b/boards/risc-v/esp32c3/common/scripts/esp32c3_sections.ld index 2def89f2f6463..0832895a3be81 100644 --- a/boards/risc-v/esp32c3/common/scripts/esp32c3_sections.ld +++ b/boards/risc-v/esp32c3/common/scripts/esp32c3_sections.ld @@ -127,6 +127,7 @@ SECTIONS *libarch.a:*esp_rom_spiflash.*(.text .text.* .literal .literal.*) *libarch.a:*esp_efuse_fields.*(.text .text.* .literal .literal.*) *libarch.a:*esp_efuse_api_key.*(.text .text.* .literal .literal.*) + *libarch.a:*esp_efuse_utility.*(.text .text.* .literal .literal.*) *libarch.a:*efuse_hal.*(.text .text.* .literal .literal.*) *libarch.a:*log.*(.text .text.* .literal .literal.*) *libarch.a:*log_noos.*(.text .text.* .literal .literal.*) @@ -246,6 +247,7 @@ SECTIONS *libarch.a:*esp_rom_spiflash.*(.rodata .rodata.*) *libarch.a:*esp_efuse_fields.*(.rodata .rodata.*) *libarch.a:*esp_efuse_api_key.*(.rodata .rodata.*) + *libarch.a:*esp_efuse_utility.*(.rodata .rodata.*) *libarch.a:*efuse_hal.*(.rodata .rodata.*) *libarch.a:*log.*(.rodata .rodata.*) *libarch.a:*log_noos.*(.rodata .rodata.*) 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 0000000000000..eed3ded991cba --- /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 a7eb27444c658..1f6edcd855c41 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/common/scripts/esp32c6_sections.ld b/boards/risc-v/esp32c6/common/scripts/esp32c6_sections.ld index 304d975dc19de..9114aa39c511e 100644 --- a/boards/risc-v/esp32c6/common/scripts/esp32c6_sections.ld +++ b/boards/risc-v/esp32c6/common/scripts/esp32c6_sections.ld @@ -134,6 +134,7 @@ SECTIONS *libarch.a:*esp_rom_spiflash.*(.text .text.* .literal .literal.*) *libarch.a:*esp_efuse_fields.*(.text .text.* .literal .literal.*) *libarch.a:*esp_efuse_api_key.*(.text .text.* .literal .literal.*) + *libarch.a:*esp_efuse_utility.*(.text .text.* .literal .literal.*) *libarch.a:*efuse_hal.*(.text .text.* .literal .literal.*) *libarch.a:*log.*(.text .text.* .literal .literal.*) *libarch.a:*log_noos.*(.text .text.* .literal .literal.*) @@ -277,6 +278,7 @@ SECTIONS *libarch.a:*esp_rom_spiflash.*(.rodata .rodata.*) *libarch.a:*esp_efuse_fields.*(.rodata .rodata.*) *libarch.a:*esp_efuse_api_key.*(.rodata .rodata.*) + *libarch.a:*esp_efuse_utility.*(.rodata .rodata.*) *libarch.a:*efuse_hal.*(.rodata .rodata.*) *libarch.a:*log.*(.rodata .rodata.*) *libarch.a:*log_noos.*(.rodata .rodata.*) 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 0000000000000..6210930b2dcb0 --- /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 56020f210f3e9..dd70866ed84d2 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 0000000000000..c24afe7a53032 --- /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 e66ad98d8b039..7e6dc2dfffb52 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/common/scripts/esp32h2_sections.ld b/boards/risc-v/esp32h2/common/scripts/esp32h2_sections.ld index 90a337aeeccb9..e6af8045f76ec 100644 --- a/boards/risc-v/esp32h2/common/scripts/esp32h2_sections.ld +++ b/boards/risc-v/esp32h2/common/scripts/esp32h2_sections.ld @@ -136,6 +136,7 @@ SECTIONS *libarch.a:*esp_rom_spiflash.*(.text .text.* .literal .literal.*) *libarch.a:*esp_efuse_fields.*(.text .text.* .literal .literal.*) *libarch.a:*esp_efuse_api_key.*(.text .text.* .literal .literal.*) + *libarch.a:*esp_efuse_utility.*(.text .text.* .literal .literal.*) *libarch.a:*efuse_hal.*(.text .text.* .literal .literal.*) *libarch.a:*log.*(.text .text.* .literal .literal.*) *libarch.a:*log_noos.*(.text .text.* .literal .literal.*) @@ -274,6 +275,7 @@ SECTIONS *libarch.a:*esp_rom_spiflash.*(.rodata .rodata.*) *libarch.a:*esp_efuse_fields.*(.rodata .rodata.*) *libarch.a:*esp_efuse_api_key.*(.rodata .rodata.*) + *libarch.a:*esp_efuse_utility.*(.rodata .rodata.*) *libarch.a:*efuse_hal.*(.rodata .rodata.*) *libarch.a:*log.*(.rodata .rodata.*) *libarch.a:*log_noos.*(.rodata .rodata.*) 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 0000000000000..33f43d6ab8a57 --- /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 4080618618d53..41b3b93cb4a7e 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)