File tree Expand file tree Collapse file tree 3 files changed +118
-0
lines changed
Expand file tree Collapse file tree 3 files changed +118
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ endif()
1616
1717set (srcs
1818 src/flash.c
19+ src/mem_utils.c
1920 src/rom_wrappers.c
2021)
2122
Original file line number Diff line number Diff line change 1+ /*
2+ * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+ *
4+ * SPDX-License-Identifier: Apache-2.0 OR MIT
5+ */
6+
7+ #pragma once
8+
9+ #include <stdbool.h>
10+ #include <stdint.h>
11+
12+ /**
13+ * @brief Check if address is in external memory range.
14+ *
15+ * External flash memory mapped via the instruction bus.
16+ */
17+ bool stub_lib_mem_is_irom (uintptr_t addr );
18+
19+ /**
20+ * @brief Check if address is in external memory range.
21+ *
22+ * External flash memory mapped via the data bus.
23+ */
24+ bool stub_lib_mem_is_drom (uintptr_t addr );
25+
26+ /**
27+ * @brief Check if address is in internal memory range.
28+ *
29+ * Internal memory accessed via the instruction bus.
30+ */
31+ bool stub_lib_mem_is_iram (uintptr_t addr );
32+
33+ /**
34+ * @brief Check if address is in internal memory range.
35+ *
36+ * Internal memory accessed via the data bus.
37+ */
38+ bool stub_lib_mem_is_dram (uintptr_t addr );
39+
40+ bool stub_lib_mem_is_rtc_iram_fast (uintptr_t addr );
41+ bool stub_lib_mem_is_rtc_dram_fast (uintptr_t addr );
42+ bool stub_lib_mem_is_rtc_slow (uintptr_t addr );
43+
44+ bool stub_lib_mem_is_tcm (uintptr_t addr );
Original file line number Diff line number Diff line change 1+ /*
2+ * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+ *
4+ * SPDX-License-Identifier: Apache-2.0 OR MIT
5+ */
6+ #include <stdbool.h>
7+ #include <stdint.h>
8+
9+ #include <mem_utils.h>
10+
11+ #include <soc/soc_caps.h>
12+ #include <soc/soc.h>
13+
14+ bool stub_lib_mem_is_irom (uintptr_t addr )
15+ {
16+ return addr >= SOC_IROM_LOW && addr < SOC_IROM_HIGH ;
17+ }
18+
19+ bool stub_lib_mem_is_drom (uintptr_t addr )
20+ {
21+ return addr >= SOC_DROM_LOW && addr < SOC_DROM_HIGH ;
22+ }
23+
24+ bool stub_lib_mem_is_iram (uintptr_t addr )
25+ {
26+ return addr >= SOC_IRAM_LOW && addr < SOC_IRAM_HIGH ;
27+ }
28+
29+ bool stub_lib_mem_is_dram (uintptr_t addr )
30+ {
31+ return addr >= SOC_DRAM_LOW && addr < SOC_DRAM_HIGH ;
32+ }
33+
34+ bool stub_lib_mem_is_rtc_iram_fast (uintptr_t addr )
35+ {
36+ #if defined(SOC_RTC_FAST_MEM_SUPPORTED ) && SOC_RTC_FAST_MEM_SUPPORTED
37+ return addr >= SOC_RTC_IRAM_LOW && addr < SOC_RTC_IRAM_HIGH ;
38+ #else
39+ (void )addr ;
40+ return false;
41+ #endif
42+ }
43+
44+ bool stub_lib_mem_is_rtc_dram_fast (uintptr_t addr )
45+ {
46+ #if defined(SOC_RTC_FAST_MEM_SUPPORTED ) && SOC_RTC_FAST_MEM_SUPPORTED
47+ return addr >= SOC_RTC_DRAM_LOW && addr < SOC_RTC_DRAM_HIGH ;
48+ #else
49+ (void )addr ;
50+ return false;
51+ #endif
52+
53+ }
54+
55+ bool stub_lib_mem_is_rtc_slow (uintptr_t addr )
56+ {
57+ #if defined(SOC_RTC_SLOW_MEM_SUPPORTED ) && SOC_RTC_SLOW_MEM_SUPPORTED
58+ return addr >= SOC_RTC_DATA_LOW && addr < SOC_RTC_DATA_HIGH ;
59+ #else
60+ (void )addr ;
61+ return false;
62+ #endif
63+ }
64+
65+ bool stub_lib_mem_is_tcm (uintptr_t addr )
66+ {
67+ #if defined(SOC_MEM_TCM_SUPPORTED ) && SOC_MEM_TCM_SUPPORTED
68+ return (addr >= SOC_TCM_LOW && addr < SOC_TCM_HIGH );
69+ #else
70+ (void )addr ;
71+ return false;
72+ #endif
73+ }
You can’t perform that action at this time.
0 commit comments