Merge branch 'feature/h2_wdt' into 'master'

wdt: add support for H2

Closes IDF-6643 and IDF-6678

See merge request espressif/esp-idf!22422
This commit is contained in:
Marius Vikhammer
2023-02-24 13:48:20 +08:00
24 changed files with 139 additions and 83 deletions
+10 -1
View File
@@ -119,11 +119,16 @@ if(BOOTLOADER_BUILD)
rom_linker_script("newlib")
# The linking of the bootloader needs to use the rom_i2c_writeReg_Mask in esp32c6.rom.phy.ld
rom_linker_script("phy")
rom_linker_script("wdt")
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
rom_linker_script("version")
elseif(target STREQUAL "esp32h2")
rom_linker_script("newlib")
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
endif()
else() # Regular app build
@@ -261,6 +266,10 @@ else() # Regular app build
rom_linker_script("spiflash")
endif()
if(CONFIG_HAL_WDT_USE_ROM_IMPL)
rom_linker_script("wdt")
endif()
if(CONFIG_NEWLIB_NANO_FORMAT)
# nano formatting functions in ROM are also built for 64-bit time_t.
rom_linker_script("newlib-nano")
@@ -66,3 +66,7 @@ config ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT
config ESP_ROM_REV0_HAS_NO_ECDSA_INTERFACE
bool
default y
config ESP_ROM_WDT_INIT_PATCH
bool
default y
@@ -22,3 +22,4 @@
#define ESP_ROM_HAS_REGI2C_BUG (1) // ROM has the regi2c bug
#define ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT (1) // ROM has the newlib normal/full version of formatting functions (as opposed to the nano versions)
#define ESP_ROM_REV0_HAS_NO_ECDSA_INTERFACE (1) // ECO 0 does not have ets_ecdsa_verify symbol, future revision will have it
#define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock
@@ -54,3 +54,7 @@ config ESP_ROM_WITHOUT_REGI2C
config ESP_ROM_HAS_NEWLIB_NANO_FORMAT
bool
default y
config ESP_ROM_WDT_INIT_PATCH
bool
default y
@@ -19,3 +19,4 @@
#define ESP_ROM_HAS_SPI_FLASH (1) // ROM has the implementation of SPI Flash driver
#define ESP_ROM_WITHOUT_REGI2C (1) // ROM has no regi2c APIs
#define ESP_ROM_HAS_NEWLIB_NANO_FORMAT (1) // ROM has the newlib nano versions of formatting functions
#define ESP_ROM_WDT_INIT_PATCH (1) // ROM version does not configure the clock
+1 -19
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -160,24 +160,6 @@ g_flash_guard_ops = 0x4084fff4;
/* Note: esp_rom_spiflash_write_disable was moved from esp32c6.rom.spiflash.ld */
esp_rom_spiflash_write_disable = 0x40000270;
/***************************************
Group hal_wdt
***************************************/
/* Functions */
wdt_hal_init = 0x4000038c;
wdt_hal_deinit = 0x40000390;
wdt_hal_config_stage = 0x40000394;
wdt_hal_write_protect_disable = 0x40000398;
wdt_hal_write_protect_enable = 0x4000039c;
wdt_hal_enable = 0x400003a0;
wdt_hal_disable = 0x400003a4;
wdt_hal_handle_intr = 0x400003a8;
wdt_hal_feed = 0x400003ac;
wdt_hal_set_flashboot_en = 0x400003b0;
wdt_hal_is_enabled = 0x400003b4;
/***************************************
Group hal_systimer
***************************************/
@@ -0,0 +1,26 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/***************************************
Group hal_wdt
***************************************/
/* Functions */
/* Patch init function to set clock source
wdt_hal_init = 0x4000038c;
wdt_hal_deinit = 0x40000390;
*/
/* Functions */
wdt_hal_config_stage = 0x40000394;
wdt_hal_write_protect_disable = 0x40000398;
wdt_hal_write_protect_enable = 0x4000039c;
wdt_hal_enable = 0x400003a0;
wdt_hal_disable = 0x400003a4;
wdt_hal_handle_intr = 0x400003a8;
wdt_hal_feed = 0x400003ac;
wdt_hal_set_flashboot_en = 0x400003b0;
wdt_hal_is_enabled = 0x400003b4;
+4 -2
View File
@@ -7,13 +7,15 @@
#include "sdkconfig.h"
#include <stddef.h>
#include "esp_rom_caps.h"
#include "hal/wdt_types.h"
#include "hal/wdt_hal.h"
#include "hal/mwdt_ll.h"
#if CONFIG_HAL_WDT_USE_ROM_IMPL
#if CONFIG_IDF_TARGET_ESP32C6
#if ESP_ROM_WDT_INIT_PATCH
void wdt_hal_init(wdt_hal_context_t *hal, wdt_inst_t wdt_inst, uint32_t prescaler, bool enable_intr)
{
//Initialize HAL context
@@ -116,6 +118,6 @@ void wdt_hal_deinit(wdt_hal_context_t *hal)
//Deinit HAL context
hal->mwdt_dev = NULL;
}
#endif // CONFIG_IDF_TARGET_ESP32C6
#endif // ESP_ROM_WDT_INIT_PATCH
#endif // CONFIG_HAL_WDT_USE_ROM_IMPL