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:
Wenyong Huang 2023-11-16 18:39:41 +08:00 committed by GitHub
parent 503d94ace2
commit a3349cc8c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 4 deletions

View File

@ -32,6 +32,12 @@ typedef aos_task_t *aos_tid_t;
typedef aos_mutex_t korp_mutex;
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;
typedef struct os_thread_wait_node *os_thread_wait_list;
typedef struct korp_cond {
@ -64,8 +70,10 @@ int signbit(double x);
int isnan(double x);
/* 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 DIR *os_dir_stream;
typedef void *os_dir_stream;
typedef int os_raw_file_handle;
static inline os_file_handle

View File

@ -40,6 +40,12 @@ typedef kernel_pid_t korp_tid;
typedef mutex_t korp_mutex;
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; */
struct os_thread_wait_node;
@ -52,8 +58,10 @@ typedef struct korp_cond {
#define os_printf printf
#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 DIR *os_dir_stream;
typedef void *os_dir_stream;
typedef int os_raw_file_handle;
#if WA_MATH

View File

@ -38,6 +38,12 @@ typedef struct rt_thread korp_cond;
typedef struct rt_thread korp_thread;
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_int8_t int8_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_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 DIR *os_dir_stream;
typedef void *os_dir_stream;
typedef int os_raw_file_handle;
static inline os_file_handle

View File

@ -74,6 +74,12 @@ typedef korp_thread *korp_tid;
typedef struct k_mutex korp_mutex;
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;
typedef struct os_thread_wait_node *os_thread_wait_list;
typedef struct korp_cond {
@ -148,8 +154,10 @@ void
set_exec_mem_alloc_func(exec_mem_alloc_func_t alloc_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 DIR *os_dir_stream;
typedef void *os_dir_stream;
typedef int os_raw_file_handle;
static inline os_file_handle

View File

@ -265,8 +265,18 @@ iwasm_init(void)
iwasm_main, NULL, NULL, NULL, MAIN_THREAD_PRIORITY, 0, K_NO_WAIT);
return tid ? true : false;
}
#if KERNEL_VERSION_NUMBER < 0x030400 /* version 3.4.0 */
void
main(void)
{
iwasm_init();
}
#else
int
main(void)
{
iwasm_init();
return 0;
}
#endif