Skip to content

Commit 5cf9278

Browse files
committed
Merge branch 'feature/esp32h21_rom_sup' into 'master'
feat(core): bringup rom/newlib for esp32h21 Closes IDF-11555 and IDF-11558 See merge request espressif/esp-idf!38783
2 parents 933a432 + d03c3d3 commit 5cf9278

File tree

7 files changed

+28
-12
lines changed

7 files changed

+28
-12
lines changed

components/esp_rom/esp32h21/Kconfig.soc_caps.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,7 @@ config ESP_ROM_HAS_VERSION
9090
config ESP_ROM_HAS_OUTPUT_PUTC_FUNC
9191
bool
9292
default y
93+
94+
config ESP_ROM_HAS_SUBOPTIMAL_NEWLIB_ON_MISALIGNED_MEMORY
95+
bool
96+
default y

components/esp_rom/esp32h21/esp_rom_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@
2929
#define ESP_ROM_HAS_VERSION (1) // ROM has version/eco information
3030
// #define ESP_ROM_SUPPORT_DEEP_SLEEP_WAKEUP_STUB (1) // ROM supports the HP core to jump to the RTC memory to execute stub code after waking up from deepsleep. //TODO: [ESP32H21] IDF-11515
3131
#define ESP_ROM_HAS_OUTPUT_PUTC_FUNC (1) // ROM has esp_rom_output_putc (or ets_write_char_uart)
32+
#define ESP_ROM_HAS_SUBOPTIMAL_NEWLIB_ON_MISALIGNED_MEMORY (1) // ROM mem/str functions are not optimized well for misaligned memory access.

components/esp_rom/esp32h21/include/esp32h21/rom/ets_sys.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -9,7 +9,6 @@
99
#include <stdint.h>
1010
#include <stdbool.h>
1111

12-
//TODO: [ESP32H21] IDF-11555
1312

1413
#ifdef __cplusplus
1514
extern "C" {
@@ -410,14 +409,16 @@ void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num);
410409

411410
#define ETS_MEM_BAR() asm volatile ( "" : : : "memory" )
412411

413-
//TODO: [ESP32H21] IDF-11555, need to check
412+
#ifdef ESP_PLATFORM
413+
// Remove in IDF v6.0 (IDF-7044)
414414
typedef enum {
415415
OK = 0,
416416
FAIL,
417417
PENDING,
418418
BUSY,
419419
CANCEL,
420-
} STATUS;
420+
} STATUS __attribute__((deprecated("Use ETS_STATUS instead")));
421+
#endif
421422

422423
/**
423424
* @}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/* These functions are not well optimized for misaligned memory access.
7+
* See details in the https://sourceware.org/pipermail/newlib/2025/021470.html
8+
* patch series. */
9+
memcpy = 0x4000049c;
10+
memmove = 0x400004a0;
11+
memcmp = 0x400004a4;
12+
strcpy = 0x400004a8;
13+
strncpy = 0x400004ac;
14+
strcmp = 0x400004b0;
15+
strncmp = 0x400004b4;

components/esp_rom/esp32h21/ld/esp32h21.rom.libc.ld

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
*/
66
esp_rom_newlib_init_common_mutexes = 0x40000494;
77
memset = 0x40000498;
8-
memcpy = 0x4000049c;
9-
memmove = 0x400004a0;
10-
memcmp = 0x400004a4;
11-
strcpy = 0x400004a8;
12-
strncpy = 0x400004ac;
13-
strcmp = 0x400004b0;
14-
strncmp = 0x400004b4;
158
strlen = 0x400004b8;
169
strstr = 0x400004bc;
1710
bzero = 0x400004c0;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
CONFIG_FREERTOS_HZ=1000
22
CONFIG_ESP_TASK_WDT_EN=n
3+
# miniz test may overflow stack
4+
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192

components/newlib/test_apps/newlib/main/test_newlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static bool fn_in_rom(void *fn)
131131
/* Older chips have newlib nano in rom as well, but this is not linked in due to us now using 64 bit time_t
132132
and the ROM code was compiled for 32 bit.
133133
*/
134-
#define PRINTF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && CONFIG_IDF_TARGET_ESP32C2)
134+
#define PRINTF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && (CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32H21))
135135
#define SSCANF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && CONFIG_IDF_TARGET_ESP32C2)
136136

137137
TEST_CASE("check if ROM or Flash is used for functions", "[newlib]")

0 commit comments

Comments
 (0)