mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 07:21:54 +00:00
Add ia32 support and fix compiling issue for RT-Thread (#730)
This commit is contained in:
parent
336abc2b27
commit
7e60b8608e
18
SConscript
18
SConscript
|
@ -14,20 +14,10 @@ cwd = GetCurrentDir()
|
|||
list = os.listdir(cwd)
|
||||
|
||||
if GetDepend(['PKG_USING_WAMR']):
|
||||
wamr_entry_sconscript = os.path.join(cwd, "product-mini", "platforms", "rt-thread", 'SConscript')
|
||||
wamr_entry_sconscript = os.path.join(cwd, "product-mini", "platforms", "rt-thread", 'SConscript')
|
||||
wamr_runlib_sconscript = os.path.join(cwd, "build-scripts", 'SConscript')
|
||||
|
||||
if os.path.isfile(wamr_entry_sconscript):
|
||||
objs = objs + SConscript(wamr_entry_sconscript)
|
||||
else:
|
||||
print("[WAMR] entry script wrong:", wamr_entry_sconscript)
|
||||
Return('objs')
|
||||
|
||||
wamr_runlib_sconsript = os.path.join(cwd, "build-scripts", 'SConscript')
|
||||
|
||||
if os.path.isfile(wamr_runlib_sconsript):
|
||||
objs = objs + SConscript(wamr_runlib_sconsript)
|
||||
else:
|
||||
print("[WAMR] runtime lib script wrong:", wamr_runlib_sconsript)
|
||||
objs = objs + SConscript(wamr_entry_sconscript)
|
||||
objs = objs + SConscript(wamr_runlib_sconscript)
|
||||
|
||||
Return('objs')
|
||||
|
||||
|
|
|
@ -11,23 +11,16 @@ cwd = GetCurrentDir()
|
|||
objs = []
|
||||
|
||||
WAMR_ROOT_DIR = os.path.join(cwd, "..")
|
||||
|
||||
|
||||
SHARED_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'shared')
|
||||
|
||||
IWASM_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'iwasm')
|
||||
|
||||
APP_MGR_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'app-mgr')
|
||||
|
||||
SHARED_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'shared')
|
||||
IWASM_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'iwasm')
|
||||
APP_MGR_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'app-mgr')
|
||||
APP_FRAMEWORK_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'app-framework')
|
||||
|
||||
DEPS_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'deps')
|
||||
DEPS_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'deps')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_INTERP']):
|
||||
script_path = os.path.join(IWASM_DIR, 'interpreter', 'SConscript')
|
||||
objs += SConscript(script_path)
|
||||
|
||||
|
||||
if GetDepend(['WAMR_BUILD_AOT']):
|
||||
script_path = os.path.join(IWASM_DIR, 'aot', 'SConscript')
|
||||
objs += SConscript(script_path)
|
||||
|
@ -35,54 +28,32 @@ if GetDepend(['WAMR_BUILD_AOT']):
|
|||
script_path = os.path.join(IWASM_DIR, 'compilation', 'SConscript')
|
||||
objs += SConscript(script_path)
|
||||
|
||||
|
||||
if GetDepend(['WAMR_BUILD_APP_FRAMEWORK']):
|
||||
objs += SConscript(os.path.join(APP_FRAMEWORK_DIR, 'SConscript'))
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'coap', 'SConscript'))
|
||||
objs += SConscript(os.path.join(APP_MGR_DIR, 'app-manager', 'SConscript'))
|
||||
objs += SConscript(os.path.join(APP_MGR_DIR, 'app-mgr-shared', 'SConscript'))
|
||||
|
||||
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIBC_BUILTIN']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-builtin', 'SConscript'))
|
||||
|
||||
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIBC_WASI']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-wasi', 'SConscript'))
|
||||
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIB_PTHREAD']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-pthread', 'SConscript'))
|
||||
# TODO: 这里加一下
|
||||
|
||||
|
||||
|
||||
# if (WAMR_BUILD_THREAD_MGR EQUAL 1)
|
||||
# include (${IWASM_DIR}/libraries/thread-mgr/thread_mgr.cmake)
|
||||
# endif ()
|
||||
|
||||
if GetDepend(['WAMR_BUILD_THREAD_MGR']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'thread-mgr', 'SConscript'))
|
||||
|
||||
|
||||
|
||||
# if (WAMR_BUILD_LIBC_EMCC EQUAL 1)
|
||||
# include (${IWASM_DIR}/libraries/libc-emcc/libc_emcc.cmake)
|
||||
# endif()
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIBC_EMCC']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-emmc', 'SConscript'))
|
||||
|
||||
objs += SConscript(os.path.join(cwd, 'SConscript_config'));
|
||||
|
||||
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'platform', 'rt-thread', 'SConscript'))
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'mem-alloc', 'SConscript'))
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'common', 'SConscript'))
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'utils', 'SConscript'))
|
||||
|
||||
|
||||
|
||||
Return('objs')
|
||||
|
|
|
@ -11,15 +11,12 @@ from building import *
|
|||
|
||||
Import('rtconfig')
|
||||
|
||||
src = Split('''
|
||||
''')
|
||||
src = []
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
IWASM_INC_DIR = os.path.join(cwd, '..', 'core', 'iwasm', 'include')
|
||||
|
||||
# include_directories (${IWASM_DIR}/include)
|
||||
|
||||
CPPPATH = [IWASM_INC_DIR]
|
||||
|
||||
if rtconfig.BUILD == 'debug':
|
||||
|
@ -48,12 +45,11 @@ if rtconfig.ARCH == 'arm':
|
|||
print('[WAMR] using armv4')
|
||||
CPPDEFINES += ['BUILD_TARGET_ARM']
|
||||
CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV4']
|
||||
elif rtconfig.ARCH == 'ia32':
|
||||
CPPDEFINES += ['BUILD_TARGET_X86_32', 'RTT_WAMR_BUILD_TARGET_X86_32']
|
||||
else:
|
||||
print("[WAMR] unknown arch", rtconfig.ARCH)
|
||||
|
||||
|
||||
LIBS = ['m']
|
||||
|
||||
if GetDepend(['WAMR_BUILD_INTERP']):
|
||||
CPPDEFINES += ['WASM_ENABLE_INTERP=1']
|
||||
if GetDepend(['WAMR_BUILD_FAST_INTERP']):
|
||||
|
@ -114,8 +110,8 @@ if GetDepend(['WAMR_BUILD_TAIL_CALL']):
|
|||
CPPDEFINES += ['WASM_ENABLE_TAIL_CALL=1']
|
||||
print('[WAMR] Tail call enabledd')
|
||||
|
||||
LIBS = ['m']
|
||||
|
||||
group = DefineGroup('wamr_config_common', src, depend = ['PKG_USING_WAMR'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
|
||||
group = DefineGroup('wamr', src, depend = ['PKG_USING_WAMR'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
|
||||
|
||||
Return('group')
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ cwd = GetCurrentDir()
|
|||
src = Split('''
|
||||
aot_loader.c
|
||||
aot_runtime.c
|
||||
aot_intrinsic.c
|
||||
''')
|
||||
|
||||
if rtconfig.ARCH == 'arm':
|
||||
|
@ -20,7 +21,8 @@ if rtconfig.ARCH == 'arm':
|
|||
src += ['arch/aot_reloc_thumb.c']
|
||||
elif re.match('^cortex-a.*', rtconfig.CPU):
|
||||
src += ['arch/aot_reloc_arm.c']
|
||||
|
||||
elif rtconfig.ARCH == 'ia32':
|
||||
src += ['arch/aot_reloc_x86_32.c']
|
||||
|
||||
CPPPATH = [cwd, cwd + '/../include']
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ if rtconfig.ARCH == 'arm':
|
|||
src += ['arch/invokeNative_thumb.s']
|
||||
elif re.match('^cortex-a.*', rtconfig.CPU):
|
||||
src += ['arch/invokeNative_arm.s']
|
||||
elif rtconfig.ARCH == 'ia32':
|
||||
src += ['arch/invokeNative_ia32.s']
|
||||
|
||||
CPPPATH = [cwd, cwd + '/../include']
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#define BUILD_TARGET "armv6"
|
||||
#elif defined(RTT_WAMR_BUILD_TARGET_ARMV4)
|
||||
#define BUILD_TARGET "armv4"
|
||||
#elif defined(RTT_WAMR_BUILD_TARGET_X86_32)
|
||||
#define BUILD_TARGET "X86_32"
|
||||
#else
|
||||
#error "unsupported aot platform."
|
||||
#endif
|
||||
|
|
|
@ -180,12 +180,10 @@ void os_munmap(void *addr, size_t size)
|
|||
rt_free(addr);
|
||||
}
|
||||
|
||||
#ifdef OS_ENABLE_HW_BOUND_CHECK
|
||||
int os_mprotect(void *addr, size_t size, int prot)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void os_dcache_flush(void)
|
||||
{
|
||||
|
|
|
@ -6,13 +6,9 @@
|
|||
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('iwasm_entry', src, depend = ['PKG_USING_WAMR'], CPPPATH = CPPPATH)
|
||||
group = DefineGroup('iwasm', src, depend = ['PKG_USING_WAMR'])
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -373,18 +373,17 @@ int iwasm(int argc, char **argv)
|
|||
/* destroy the module instance */
|
||||
wasm_runtime_deinstantiate(wasm_module_inst);
|
||||
|
||||
fail3:
|
||||
fail3:
|
||||
/* unload the module */
|
||||
wasm_runtime_unload(wasm_module);
|
||||
|
||||
fail2:
|
||||
fail2:
|
||||
/* free the file buffer */
|
||||
rt_free(wasm_file_buf);
|
||||
|
||||
fail1:
|
||||
fail1:
|
||||
/* destroy runtime environment */
|
||||
wasm_runtime_destroy();
|
||||
return 0;
|
||||
}
|
||||
MSH_CMD_EXPORT(iwasm, Embeded VM of WebAssembly);
|
||||
|
Loading…
Reference in New Issue
Block a user