xiaoxiang781216 commented on code in PR #1609:
URL: https://github.com/apache/nuttx-apps/pull/1609#discussion_r1126735589


##########
interpreters/wamr/Toolchain.defs:
##########
@@ -0,0 +1,149 @@
+############################################################################
+# apps/interpreters/wamr/Toolchain.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+# Wasm32 toolchain setting
+# Target: wasm32-unknown-wasi
+
+WCC ?= $(WASI_SDK_PATH)/bin/clang

Review Comment:
   why make wasm32 specific to wamr runtime?



##########
interpreters/Wasm.mk:
##########
@@ -0,0 +1,68 @@
+############################################################################
+# apps/interpreters/Wasm.mk
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+ifeq ($(WASM_BUILD),y)
+  ifneq ($(CONFIG_INTERPRETERS_WAMR)$(CONFIG_INTERPRETERS_WAMR3),)
+
+WASM_INITIAL_MEMORY ?= 65536
+STACKSIZE           ?= $(CONFIG_DEFAULT_TASK_STACKSIZE)
+PRIORITY            ?= SCHED_PRIORITY_DEFAULT
+
+# Wamr mode:
+# INT: Interpreter (Default)
+# AOT: Ahead-of-Time
+# XIP: Execution In Place
+# JIT: Just In Time
+
+WAMR_MODE       ?= INT
+
+# WebAssembly Micro Runtime Toolchain Setting
+
+-include $(APPDIR)$(DELIM)interpreters$(DELIM)wamr$(DELIM)Toolchain.defs
+
+# Targets follow
+
+.PRECIOUS: $(WBIN)
+
+WSRCS := $(MAINSRC) $(CSRCS)
+WOBJS := $(WSRCS:%.c=%.wo)
+
+all:: $(WBIN)
+
+$(WOBJS): %.wo : %.c
+       $(Q) $(WCC) $(WCFLAGS) -c $^ -o $@
+
+$(WBIN): $(WOBJS)
+       $(shell mkdir -p $(APPDIR)/wasm)
+       $(Q) $(WAR) $@ $(filter-out $(MAINSRC:%.c=%.wo),$^)
+       $(foreach main,$(MAINSRC), \
+         $(eval mainindex=$(strip $(call GETINDEX,$(main),$(MAINSRC)))) \
+         $(eval dstname=$(shell echo $(main:%.c=%.wo) | sed -e 's/\//_/g')) \
+         $(shell cp -rf $(strip $(main:%.c=%.wo)) \
+           $(strip $(APPDIR)/wasm/$(word 
$(mainindex),$(PROGNAME))#$(WASM_INITIAL_MEMORY)#$(STACKSIZE)#$(PRIORITY)#$(WAMR_MODE)#$(dstname))
 \

Review Comment:
   why not use the similar approach like the native c instead developing the 
total different approach



##########
interpreters/wamr/Toolchain.defs:
##########
@@ -0,0 +1,149 @@
+############################################################################
+# apps/interpreters/wamr/Toolchain.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+# Wasm32 toolchain setting
+# Target: wasm32-unknown-wasi
+
+WCC ?= $(WASI_SDK_PATH)/bin/clang
+WAR ?= $(WASI_SDK_PATH)/bin/llvm-ar rcs
+WRC ?= wamrc
+WSYSROOT ?= $(TOPDIR)
+
+CFLAGS_STRIP = -fsanitize=kernel-address -fsanitize=address 
-fsanitize=undefined
+CFLAGS_STRIP += $(ARCHCPUFLAGS) $(ARCHCFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) 
$(ARCHOPTIMIZATION) $(EXTRAFLAGS)
+
+WCFLAGS += $(filter-out $(CFLAGS_STRIP),$(CFLAGS))
+WCFLAGS += --sysroot=$(WSYSROOT) -nostdlib -D__NuttX__
+
+WLDFLAGS = -z stack-size=$(STACKSIZE) -Wl,--initial-memory=$(INITIAL_MEMORY)
+WLDFLAGS += -Wl,--export=main -Wl,--export=__main_argc_argv
+WLDFLAGS += -Wl,--export=__heap_base -Wl,--export=__data_end
+WLDFLAGS += -Wl,--no-entry -Wl,--strip-all -Wl,--allow-undefined
+
+ifeq ($(CONFIG_ARCH_ARM),y)
+  ifeq ($(CONFIG_ARM_THUMB),y)
+    WTARGET = thumb

Review Comment:
   why not define this in nuttx/arch/*/Toolchain.defs



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to