-
Notifications
You must be signed in to change notification settings - Fork 647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add porting codes of rt-thread. #494
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9097e8c
[add] add porting codes and scons building scripts that are used by r…
alvkeke 3c56932
[modify] change the way to make sure memory allocated are all align t…
alvkeke 4649831
[modify] add license information of new files.
alvkeke b674b91
[modify] remove unneeded definition `BUILD_TARGET` in platform_intern…
alvkeke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
# for module compiling | ||
import os | ||
|
||
from building import * | ||
|
||
objs = [] | ||
cwd = GetCurrentDir() | ||
list = os.listdir(cwd) | ||
|
||
if GetDepend(['PKG_USING_WAMR']): | ||
wamr_entry_sconscript = os.path.join(cwd, "product-mini", "platforms", "rt-thread", '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) | ||
|
||
Return('objs') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
import os | ||
from building import * | ||
|
||
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') | ||
|
||
APP_FRAMEWORK_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'app-framework') | ||
|
||
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) | ||
if GetDepend(['WAMR_BUILD_JIT']): | ||
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
|
||
|
||
import os | ||
import re | ||
|
||
from building import * | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
Import('rtconfig') | ||
|
||
src = Split(''' | ||
''') | ||
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': | ||
CPPDEFINES = ['BH_DEBUG=1'] | ||
else: | ||
CPPDEFINES = ['BH_DEBUG=0'] | ||
|
||
if rtconfig.ARCH == 'arm': | ||
if re.match('^cortex-m.*', rtconfig.CPU): | ||
print('[WAMR] using thumbv4t') | ||
CPPDEFINES += ['BUILD_TARGET_THUMB'] | ||
CPPDEFINES += [r'BUILD_TARGET=\"thumbv4t\"'] | ||
elif re.match('^cortex-a.*', rtconfig.CPU): | ||
print('[WAMR] using armv7') | ||
CPPDEFINES += ['BUILD_TARGET_ARM'] | ||
CPPDEFINES += [r'BUILD_TARGET=\"armv7\"'] | ||
elif re.match('^cortex-r.*', rtconfig.CPU): | ||
print('[WAMR] using armv7') | ||
CPPDEFINES += ['BUILD_TARGET_ARM'] | ||
CPPDEFINES += [r'BUILD_TARGET=\"armv7\"'] | ||
elif rtconfig.CPU == 'armv6': | ||
print('[WAMR] using armv6') | ||
CPPDEFINES += ['BUILD_TARGET_ARM'] | ||
CPPDEFINES += [r'BUILD_TARGET=\"armv6\"'] | ||
elif re.match('^arm9*', rtconfig.CPU): | ||
print('[WAMR] using armv4') | ||
CPPDEFINES += ['BUILD_TARGET_ARM'] | ||
CPPDEFINES += [r'BUILD_TARGET=\"armv4\"'] | ||
|
||
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']): | ||
CPPDEFINES += ['WASM_ENABLE_FAST_INTERP=1'] | ||
print("[WAMR] fast interpreter was enabled") | ||
else: | ||
CPPDEFINES += ['WASM_ENABLE_FAST_INTERP=0'] | ||
print("[WAMR] fast interpreter was disabled") | ||
else: | ||
CPPDEFINES += ['WASM_ENABLE_INTERP=0'] | ||
|
||
CPPDEFINES += ['WASM_ENABLE_JIT=0'] | ||
|
||
if GetDepend(['WAMR_BUILD_MULTI_MODULE']): | ||
CPPDEFINES += ['WASM_ENABLE_MULTI_MODULE=1'] | ||
else: | ||
CPPDEFINES += ['WASM_ENABLE_MULTI_MODULE=0'] | ||
|
||
if GetDepend(['WAMR_BUILD_SPEC_TEST']): | ||
CPPDEFINES += ['WASM_ENABLE_SPEC_TEST=1'] | ||
print("[WAMR] spec test compatible mode was enabled") | ||
|
||
if GetDepend(['WAMR_BUILD_BULK_MEMORY']): | ||
CPPDEFINES += ['WASM_ENABLE_BULK_MEMORY=1'] | ||
print("[WAMR] Bulk memory feature was enabled") | ||
else: | ||
CPPDEFINES += ['WASM_ENABLE_BULK_MEMORY=0'] | ||
|
||
if GetDepend(['WAMR_BUILD_SHARED_MEMORY']): | ||
CPPDEFINES += ['WASM_ENABLE_SHARED_MEMORY=1'] | ||
print("[WAMR] Shared memory enabled") | ||
else: | ||
CPPDEFINES += ['WASM_ENABLE_SHARED_MEMORY=0'] | ||
|
||
if GetDepend(['WAMR_BUILD_MINI_LOADER']): | ||
CPPDEFINES += ['WASM_ENABLE_MINI_LOADER=1'] | ||
print("[WAMR] mini loader enabled") | ||
else: | ||
CPPDEFINES += ['WASM_ENABLE_MINI_LOADER=0'] | ||
|
||
if GetDepend(['WAMR_DISABLE_HW_BOUND_CHECK']): | ||
CPPDEFINES += ['WASM_DISABLE_HW_BOUND_CHECK=1'] | ||
print("[WAMR] Hardware boundary check disabled") | ||
|
||
if GetDepend(['WAMR_BUILD_SIMD']): | ||
CPPDEFINES += ['WASM_ENABLE_SIMD=1'] | ||
print('[WAMR] SIMD enabled') | ||
|
||
if GetDepend(['WAMR_BUILD_MEMORY_PROFILING']): | ||
CPPDEFINES += ['WASM_ENABLE_MEMORY_PROFILING=1'] | ||
print('[WAMR] Memory profiling enabled') | ||
|
||
if GetDepend(['WAMR_BUILD_CUSTOM_NAME_SECTION']): | ||
CPPDEFINES += ['WASM_ENABLE_CUSTOM_NAME_SECTION=1'] | ||
print('[WAMR] Custom name section enabled') | ||
|
||
if GetDepend(['WAMR_BUILD_TAIL_CALL']): | ||
CPPDEFINES += ['WASM_ENABLE_TAIL_CALL=1'] | ||
print('[WAMR] Tail call enabledd') | ||
|
||
|
||
group = DefineGroup('wamr_config_common', src, depend = ['PKG_USING_WAMR'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS) | ||
|
||
Return('group') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
from building import * | ||
import re | ||
Import('rtconfig') | ||
|
||
cwd = GetCurrentDir() | ||
|
||
src = Split(''' | ||
aot_loader.c | ||
aot_runtime.c | ||
''') | ||
|
||
if rtconfig.ARCH == 'arm': | ||
if re.match('^cortex-m.*', rtconfig.CPU): | ||
src += ['arch/aot_reloc_thumb.c'] | ||
elif re.match('^cortex-a.*', rtconfig.CPU): | ||
src += ['arch/aot_reloc_arm.c'] | ||
|
||
|
||
CPPPATH = [cwd, cwd + '/../include'] | ||
|
||
CPPDEFINES = ['WASM_ENABLE_AOT=1'] | ||
|
||
group = DefineGroup('iwasm_aot', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) | ||
|
||
Return('group') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
from building import * | ||
import re | ||
|
||
Import('rtconfig') | ||
|
||
cwd = GetCurrentDir() | ||
|
||
src = Glob('*.c') | ||
|
||
if rtconfig.ARCH == 'arm': | ||
if re.match('^cortex-m.*', rtconfig.CPU): | ||
src += ['arch/invokeNative_thumb.s'] | ||
elif re.match('^cortex-a.*', rtconfig.CPU): | ||
src += ['arch/invokeNative_arm.s'] | ||
|
||
CPPPATH = [cwd, cwd + '/../include'] | ||
|
||
group = DefineGroup('iwasm_common', src, depend = [''], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
|
||
src = Split(''' | ||
wasm_runtime.c | ||
''') | ||
|
||
if GetDepend(['WAMR_BUILD_FAST_INTERP']): | ||
src += ["wasm_interp_fast.c"] | ||
else: | ||
src += ["wasm_interp_classic.c"] | ||
|
||
if GetDepend(['WAMR_BUILD_MINI_LOADER']): | ||
src += ["wasm_mini_loader.c"] | ||
else: | ||
src += ["wasm_loader.c"] | ||
|
||
|
||
CPPPATH = [cwd] | ||
|
||
group = DefineGroup('iwasm_interpreter', src, depend = [''], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
|
||
src = Split(''' | ||
libc_pthread_wrapper.c | ||
''') | ||
|
||
CPPPATH = [cwd] | ||
|
||
|
||
group = DefineGroup('iwasm_libc_pthread', src, depend = [''], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Copyright (c) 2021, RT-Thread Development Team | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
|
||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
|
||
#src = Split(''' | ||
#libc_builtin_wrapper.c | ||
#''') | ||
|
||
src = Glob('*.c') | ||
|
||
CPPDEFINES = ['WASM_ENABLE_LIBC_BUILTIN=1'] | ||
|
||
CPPPATH = [cwd] | ||
|
||
|
||
group = DefineGroup('iwasm_libc_builtin', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) | ||
|
||
Return('group') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add license header for all files, for the new file, you might claim the copyright to yourself and set license to "Apache-2.0 WITH LLVM-exception", please ref to other file submitted by community developer, e.g. nuttx_platform.c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have add license header to files I added, please check it.