Skip to content

Commit

Permalink
Fix ESP32-S3 compiling error (bytecodealliance#3359)
Browse files Browse the repository at this point in the history
1. when enable SPIRAM
2. when using esp-idf v5.3

Signed-off-by: victoryang00 <victoryang00@ucsc.edu>
  • Loading branch information
donghengqaz authored and victoryang00 committed May 2, 2024
1 parent fac4185 commit 35089dd
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 28 deletions.
7 changes: 3 additions & 4 deletions core/shared/platform/esp-idf/espidf_memmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
#include "soc/mmu.h"
#include "rom/cache.h"

#define MEM_DUAL_BUS_OFFSET (IRAM0_CACHE_ADDRESS_LOW - DRAM0_CACHE_ADDRESS_LOW)
#define MEM_DUAL_BUS_OFFSET (SOC_IROM_LOW - SOC_IROM_HIGH)

#define in_ibus_ext(addr) \
(((uint32)addr >= IRAM0_CACHE_ADDRESS_LOW) \
&& ((uint32)addr < IRAM0_CACHE_ADDRESS_HIGH))
#define in_ibus_ext(addr) \
(((uint32)addr >= SOC_IROM_LOW) && ((uint32)addr < SOC_IROM_HIGH))

static portMUX_TYPE s_spinlock = portMUX_INITIALIZER_UNLOCKED;
#endif
Expand Down
73 changes: 49 additions & 24 deletions core/shared/platform/esp-idf/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,58 +56,83 @@ typedef unsigned int korp_sem;
#define UTIME_OMIT ((1l << 30) - 2l)
#endif

#ifdef DT_UNKNOWN
#undef DT_UNKNOWN
#endif

#ifdef DT_REG
#undef DT_REG
#endif

#ifdef DT_DIR
#undef DT_DIR
#endif

/* Below parts of d_type define are ported from Nuttx, under Apache License v2.0
*/

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

#define DTYPE_UNKNOWN 0
#define DTYPE_FIFO 1
#define DTYPE_CHR 2
#define DTYPE_SEM 3
#define DTYPE_DIRECTORY 4
#define DTYPE_MQ 5
#define DTYPE_BLK 6
#define DTYPE_SHM 7
#define DTYPE_FILE 8
#define DTYPE_MTD 9
#define DTYPE_FILE 1
#define DTYPE_DIRECTORY 2
#define DTYPE_CHR 4
#define DTYPE_BLK 5
#define DTYPE_FIFO 8
#define DTYPE_LINK 10
#define DTYPE_SOCK 12

/* Following macros are not defined in espressif GCC of esp-idf v5.3
*/

#define DTYPE_SEM 100
#define DTYPE_MQ 101
#define DTYPE_SHM 102
#define DTYPE_MTD 103

/* The d_type field of the dirent structure is not specified by POSIX. It
* is a non-standard, 4.5BSD extension that is implemented by most OSs. A
* POSIX compliant OS may not implement the d_type field at all. Many OS's
* (including glibc) may use the following alternative naming for the file
* type names:
*/

#ifndef DT_UNKNOWN
#define DT_UNKNOWN DTYPE_UNKNOWN
#endif

#ifndef DT_FIFO
#define DT_FIFO DTYPE_FIFO
#endif

#ifndef DT_CHR
#define DT_CHR DTYPE_CHR
#endif

#ifndef DT_SEM
#define DT_SEM DTYPE_SEM
#endif

#ifndef DT_DIR
#define DT_DIR DTYPE_DIRECTORY
#endif

#ifndef DT_MQ
#define DT_MQ DTYPE_MQ
#endif

#ifndef DT_BLK
#define DT_BLK DTYPE_BLK
#endif

#ifndef DT_SHM
#define DT_SHM DTYPE_SHM
#endif

#ifndef DT_REG
#define DT_REG DTYPE_FILE
#endif

#ifndef DT_MTD
#define DT_MTD DTYPE_MTD
#endif

#ifndef DT_LNK
#define DT_LNK DTYPE_LINK
#endif

#ifndef DT_SOCK
#define DT_SOCK DTYPE_SOCK
#endif

static inline int
os_getpagesize()
Expand Down

0 comments on commit 35089dd

Please sign in to comment.