Skip to content

Commit 8f30421

Browse files
author
Raffael Rostagno
committed
hal: esp32h2: Fix HAL files for initial support
Fix HAL files for initial ESP32-H2 support. Signed-off-by: Raffael Rostagno <[email protected]>
1 parent 7a169f1 commit 8f30421

File tree

18 files changed

+66
-36
lines changed

18 files changed

+66
-36
lines changed

components/driver/gpio/include/driver/rtc_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num);
2828

2929
#define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num)
3030

31-
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
31+
#if SOC_RTCIO_PIN_COUNT > 0
3232
/**
3333
* @brief Get RTC IO index number by gpio number.
3434
*

components/esp_hw_support/port/esp32h2/cpu_region_protect.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ void esp_cpu_configure_region_protection(void)
127127
_Static_assert(SOC_IROM_MASK_LOW < SOC_IROM_MASK_HIGH, "Invalid I/D-ROM region");
128128

129129
if (esp_cpu_dbgr_is_attached()) {
130-
// Anti-FI check that cpu is really in ocd mode
131-
ESP_FAULT_ASSERT(esp_cpu_dbgr_is_attached());
132-
133130
// 5. IRAM and DRAM
134131
PMP_ENTRY_SET(5, SOC_IRAM_LOW, NONE);
135132
PMP_ENTRY_SET(6, SOC_IRAM_HIGH, PMP_TOR | RWX);

components/esp_hw_support/port/esp32h2/esp_cpu_intr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
void esp_cpu_intr_get_desc(int core_id, int intr_num, esp_cpu_intr_desc_t *intr_desc_ret)
1111
{
1212
/* On the ESP32-H2, interrupt:
13+
* - 0 is unavailable according to TRM
1314
* - 1 is for Wi-Fi
1415
* - 6 for "permanently disabled interrupt"
1516
*
1617
* Interrupts 3, 4 and 7 are unavailable for PULP CPU as they are bound to Core-Local Interrupts (CLINT)
1718
*/
1819
// [TODO: IDF-2465]
19-
const uint32_t rsvd_mask = BIT(1) | BIT(3) | BIT(4) | BIT(6) | BIT(7);
20+
const uint32_t rsvd_mask = BIT(0) | BIT(1) | BIT(3) | BIT(4) | BIT(6) | BIT(7);
2021

2122
intr_desc_ret->priority = 1;
2223
intr_desc_ret->type = ESP_CPU_INTR_TYPE_NA;

components/esp_hw_support/port/esp32h2/rtc_clk.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,14 @@ soc_rtc_fast_clk_src_t rtc_clk_fast_src_get(void)
159159

160160
static void rtc_clk_bbpll_disable(void)
161161
{
162+
#if defined(CLK_BBPLL_DISABLE)
163+
/* Disabling BBPLL is commented due to issues when transitioning
164+
* from PLL to XTAL clock sources. Comprehensive clock management
165+
* must be implemented for peripherals as well (ZEP-827).
166+
*/
162167
clk_ll_bbpll_disable();
163168
s_cur_pll_freq = 0;
169+
#endif
164170
}
165171

166172
static void rtc_clk_bbpll_enable(void)

components/esp_rom/esp32h2/ld/esp32h2.rom.newlib.ld

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ memrchr = 0x40000518;
5353
strcasecmp = 0x4000051c;
5454
strcasestr = 0x40000520;
5555
strcat = 0x40000524;
56-
strdup = 0x40000528;
56+
PROVIDE ( strdup = 0x40000528 );
5757
strchr = 0x4000052c;
5858
strcspn = 0x40000530;
5959
strcoll = 0x40000534;
@@ -62,7 +62,7 @@ strlcpy = 0x4000053c;
6262
strlwr = 0x40000540;
6363
strncasecmp = 0x40000544;
6464
strncat = 0x40000548;
65-
strndup = 0x4000054c;
65+
PROVIDE ( strndup = 0x4000054c );
6666
strnlen = 0x40000550;
6767
strrchr = 0x40000554;
6868
strsep = 0x40000558;
@@ -76,22 +76,22 @@ div = 0x40000574;
7676
labs = 0x40000578;
7777
ldiv = 0x4000057c;
7878
qsort = 0x40000580;
79-
rand_r = 0x40000584;
80-
rand = 0x40000588;
81-
srand = 0x4000058c;
79+
PROVIDE ( rand_r = 0x40000584 );
80+
PROVIDE ( rand = 0x40000588 );
81+
PROVIDE ( srand = 0x4000058c );
8282
utoa = 0x40000590;
8383
itoa = 0x40000594;
84-
atoi = 0x40000598;
85-
atol = 0x4000059c;
86-
strtol = 0x400005a0;
87-
strtoul = 0x400005a4;
88-
fflush = 0x400005a8;
89-
_fflush_r = 0x400005ac;
90-
_fwalk = 0x400005b0;
91-
_fwalk_reent = 0x400005b4;
84+
PROVIDE ( atoi = 0x40000598 );
85+
PROVIDE ( atol = 0x4000059c );
86+
PROVIDE ( strtol = 0x400005a0 );
87+
PROVIDE ( strtoul = 0x400005a4 );
88+
PROVIDE ( fflush = 0x400005a8 );
89+
PROVIDE ( _fflush_r = 0x400005ac );
90+
PROVIDE ( _fwalk = 0x400005b0 );
91+
PROVIDE ( _fwalk_reent = 0x400005b4 );
9292
__smakebuf_r = 0x400005b8;
9393
__swhatbuf_r = 0x400005bc;
94-
__swbuf_r = 0x400005c0;
94+
PROVIDE ( __swbuf_r = 0x400005c0 );
9595
__swbuf = 0x400005c4;
9696
__swsetup_r = 0x400005c8;
9797
/* Data (.data, .bss, .rodata) */

components/esp_rom/include/esp32h2/rom/rtc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <stdbool.h>
1010
#include <stdint.h>
11+
#include <stddef.h>
1112

1213
#include "soc/soc.h"
1314
#include "soc/lp_aon_reg.h"

components/esp_rom/include/esp32h2/rom/uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ typedef enum {
114114
} UartFlowCtrl;
115115

116116
typedef enum {
117-
EMPTY,
117+
EMPTY_,
118118
UNDER_WRITE,
119119
WRITE_OVER
120120
} RcvMsgBuffState;

components/esp_system/port/soc/esp32h2/clk.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <stdint.h>
88
#include <sys/cdefs.h>
9-
#include <sys/time.h>
109
#include <sys/param.h>
1110
#include "sdkconfig.h"
1211
#include "esp_attr.h"
@@ -35,8 +34,6 @@
3534
*/
3635
#define SLOW_CLK_CAL_CYCLES CONFIG_RTC_CLK_CAL_CYCLES
3736

38-
#define MHZ (1000000)
39-
4037
static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src);
4138
static __attribute__((unused)) void recalib_bbpll(void);
4239

components/esp_system/port/soc/esp32h2/reset_reason.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static esp_reset_reason_t get_reset_reason(soc_reset_reason_t rtc_reset_reason,
6868
}
6969
}
7070

71-
static void esp_reset_reason_init(void)
71+
void esp_reset_reason_init(void)
7272
{
7373
esp_reset_reason_t hint = esp_reset_reason_get_hint();
7474
s_reset_reason = get_reset_reason(esp_rom_get_reset_reason(PRO_CPU_NUM), hint);

components/hal/esp32h2/include/hal/clk_tree_ll.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
extern "C" {
2626
#endif
2727

28+
#if !defined(DT_DRV_COMPAT)
29+
#undef MHZ
2830
#define MHZ (1000000)
31+
#endif
2932

3033
#define CLK_LL_PLL_8M_FREQ_MHZ (8)
3134
#define CLK_LL_PLL_48M_FREQ_MHZ (48)

0 commit comments

Comments
 (0)