Skip to content

Commit 2735192

Browse files
authored
Fix ESP32-S3 compiling error (#3360)
1. when enable SPIRAM 2. when using esp-idf v5.3
1 parent 6f18fe9 commit 2735192

File tree

2 files changed

+52
-28
lines changed

2 files changed

+52
-28
lines changed

core/shared/platform/esp-idf/espidf_memmap.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
#include "soc/mmu.h"
1010
#include "rom/cache.h"
1111

12-
#define MEM_DUAL_BUS_OFFSET (IRAM0_CACHE_ADDRESS_LOW - DRAM0_CACHE_ADDRESS_LOW)
12+
#define MEM_DUAL_BUS_OFFSET (SOC_IROM_LOW - SOC_IROM_HIGH)
1313

14-
#define in_ibus_ext(addr) \
15-
(((uint32)addr >= IRAM0_CACHE_ADDRESS_LOW) \
16-
&& ((uint32)addr < IRAM0_CACHE_ADDRESS_HIGH))
14+
#define in_ibus_ext(addr) \
15+
(((uint32)addr >= SOC_IROM_LOW) && ((uint32)addr < SOC_IROM_HIGH))
1716

1817
static portMUX_TYPE s_spinlock = portMUX_INITIALIZER_UNLOCKED;
1918
#endif

core/shared/platform/esp-idf/platform_internal.h

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,58 +56,83 @@ typedef unsigned int korp_sem;
5656
#define UTIME_OMIT ((1l << 30) - 2l)
5757
#endif
5858

59-
#ifdef DT_UNKNOWN
60-
#undef DT_UNKNOWN
61-
#endif
62-
63-
#ifdef DT_REG
64-
#undef DT_REG
65-
#endif
66-
67-
#ifdef DT_DIR
68-
#undef DT_DIR
69-
#endif
70-
7159
/* Below parts of d_type define are ported from Nuttx, under Apache License v2.0
7260
*/
7361

74-
/* File type code for the d_type field in dirent structure.
75-
* Note that because of the simplified filesystem organization of the NuttX,
76-
* top-level, pseudo-file system, an inode can be BOTH a file and a directory
62+
/* Following macros are defined in espressif GCC of esp-idf v5.3
7763
*/
7864

7965
#define DTYPE_UNKNOWN 0
80-
#define DTYPE_FIFO 1
81-
#define DTYPE_CHR 2
82-
#define DTYPE_SEM 3
83-
#define DTYPE_DIRECTORY 4
84-
#define DTYPE_MQ 5
85-
#define DTYPE_BLK 6
86-
#define DTYPE_SHM 7
87-
#define DTYPE_FILE 8
88-
#define DTYPE_MTD 9
66+
#define DTYPE_FILE 1
67+
#define DTYPE_DIRECTORY 2
68+
#define DTYPE_CHR 4
69+
#define DTYPE_BLK 5
70+
#define DTYPE_FIFO 8
8971
#define DTYPE_LINK 10
9072
#define DTYPE_SOCK 12
9173

74+
/* Following macros are not defined in espressif GCC of esp-idf v5.3
75+
*/
76+
77+
#define DTYPE_SEM 100
78+
#define DTYPE_MQ 101
79+
#define DTYPE_SHM 102
80+
#define DTYPE_MTD 103
81+
9282
/* The d_type field of the dirent structure is not specified by POSIX. It
9383
* is a non-standard, 4.5BSD extension that is implemented by most OSs. A
9484
* POSIX compliant OS may not implement the d_type field at all. Many OS's
9585
* (including glibc) may use the following alternative naming for the file
9686
* type names:
9787
*/
9888

89+
#ifndef DT_UNKNOWN
9990
#define DT_UNKNOWN DTYPE_UNKNOWN
91+
#endif
92+
93+
#ifndef DT_FIFO
10094
#define DT_FIFO DTYPE_FIFO
95+
#endif
96+
97+
#ifndef DT_CHR
10198
#define DT_CHR DTYPE_CHR
99+
#endif
100+
101+
#ifndef DT_SEM
102102
#define DT_SEM DTYPE_SEM
103+
#endif
104+
105+
#ifndef DT_DIR
103106
#define DT_DIR DTYPE_DIRECTORY
107+
#endif
108+
109+
#ifndef DT_MQ
104110
#define DT_MQ DTYPE_MQ
111+
#endif
112+
113+
#ifndef DT_BLK
105114
#define DT_BLK DTYPE_BLK
115+
#endif
116+
117+
#ifndef DT_SHM
106118
#define DT_SHM DTYPE_SHM
119+
#endif
120+
121+
#ifndef DT_REG
107122
#define DT_REG DTYPE_FILE
123+
#endif
124+
125+
#ifndef DT_MTD
108126
#define DT_MTD DTYPE_MTD
127+
#endif
128+
129+
#ifndef DT_LNK
109130
#define DT_LNK DTYPE_LINK
131+
#endif
132+
133+
#ifndef DT_SOCK
110134
#define DT_SOCK DTYPE_SOCK
135+
#endif
111136

112137
typedef int os_file_handle;
113138
typedef DIR *os_dir_stream;

0 commit comments

Comments
 (0)