baremetal: add baremetal platform
This commit is contained in:
@ -150,7 +150,7 @@ endif ()
|
|||||||
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
|
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
|
||||||
|
|
||||||
set (THREADS_PREFER_PTHREAD_FLAG ON)
|
set (THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
# find_package(Threads REQUIRED)
|
||||||
|
|
||||||
add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE})
|
add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE})
|
||||||
set_target_properties (vmlib PROPERTIES OUTPUT_NAME iwasm)
|
set_target_properties (vmlib PROPERTIES OUTPUT_NAME iwasm)
|
||||||
|
|||||||
1225
core/shared/platform/baremetal/platform_init.c
Normal file
1225
core/shared/platform/baremetal/platform_init.c
Normal file
File diff suppressed because it is too large
Load Diff
78
core/shared/platform/baremetal/platform_internal.h
Normal file
78
core/shared/platform/baremetal/platform_internal.h
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#ifndef _PLATFORM_INTERNAL_H
|
||||||
|
#define _PLATFORM_INTERNAL_H
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
// #include <assert.h>
|
||||||
|
// #include <time.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
// #include <signal.h>
|
||||||
|
#include <semaphore.h>
|
||||||
|
// #include <limits.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
// #include <fcntl.h>
|
||||||
|
// #include <unistd.h>
|
||||||
|
// #include <poll.h>
|
||||||
|
// #include <sched.h>
|
||||||
|
// #include <errno.h>
|
||||||
|
// #include <sys/types.h>
|
||||||
|
// #include <sys/stat.h>
|
||||||
|
// #include <sys/mman.h>
|
||||||
|
// #include <sys/time.h>
|
||||||
|
// #include <sys/timeb.h>
|
||||||
|
// #include <sys/uio.h>
|
||||||
|
// #include <sys/ioctl.h>
|
||||||
|
// #include <sys/socket.h>
|
||||||
|
// #include <sys/resource.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BH_PLATFORM_BAREMETAL
|
||||||
|
#define BH_PLATFORM_BAREMETAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BH_APPLET_PRESERVED_STACK_SIZE (8 * 1024)
|
||||||
|
#define BH_THREAD_DEFAULT_PRIORITY 0
|
||||||
|
|
||||||
|
typedef pthread_t korp_tid;
|
||||||
|
typedef pthread_mutex_t korp_mutex;
|
||||||
|
typedef pthread_cond_t korp_cond;
|
||||||
|
typedef pthread_t korp_thread;
|
||||||
|
typedef sem_t korp_sem;
|
||||||
|
|
||||||
|
// typedef pthread_rwlock_t korp_rwlock;
|
||||||
|
typedef struct {
|
||||||
|
volatile uint32_t readers;
|
||||||
|
volatile bool writer;
|
||||||
|
} korp_rwlock;
|
||||||
|
|
||||||
|
typedef int os_file_handle;
|
||||||
|
typedef DIR *os_dir_stream;
|
||||||
|
typedef int os_raw_file_handle;
|
||||||
|
|
||||||
|
static inline os_file_handle
|
||||||
|
os_get_invalid_handle(void)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
os_getpagesize()
|
||||||
|
{
|
||||||
|
// TODO: What pagesize?
|
||||||
|
return 4096;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* end of _PLATFORM_INTERNAL_H */
|
||||||
12
core/shared/platform/baremetal/shared_platform.cmake
Normal file
12
core/shared/platform/baremetal/shared_platform.cmake
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
set (PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
|
add_definitions(-DBH_PLATFORM_BAREMETAL)
|
||||||
|
|
||||||
|
include_directories(${PLATFORM_SHARED_DIR})
|
||||||
|
include_directories(${PLATFORM_SHARED_DIR}/../include)
|
||||||
|
|
||||||
|
file (GLOB_RECURSE source_all ${PLATFORM_SHARED_DIR}/*.c)
|
||||||
|
set (PLATFORM_SHARED_SOURCE ${source_all})
|
||||||
|
|
||||||
|
file (GLOB header ${PLATFORM_SHARED_DIR}/../include/baremetal/*.h)
|
||||||
|
LIST (APPEND RUNTIME_LIB_HEADER_LIST ${header})
|
||||||
Reference in New Issue
Block a user