mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
Fix compilation errors on zephyr platform (#2777)
Add dummy korp_rwlock struct and fix os_dir_stream definition on platform zephyr/riot/rt-thread/alios to fix the compilation errors.
This commit is contained in:
parent
503d94ace2
commit
a3349cc8c1
|
@ -32,6 +32,12 @@ typedef aos_task_t *aos_tid_t;
|
||||||
typedef aos_mutex_t korp_mutex;
|
typedef aos_mutex_t korp_mutex;
|
||||||
typedef aos_sem_t korp_sem;
|
typedef aos_sem_t korp_sem;
|
||||||
|
|
||||||
|
/* korp_rwlock is used in platform_api_extension.h,
|
||||||
|
we just define the type to make the compiler happy */
|
||||||
|
typedef struct {
|
||||||
|
int dummy;
|
||||||
|
} korp_rwlock;
|
||||||
|
|
||||||
struct os_thread_wait_node;
|
struct os_thread_wait_node;
|
||||||
typedef struct os_thread_wait_node *os_thread_wait_list;
|
typedef struct os_thread_wait_node *os_thread_wait_list;
|
||||||
typedef struct korp_cond {
|
typedef struct korp_cond {
|
||||||
|
@ -64,8 +70,10 @@ int signbit(double x);
|
||||||
int isnan(double x);
|
int isnan(double x);
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
|
/* The below types are used in platform_api_extension.h,
|
||||||
|
we just define them to make the compiler happy */
|
||||||
typedef int os_file_handle;
|
typedef int os_file_handle;
|
||||||
typedef DIR *os_dir_stream;
|
typedef void *os_dir_stream;
|
||||||
typedef int os_raw_file_handle;
|
typedef int os_raw_file_handle;
|
||||||
|
|
||||||
static inline os_file_handle
|
static inline os_file_handle
|
||||||
|
|
|
@ -40,6 +40,12 @@ typedef kernel_pid_t korp_tid;
|
||||||
typedef mutex_t korp_mutex;
|
typedef mutex_t korp_mutex;
|
||||||
typedef unsigned int korp_sem;
|
typedef unsigned int korp_sem;
|
||||||
|
|
||||||
|
/* korp_rwlock is used in platform_api_extension.h,
|
||||||
|
we just define the type to make the compiler happy */
|
||||||
|
typedef struct {
|
||||||
|
int dummy;
|
||||||
|
} korp_rwlock;
|
||||||
|
|
||||||
/* typedef sema_t korp_sem; */
|
/* typedef sema_t korp_sem; */
|
||||||
|
|
||||||
struct os_thread_wait_node;
|
struct os_thread_wait_node;
|
||||||
|
@ -52,8 +58,10 @@ typedef struct korp_cond {
|
||||||
#define os_printf printf
|
#define os_printf printf
|
||||||
#define os_vprintf vprintf
|
#define os_vprintf vprintf
|
||||||
|
|
||||||
|
/* The below types are used in platform_api_extension.h,
|
||||||
|
we just define them to make the compiler happy */
|
||||||
typedef int os_file_handle;
|
typedef int os_file_handle;
|
||||||
typedef DIR *os_dir_stream;
|
typedef void *os_dir_stream;
|
||||||
typedef int os_raw_file_handle;
|
typedef int os_raw_file_handle;
|
||||||
|
|
||||||
#if WA_MATH
|
#if WA_MATH
|
||||||
|
|
|
@ -38,6 +38,12 @@ typedef struct rt_thread korp_cond;
|
||||||
typedef struct rt_thread korp_thread;
|
typedef struct rt_thread korp_thread;
|
||||||
typedef unsigned int korp_sem;
|
typedef unsigned int korp_sem;
|
||||||
|
|
||||||
|
/* korp_rwlock is used in platform_api_extension.h,
|
||||||
|
we just define the type to make the compiler happy */
|
||||||
|
typedef struct {
|
||||||
|
int dummy;
|
||||||
|
} korp_rwlock;
|
||||||
|
|
||||||
typedef rt_uint8_t uint8_t;
|
typedef rt_uint8_t uint8_t;
|
||||||
typedef rt_int8_t int8_t;
|
typedef rt_int8_t int8_t;
|
||||||
typedef rt_uint16_t uint16_t;
|
typedef rt_uint16_t uint16_t;
|
||||||
|
@ -45,8 +51,10 @@ typedef rt_int16_t int16_t;
|
||||||
typedef rt_uint64_t uint64_t;
|
typedef rt_uint64_t uint64_t;
|
||||||
typedef rt_int64_t int64_t;
|
typedef rt_int64_t int64_t;
|
||||||
|
|
||||||
|
/* The below types are used in platform_api_extension.h,
|
||||||
|
we just define them to make the compiler happy */
|
||||||
typedef int os_file_handle;
|
typedef int os_file_handle;
|
||||||
typedef DIR *os_dir_stream;
|
typedef void *os_dir_stream;
|
||||||
typedef int os_raw_file_handle;
|
typedef int os_raw_file_handle;
|
||||||
|
|
||||||
static inline os_file_handle
|
static inline os_file_handle
|
||||||
|
|
|
@ -74,6 +74,12 @@ typedef korp_thread *korp_tid;
|
||||||
typedef struct k_mutex korp_mutex;
|
typedef struct k_mutex korp_mutex;
|
||||||
typedef unsigned int korp_sem;
|
typedef unsigned int korp_sem;
|
||||||
|
|
||||||
|
/* korp_rwlock is used in platform_api_extension.h,
|
||||||
|
we just define the type to make the compiler happy */
|
||||||
|
typedef struct {
|
||||||
|
int dummy;
|
||||||
|
} korp_rwlock;
|
||||||
|
|
||||||
struct os_thread_wait_node;
|
struct os_thread_wait_node;
|
||||||
typedef struct os_thread_wait_node *os_thread_wait_list;
|
typedef struct os_thread_wait_node *os_thread_wait_list;
|
||||||
typedef struct korp_cond {
|
typedef struct korp_cond {
|
||||||
|
@ -148,8 +154,10 @@ void
|
||||||
set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func,
|
set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_func,
|
||||||
exec_mem_free_func_t free_func);
|
exec_mem_free_func_t free_func);
|
||||||
|
|
||||||
|
/* The below types are used in platform_api_extension.h,
|
||||||
|
we just define them to make the compiler happy */
|
||||||
typedef int os_file_handle;
|
typedef int os_file_handle;
|
||||||
typedef DIR *os_dir_stream;
|
typedef void *os_dir_stream;
|
||||||
typedef int os_raw_file_handle;
|
typedef int os_raw_file_handle;
|
||||||
|
|
||||||
static inline os_file_handle
|
static inline os_file_handle
|
||||||
|
|
|
@ -265,8 +265,18 @@ iwasm_init(void)
|
||||||
iwasm_main, NULL, NULL, NULL, MAIN_THREAD_PRIORITY, 0, K_NO_WAIT);
|
iwasm_main, NULL, NULL, NULL, MAIN_THREAD_PRIORITY, 0, K_NO_WAIT);
|
||||||
return tid ? true : false;
|
return tid ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KERNEL_VERSION_NUMBER < 0x030400 /* version 3.4.0 */
|
||||||
void
|
void
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
iwasm_init();
|
iwasm_init();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
iwasm_init();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user