From d50b4fdd85b439d75a651d33b0020929ee519f67 Mon Sep 17 00:00:00 2001 From: Jaeyun Date: Wed, 28 Sep 2022 16:03:21 +0900 Subject: [PATCH] [Doc] build-test on TizenRT Add make file and document to run build-test on TizenRT. Signed-off-by: Jaeyun --- tools/build_TizenRT/Kconfig | 13 ++++ tools/build_TizenRT/Make.defs | 55 +++++++++++++++ tools/build_TizenRT/Makefile | 123 ++++++++++++++++++++++++++++++++++ tools/build_TizenRT/README.md | 70 +++++++++++++++++++ 4 files changed, 261 insertions(+) create mode 100644 tools/build_TizenRT/Kconfig create mode 100644 tools/build_TizenRT/Make.defs create mode 100644 tools/build_TizenRT/Makefile create mode 100644 tools/build_TizenRT/README.md diff --git a/tools/build_TizenRT/Kconfig b/tools/build_TizenRT/Kconfig new file mode 100644 index 0000000..796fbe4 --- /dev/null +++ b/tools/build_TizenRT/Kconfig @@ -0,0 +1,13 @@ +# +# For a description of the syntax of this configuration file, +# see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt +# + +config NNSTREAMER_EDGE + bool "nnstreamer-edge library" + default n + ---help--- + Enables the nnstreamer-edge library. + nnstreamer-edge provides interfaces to support data connection and + AI offloading feature between edge devices. + See https://github.com/nnstreamer/nnstreamer-edge for the details. diff --git a/tools/build_TizenRT/Make.defs b/tools/build_TizenRT/Make.defs new file mode 100644 index 0000000..3868c86 --- /dev/null +++ b/tools/build_TizenRT/Make.defs @@ -0,0 +1,55 @@ +########################################################################### +# +# Copyright 2022 Samsung Electronics All Rights Reserved. +# +# Licensed 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. +# +########################################################################### +# external/nnstreamer-edge/Make.defs +# Adds selected applications to external/ build +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_NNSTREAMER_EDGE),y) +CONFIGURED_EXT += nnstreamer-edge +endif diff --git a/tools/build_TizenRT/Makefile b/tools/build_TizenRT/Makefile new file mode 100644 index 0000000..63aef0b --- /dev/null +++ b/tools/build_TizenRT/Makefile @@ -0,0 +1,123 @@ +########################################################################### +# +# Copyright 2022 Samsung Electronics All Rights Reserved. +# +# Licensed 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. +# +########################################################################### +############################################################################ +# external/nnstreamer-edge/Makefile +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/.config +-include $(TOPDIR)/Make.defs + +ASRCS = +CSRCS = src/libnnstreamer-edge/nnstreamer-edge-data.c \ + src/libnnstreamer-edge/nnstreamer-edge-event.c \ + src/libnnstreamer-edge/nnstreamer-edge-internal.c \ + src/libnnstreamer-edge/nnstreamer-edge-metadata.c \ + src/libnnstreamer-edge/nnstreamer-edge-queue.c \ + src/libnnstreamer-edge/nnstreamer-edge-util.c + +CFLAGS += -I ./include + +# TODO Include sources - Paho MQTT and AITT library. +# Paho MQTT library +# CSRCS += nnstreamer-edge-mqtt.c +# CFLAGS += -DENABLE_MQTT=1 +# AITT library +# CSRCS += nnstreamer-edge-aitt.c +# CFLAGS += -DENABLE_AITT=1 + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\libexternal$(LIBEXT) +else +ifeq ($(WINTOOL),y) + BIN = ..\\libexternal$(LIBEXT) +else + BIN = ../libexternal$(LIBEXT) +endif +endif + +DEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built +.PHONY: depend clean distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + $(call ARCHIVE, $(BIN), $(OBJS)) + $(Q) touch .built + +.depend: Makefile $(SRCS) + $(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ + +depend: .depend + +clean: + $(call DELFILE, .built) + $(call CLEAN) + +distclean: clean + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/tools/build_TizenRT/README.md b/tools/build_TizenRT/README.md new file mode 100644 index 0000000..a6dc523 --- /dev/null +++ b/tools/build_TizenRT/README.md @@ -0,0 +1,70 @@ +# Build test on TizenRT + +You should setup the environment to build TizenRT. +See [TizenRT](https://github.com/Samsung/TizenRT) for the details. + + +## How to run build-test + +``` +TizenRT + -- build + -- configs + -- artik053 + -- st_things + -- defconfig << add config (CONFIG_NNSTREAMER_EDGE=y) + -- tc + -- defconfig << add config (CONFIG_NNSTREAMER_EDGE=y) + -- artik055s + -- audio + -- defconfig << add config (CONFIG_NNSTREAMER_EDGE=y) + (extra config for each build target) + -- external + -- nnstreamer-edge << clone nnstreamer-edge sources under 'external' directory + -- os + -- tools + -- build_test.sh << update build_targets +``` + + +Below is an example to run build-test on TizenRT. + +1. Download sources, prepare build-test. + +``` +# clone TizenRT and nnstreamer-edge +$ git clone https://github.com/Samsung/TizenRT.git +$ git clone https://github.com/nnstreamer/nnstreamer-edge.git ./TizenRT/external/nnstreamer-edge + +# copy make file to nnstreamer-edge directory +$ cp ./TizenRT/external/nnstreamer-edge/tools/build_TizenRT/* ./TizenRT/external/nnstreamer-edge +``` + +2. Set build target, update configuration and related sources before running build-test. + + *NOTE: To get the build logs, block rm command at the end of the script 'build_test.sh'. + +``` +# Update build_targets (TizenRT/os/tools/build_test.sh). +build_targets=( + "artik055s/audio" + "artik053/st_things" + "artik053/tc" + "qemu/build_test" + "imxrt1020-evk/loadable_elf_apps" + "imxrt1050-evk/loadable_elf_apps" + "rtl8721csm/hello" + "rtl8721csm/loadable_apps" + "rtl8721csm/tc" +) + +# Add configuration (TizenRT/build/configs//defconfig). +CONFIG_NNSTREAMER_EDGE=y +``` + +3. Run build-test. +``` +$ cd ./TizenRT/os +$ ./dbuild.sh menu +# Select 't' for build-test, you can find build-test result under 'TizenRT/os/tools/build_test' directory. +``` -- 2.34.1