[Docs] Replace documentation
authorDongju Chae <dongju.chae@samsung.com>
Mon, 8 Feb 2021 04:15:02 +0000 (13:15 +0900)
committer채동주/On-Device Lab(SR)/Staff Engineer/삼성전자 <dongju.chae@samsung.com>
Tue, 9 Feb 2021 04:33:02 +0000 (13:33 +0900)
This patch replaces documentation with the hotdoc-enabled one.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
26 files changed:
README.md
doc/hotdoc/gen-hotdoc.sh [deleted file]
doc/hotdoc/index.md [deleted file]
doc/hotdoc/sitemap.txt [deleted file]
doc/hotdoc/theme/extra/css/extra_frontend.css [deleted file]
doc/hotdoc/theme/extra/templates/navbar_links.html [deleted file]
doc/how_to_build.md [deleted file]
doc/how_to_test.md [deleted file]
doc/how_to_use.md [deleted file]
docs/gen-hotdoc.sh [new file with mode: 0755]
docs/markdown/Artifactory.md [new file with mode: 0644]
docs/markdown/Debugging.md [moved from doc/how_to_debug.md with 83% similarity]
docs/markdown/Examples.md [moved from doc/usage_examples.md with 82% similarity]
docs/markdown/FastModels.md [new file with mode: 0644]
docs/markdown/GettingStarted.md [new file with mode: 0644]
docs/markdown/Installing.md [new file with mode: 0644]
docs/markdown/PetaLinux.md [new file with mode: 0644]
docs/markdown/QuickStart.md [new file with mode: 0644]
docs/markdown/SPIN.md [new file with mode: 0644]
docs/markdown/Ubuntu.md [new file with mode: 0644]
docs/markdown/index.md [new file with mode: 0644]
docs/sitemap.txt [new file with mode: 0644]
docs/theme/extra/templates/navbar_center.html [new file with mode: 0644]
docs/theme/extra/templates/navbar_links.html [new file with mode: 0644]
include/common/npubinfmt.h
src/host/ne-host.cc

index ee39911..54ef2de 100644 (file)
--- a/README.md
+++ b/README.md
@@ -22,39 +22,11 @@ NPU_SystemService/    Root directory
 |   `-- utils         Source files for Test Utils
 |-- packaging/        Tizen Packaging Files (i.e., FastModel Simulator)
 |-- debian/           Debian Packaging Files (i.e., Ubuntu 16.04)
-`-- doc/              Documentation
+`-- docs/             Documentation using hotdoc
 ```
 
-## Getting Started: [official documents](https://github.sec.samsung.net/pages/AIP/NPU_DDK_DOCS)
-- How to setup your own FastModel enviornment (in Ubuntu 16.04 running on your host PC): press [here](https://github.sec.samsung.net/AIP/NPU_bootstrap/blob/master/README.md)
-- How to build the NPU Engine library (FastModel or Ubuntu): press [here](/doc/how_to_build.md)
-- How to test NPU-DDK packages on FastModel: press [here](/doc/how_to_test.md)
-- How to use the NPU Engine library in user apps: press [here](/doc/how_to_use.md)
-- How to debug your apps using the NPU Engine library: press [here](/doc/how_to_debug.md)
-- Usage examples using the NPU Engine library: press [here](/doc/usage_examples.md)
-- NPU Engine-enabled bootable images for an FPGA board: press [here](https://github.sec.samsung.net/AIP/meta-trinity/blob/master/README.md)
-
-## Quick-start Guide using Docker
-- Docker images (xenial, bionic) images from [Artifactory](https://art.sec.samsung.net/artifactory/webapp/#/home)
-- Trinity NPU simulation by [libmrpsim](https://github.sec.samsung.net/AIP/SIM_TrinityVision2/tree/master/mRPsim)
-```
-$ sudo apt install docker.io
-$ sudo docker pull art.sec.samsung.net/aip_docker/n2s2_docker/xenial
-$ sudo docker run -i -t art.sec.samsung.net/aip_docker/n2s2_docker/xenial /bin/bash
-
-root# ls /opt/trinity/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
-input_fmap_0.bin  model.tvn  output_fmap_0.bin
-
-root# apptest_tvn_triv2 /opt/trinity/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
->>> Initializaing SPM with zero. It can be time-consuming...
->>> Initializaing SPM with zero. It can be time-consuming...
-[Core Name: NPCore0], [File Name: /opt/trinity/share/mRPsim/decoder-triv2-emul.bin], [Ver: 1]
-        Section(.SRP.FLIH) Base (22000000) Size(36)
-...
-[APPTEST] apptest_tvn_triv2: PASSED
-
-root# exit
-```
+## Getting Started
+- [AIP/NPU_DDK_DOCS](https://github.sec.samsung.net/pages/AIP/NPU_DDK_DOCS): Official documents generated by hotdoc
 
 ## Related Projects
 - [AIP/NPU_Linux-kernel](https://github.sec.samsung.net/AIP/NPU_Linux-kernel): Linux kernel image and drivers (on FastModel simulator)
diff --git a/doc/hotdoc/gen-hotdoc.sh b/doc/hotdoc/gen-hotdoc.sh
deleted file mode 100755 (executable)
index 36aaa35..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-echo "Generate NPU-Engine documents"
-
-v=$( grep -w version: meson.build | head -n 1 | perl -pe 'if(($v)=/([0-9]+([.][0-9]+)+)/){print"$v\n";exit}$_=""' )
-deps_file_path="$(pwd)/doc/npu-endine.deps"
-
-echo "NPU-Engine version: $v"
-echo "Dependencies file path: $deps_file_path"
-
-hotdoc run -i index.md -o doc/npu-engine-doc \
-       --sitemap=doc/hotdoc/sitemap.txt \
-       --deps-file-dest=$deps_file_path \
-       --html-extra-theme=doc/hotdoc/theme/extra \
-       --project-name=NPU-Engine --project-version=$v
diff --git a/doc/hotdoc/index.md b/doc/hotdoc/index.md
deleted file mode 100644 (file)
index 1a94a55..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: Documents
-...
-
-# NPU-Engine Documents
-
-The following sections introduce a series of tutorials designed to help
-you learn how to use NPU-Engine.
diff --git a/doc/hotdoc/sitemap.txt b/doc/hotdoc/sitemap.txt
deleted file mode 100644 (file)
index 16181ca..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-index.md
-       doc/hotdoc/index.md
-               doc/how_to_build.md
-               doc/how_to_use.md
-               doc/how_to_test.md
-               doc/how_to_debug.md
-               doc/usage_examples.md
diff --git a/doc/hotdoc/theme/extra/css/extra_frontend.css b/doc/hotdoc/theme/extra/css/extra_frontend.css
deleted file mode 100644 (file)
index 3cb56ea..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-h1, h2, h2, h3, h4, h5 {
-  font-weight: 300;
-}
-
-.hotdoc-navbar-brand {
-  font-weight: 700;
-  text-transform: uppercase;
-  font-size: 70%;
-  color: black;
-}
-
-.page-header {
-  text-align: center;
-  font-weight: 300;
-  padding: 100px 15px;
-}
-
-.page-header h1, .page-header h2 {
-  margin-bottom: 1em;
-}
-
-.page-header p {
-  margin-left: auto;
-  margin-right: auto;
-  max-width: 80%;
-  font-size: 18px;
-}
-
-.btn-xl {
-  padding: 15px 30px;
-}
-
-.toned-row {
-  background-color: #dfdfdf;
-  margin: 3em -15px 3em -15px;
-  padding: 3em;
-  text-align: center;
-}
-
-.toned-row a.icon {
-  display: inline-block;
-  width: 92px;
-  height: 92px;
-  background-repeat: no-repeat;
-  background-position: center;
-  background-size: 64px;
-  padding-top: 92px;
-  cursor: pointer;
-  font-size: 90%;
-  transition: 500ms color ease-in-out;
-}
diff --git a/doc/hotdoc/theme/extra/templates/navbar_links.html b/doc/hotdoc/theme/extra/templates/navbar_links.html
deleted file mode 100644 (file)
index 2549edc..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-@require(page)
-
-<li class="dropdown">
-  <a class="dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-    API References<span class="caret"></span>
-  </a>
-  <ul class="dropdown-menu" id="modules-menu">
-    @for tup in (("doc/hotdoc/index.html","NPU-Engine doc"),):
-    <li>
-      <a href="@tup[0]">@tup[1]</a>
-    </li>
-    @end
-</li>
-
-<li>
-  <a href="doc/hotdoc/index.html">Documents</a>
-</li>
diff --git a/doc/how_to_build.md b/doc/how_to_build.md
deleted file mode 100644 (file)
index 9162641..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
----
-title: How to build
-...
-
-# How to build NPU Engine library
-
-The NPU Engine's primary target is the FastModel/AArch64 environment.
-However, we also support other architecture (i.e., x86_64, armv7l) and host PC (i.e., ubuntu 16.04) for fast development/testing purpose.
-This page describes how to build the NPU Engine in each environment.
-
-Of course, we provide official packages for each environment.
-We STRONGLY recommend to install them.
-
-Also, before accessing the packages, you need to get the access permission for SPIN repository. Please refer to [here](https://code.sec.samsung.net/confluence/display/NEWCOMM/SPIN+Request+Process).
-
-**FastModel (aarch64)**: Please refer to [here](https://github.sec.samsung.net/AIP/NPU_bootstrap/blob/master/README.md) about how to setup FastModel.
-``` bash
-$ taos-mgr refresh
-$ taos-mgr install npu-engine
-```
-**Ubuntu 16.04 (x86_64)**
-``` bash
-$ sudo echo "deb [trusted=yes] http://10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools/Ubuntu_16.04 /" | sudo tee /etc/apt/sources.list.d/spin.list
-$
-$ cat /etc/apt/auth.conf.d/spin.conf
-machine 10.113.136.32
-login [YOUR_SPIN_ACCOUNT]
-password [YOUR_SPIN_PW]
-$
-$ sudo apt-get update
-$ sudo apt-get install npu-engine
-```
-
-Also, to test your installation of `npu-engine`, you may install `npu-engine-example` and `npu-engine-testdata`, too.
-
-## FastModel (aarch64/armv7l/x86_64)
-We use a Tizen-based operating system, TAOS, running on the FastModel simulator. 
-So, you first need to configure `.gbs.conf` to use a tizen build system, `gbs`.
-It will generate `.rpm` files that can be installed in the FastModel simulator.
-
-Here is the example `~/.gbs.conf`, which works perfectly. Of course, you can reuse your own.
-But, please make sure that the spin repository, `[repo.spin]`, is properly configured because we are releasing all necessary packages into the repository.
-```bash
-[general]
-profile = profile.tizen
-tmpdir = /var/tmp
-editor = vim
-packaging_branch = tizen
-workdir = .
-
-[profile.tizen]
-repos = repo.spin, repo.base, repo.unified
-buildroot = ~/GBS-ROOT/
-
-[repo.spin]
-url = http://10.113.136.32/download_trbs/snapshots/devel/tizen-6.0-ai/latest/repos/Tizen_Unified_standard/packages/
-user = [YOUR_SPIN_ACCOUNT]
-passwd = [YOUR_SPIN_PW]
-
-[repo.base]
-url = http://download.tizen.org/snapshots/tizen/base/latest/repos/standard/packages/
-[repo.unified]
-url = http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/
-```
-
-Now, type the gbs build command with specified architecture. Note that you may use `--include-all` to apply your uncommitted updates, and optionally `--clean` to erase stale build information.
-```bash
-$ gbs build -A [aarch64/armv7l/x86_64] --include-all --clean
-```
-
-Lastly, we can find the `.rpm` files in the GBS root directory.
-```bash
-$ ls ~/GBS-ROOT/local/repos/tizen/aarch64/RPMS/
-```
-
-## Ubuntu 16.04 (x86_64)
-
-We assume you are using Ubuntu 16.04 (x86_64) as a host OS. If not, you may use virtualized system such as VirtualBox or Docker service.
-
-To build NPU Engine manually, you may use `pbuilder`, the gbs-like build system in a debian-based Linux.
-Thus, you first need to configure pbuilder, `pbuilderrc`.
-
-Here is the example `~/.pbuilderrc`. Please make sure the SPIN repository (`10.113.136.32`) is properly configured.
-
-```bash
-MIRRORSITE=http://ftp.daumkakao.com/ubuntu/
-DISTRIBUTION=xenial
-OTHERMIRROR="deb http://archive.ubuntu.com/ubuntu xenial universe multiverse | deb [trusted=yes] http://[YOUR_SPIN_ACCOUNT]:[YOUR_SPIN_PW]@10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools/Ubuntu_16.04/ /"
-```
-
-Then, you can create the target root image for pbuilder.
-```bash
-$ sudo DIST=xenial pbuilder create
-$ sudo DIST=xenial pbuilder update
-```
-
-Now, let's build NPU Engine using pbuilder. you can find the packages in `/var/cache/pbuilder/result` and install them.
-```bash
-$ cd NPU_SystemService
-$ sudo pdebuild
-... [a few minutes] ...
-$ cd /var/cache/pbuilder/result
-$ sudo dpkg -i npu-engine*
-```
diff --git a/doc/how_to_test.md b/doc/how_to_test.md
deleted file mode 100644 (file)
index 08f6af7..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
----
-title: How to test
-...
-
-# How to test the NPU DDK in FastModel simulator
-
-## Prerequisites
-
-### 1. Prepare a Ubuntu 16.04 Desktop or Server
-The FastModel simulator does not offically support other Ubuntu distributions.
-
-### 2. Append the SPIN repository to your apt source list
-```
-$ sudo echo "deb [trusted=yes] http://10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools/Ubuntu_16.04 /" | sudo tee /etc/apt/sources.list.d/spin.list
-
-$ cat /etc/apt/auth.conf.d/spin.conf
-machine 10.113.136.32
-login [YOUR_SPIN_ACCOUNT]
-password [YOUR_SPIN_PW]
-```
-If you don't have a SPIN account, please refer to [here](https://code.sec.samsung.net/confluence/display/NEWCOMM/SPIN+Account+Creation+Process).
-
-### 3. Install NPU bootstrap packages
-```
-$ sudo apt update
-$ sudo apt install npu-bootstrap-fm
-
-$ dpkg -l | grep npu-bootstrap-fm
-ii  npu-bootstrap-fm                       2.2.2  amd64  Boootstrap Package for ARM Cortex-A53x4-based NPU FM simulator
-ii  npu-bootstrap-fm-arm-tf                2.2.2  amd64  ARM Trusted Firmware
-ii  npu-bootstrap-fm-linux-fvp-initrd-dtb  2.2.2  amd64  DTB (initrd) for the Linux Kernel on Cortex-A53x4 Base Platform FVP
-ii  npu-bootstrap-fm-ramdisk               2.2.2  amd64  BusyBox-based AArch64 Linux RAMDisk Image
-```
-
-### 4. Download your root image
-
-Please replace `YOUR_ID` and `YOUR_PW` to your account info.
-```
-$ cd /opt/trinity
-$ sed -i 's/\[SPIN_ACCOUNT_ID\]/YOUR_ID/g' get_taos
-$ sed -i 's/\[SPIN_ACCOUNT_PW\]/YOUR_PW/g' get_taos
-$ sudo ./get_taos
-$ ls ROOTFS.img
-ROOTFS.img
-```
-
-## Start FastModel simulation and install NPU DDK packages
-
-### 1. Run the FastModel simulator
-
-First of all, please make sure `ARMLMD_LICENSE_FILE` is exported.
-We recommend you to add this in your `~/.bashrc`.
-
-```
-$ vi ~/.bashrc
-export ARMLMD_LICENSE_FILE=8224@10.113.242.30
-$ source ~/.bashrc
-```
-
-We provide a script to run the FastModel simulator.
-```
-$ cd /opt/trinity
-$ ./run_taos
-```
-
-### 2. Connect the FastModel's internal shell in another terminal
-```
-$ telnet localhost 5000
-Trying 127.0.0.1...
-Connected to localhost.
-Escape character is '^]'.
-
-sh-3.2#
-sh-3.2# ls
-bin   dev  init  lib64       mnt   root  sbin  tmp  var
-boot  etc  lib   lost+found  proc  run   sys   usr
-```
-
-### 3. Install NPU DDK packages
-```
-sh-3.2# taos-mgr refresh
-sh-3.2# taos-mgr install npu-engine npu-engine-example npu-engine-testdata
-
-sh-3.2# ls /usr/lib64 | grep npu-engine
-libnpu-engine.a
-libnpu-engine.so
-
-sh-3.2# ls /usr/lib64/npu-engine/bin
-apptests  unittests
-
-sh-3.2# ls /usr/share/npu-engine/testdata/TRIV223_2TOPS
-ADD_000               CONV_2D_300_D2    INCEPTION_V3         MOBILENET_V1
-ADD_001               CONV_2D_300_D3    MAX_POOL_2D_000      MOBILENET_V2
-ADD_600               CONV_2D_301       MAX_POOL_2D_001      NET_CONV_DCONV_600
-ADD_6WC               CONV_2D_302       MAX_POOL_2D_002      NET_RESHAPE_000
-AVERAGE_POOL_2D_000   CONV_2D_600       MAX_POOL_2D_301      NET_RESHAPE_001
-...
-```
-
-## Execute NPU DDK's UnitTests and AppTests (in the FastModel's shell)
-
-### 1. Run UnitTests
-```
-sh-3.2# ls /usr/lib64/npu-engine/bin/unittests
-unittest_ne_core_buffer        unittest_ne_core_model
-unittest_ne_core_comm          unittest_ne_core_npu
-unittest_ne_core_handler       unittest_ne_core_sched
-unittest_ne_core_hwmem         unittest_ne_core_segment_table
-unittest_ne_core_inf           unittest_ne_core_thread_pool
-unittest_ne_core_inputservice  unittest_ne_core_utils
-unittest_ne_core_mem
-
-sh-3.2# cd /usr/lib64/npu-engine/bin/unittests
-
-sh-3.2# ./unittest_ne_core_npu
-[==========] Running 18 tests from 1 test case.
-[----------] Global test environment set-up.
-[----------] 18 tests from ne_core_npu_test
-[ RUN      ] ne_core_npu_test.get_num_devices
-[       OK ] ne_core_npu_test.get_num_devices (59 ms)
-[ RUN      ] ne_core_npu_test.get_num_devices_n
-[       OK ] ne_core_npu_test.get_num_devices_n (0 ms)
-[       OK ] ne_core_npu_test.check_dev_status_triv (36 ms)
-[ RUN      ] ne_core_npu_test.check_dev_status_triv2
-[       OK ] ne_core_npu_test.check_dev_status_triv2 (138 ms)
-[ RUN      ] ne_core_npu_test.check_dev_status_triv2_n
-[       OK ] ne_core_npu_test.check_dev_status_triv2_n (22 ms)
-[ RUN      ] ne_core_npu_test.create_instance_uninitialized_n
-[       OK ] ne_core_npu_test.create_instance_uninitialized_n (14 ms)
-[ RUN      ] ne_core_npu_test.manage_mem_triv2
-[       OK ] ne_core_npu_test.manage_mem_triv2 (24 ms)
-[ RUN      ] ne_core_npu_test.manage_mem_triv2_n
-[       OK ] ne_core_npu_test.manage_mem_triv2_n (22 ms)
-[ RUN      ] ne_core_npu_test.set_model_data_n
-[       OK ] ne_core_npu_test.set_model_data_n (44 ms)
-[ RUN      ] ne_core_npu_test.set_input_data_n
-[       OK ] ne_core_npu_test.set_input_data_n (44 ms)
-[ RUN      ] ne_core_npu_test.run_inference_triv2
-[       OK ] ne_core_npu_test.run_inference_triv2 (23 ms)
-[ RUN      ] ne_core_npu_test.run_inference_async0_triv2
-[       OK ] ne_core_npu_test.run_inference_async0_triv2 (25 ms)
-[ RUN      ] ne_core_npu_test.run_inference_async1_triv2
-[       OK ] ne_core_npu_test.run_inference_async1_triv2 (23 ms)
-[ RUN      ] ne_core_npu_test.run_inference_triv2_n
-[       OK ] ne_core_npu_test.run_inference_triv2_n (23 ms)
-[----------] 18 tests from ne_core_npu_test (597 ms total)
-
-[----------] Global test environment tear-down
-[==========] 18 tests from 1 test case ran. (598 ms total)
-[  PASSED  ] 18 tests.
-
-sh-3.2# ./unittest_ne_core_buffer
-...
-```
-
-### 2. Run AppTests
-```
-sh-3.2# cd /usr/lib64/npu-engine/bin/apptests
-
-sh-3.2# ./apptest_tvn_triv2 /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
-[APPTEST] ./apptest_tvn_triv2: PASSED
-
-sh-3.2#$ ./apptest_tvn_triv2_bulk /usr/share/npu-engine/testdata/TRIV223_2TOPS
-[APPTEST] ADD_000         Running... PASSED
-[APPTEST] ADD_001         Running... PASSED
-...
-[APPTEST] PRELU_000       Running... PASSED
-[APPTEST] RESNET_V1_50    Running... PASSED
-[APPTEST] ./apptest_tvn_triv2_bulk: PASSED (41/41)
-
-sh-3.2# ./apptest_tvn_triv2_recurring -l 5 /usr/share/npu-engine/testdata/TRIV223_2TOPS/ADD_000 /dev/triv2-0
-[ 1/ 5].......done
-[ 2/ 5].......done
-[ 3/ 5].......done
-[ 4/ 5].......done
-[ 5/ 5].......done
-[APPTEST] ./apptest_tvn_triv2_recurring: PASSED
-```
-
-### 3. Run models with the ML API (NNStreamer)
-```
-sh-3.2# taos-mgr install npu-engine-testdata nnstreamer-srnpu gstreamer-utils
-
-sh-3.2# ls /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
-input_fmap_0.bin  model.tvn  output_fmap_0.bin
-
-sh-3.2# cd /usr/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
-
-sh-3.2# gst-launch-1.0 filesrc location=input_fmap_0.bin blocksize=-1 \
-        ! application/octet-stream ! tensor_converter input-dim=1:224:224:3 input-type=uint8 \
-        ! tensor_filter framework=srnpu-triv2 model=model.tvn \
-          input=1:224:224:3 inputtype=uint8 output=1:1:1:1000 outputtype=uint8 \
-        ! filesink location=result_fmap_0.bin
-Setting pipeline to PAUSED ...
-Pipeline is PREROLLING ...
-Pipeline is PREROLLED ...
-Setting pipeline to PLAYING ...
-New clock: GstSystemClock
-Got EOS from element "pipeline0".
-Execution ended after 0:00:00.001972310
-Setting pipeline to PAUSED ...
-Setting pipeline to READY ...
-Setting pipeline to NULL ...
-Freeing pipeline ...
-
-sh-3.2# toybox diff result_fmap_0.bin output_fmap_0.bin
-```
diff --git a/doc/how_to_use.md b/doc/how_to_use.md
deleted file mode 100644 (file)
index 94d9421..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
----
-title: How to use
-...
-
-# How to link the NPU Engine library to your application
-
-First of all, we provide both `.rpm` and `.deb` packages for the NPU Engine library.
-Even in non-FastModel enviornment, NPU Engine can execute NPU models with emulations to get correct outputs. So, You can use either one which is convinent to you.
-
-Also, before accessing the packages, you need to get the access permission for SPIN repository. Please refer to [here](https://code.sec.samsung.net/confluence/display/NEWCOMM/SPIN+Request+Process).
-
-## FastModel (AArch64)
-
-NPU Engine (NE) is being built using `gbs build`, and its latest release is uploaded to the SPIN repository.
-To use the NPU Engine library in the FastModel, please install the package with the below command (See [here](https://github.sec.samsung.net/AIP/NPU_bootstrap/blob/master/README.md) for details).
-```bash
-$ taos-mgr install npu-engine
-$ ls /usr/lib64/npu-engine/lib
-libnpu-engine.so libnpu-engine.a
-```
-
-To easily link the NPU Engine to your application, we recommend you also to use `gbs` build. Please make sure your `~/.gbs.conf` contains the SPIN repository like:
-```bash
-[repo.spin]
-url = http://10.113.136.32/download_trbs/snapshots/devel/tizen-6.0-ai/latest/repos/Tizen_Unified_standard/packages/
-user = [YOUR_SPIN_ACCOUNT]
-passwd = [YOUR_SPIN_PW]
-```
-Here is the example `~/.gbs.conf`, which works perfectly.
-```bash
-[general]
-profile = profile.tizen
-tmpdir = /var/tmp
-editor = vim
-packaging_branch = tizen
-workdir = .
-
-[profile.tizen]
-repos = repo.spin, repo.base, repo.unified
-buildroot = ~/GBS-ROOT/
-
-[repo.spin]
-url = http://10.113.136.32/download_trbs/snapshots/devel/tizen-6.0-ai/latest/repos/Tizen_Unified_standard/packages/
-user = [YOUR_SPIN_ACCOUNT]
-passwd = [YOUR_SPIN_PW]
-
-[repo.base]
-url = http://download.tizen.org/snapshots/tizen/base/latest/repos/standard/packages/
-[repo.unified]
-url = http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/
-
-
-```
-Then, to link the NE library, please append the dependency declaration for NPU Engine into your build script.
-For example, `BuildRequires: npu-engine-devel` is required in `packaging/[app-name].spec` for `gbs build`.
-
-For the detailed example for packaging, please refer to [here](https://github.sec.samsung.net/dongju-chae/npu-engine-app).
-
-## Ubuntu 16.04 (x86_64)
-
-When you install `npu-engine*` packages using `apt` command, all files are installed under `/opt/trinity/`
-```bash
-$ sudo echo "deb [trusted=yes] http://10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools/Ubuntu_16.04 /" | sudo tee /etc/apt/sources.list.d/spin.list
-$
-$ cat /etc/apt/auth.conf.d/spin.conf
-machine 10.113.136.32
-login [YOUR_SPIN_ACCOUNT]
-password [YOUR_SPIN_PW]
-$
-$ sudo apt-get update
-$ sudo apt-get install npu-engine npu-engine-devel
-$
-$ ls /opt/trinity/lib
-libnpu-engine.a  libnpu-engine.so pkgconfig
-$ ls /opt/trinity/include
-npu-engine
-$ ls /opt/trinity/etc
-npu-engine.ini
-```
-Note that all logs are printed to the log file specified in `npu-engine.ini` (default: `/tmp/npu-engine.log`).
-
-Then, you can build your application with NPU-Engine library in any convenient way. For example,
-```bash
-$ export PKG_CONFIG_PATH=/opt/trinity/lib/pkgconfig:$PKG_CONFIG_PATH
-$ make `pkg-config npu-engine --cflags --libs`
-```
-
-## How to use NPU Engine APIs inside your application
-After `npu-engine-devel` is successfully installed, your application can access the required header files in the gbs build root (e.g., `~/GBS-ROOT/`) or FastModel emulators.
-The header files NPU Engine provides are as follows:
-```
-libnpuhost.h: The user APIs that NPU Engine provides 
-npubinfmt.h:  The format of NPU model binary
-typedef.h:    The type definitions used in NPU Engine
-```
-Thus, what you need to do is just to include these headers and use the defined APIs in your application. Here are a few APIs that you may use frequently:
-```
-registerNPUmodel():   Register the model data to NPU Engine.
-unregisterNPUmodel(): Unregister the finished model and remove it.
-runNPU_sync():        Execute inference with the registered model in sync mode.
-runNPU_async():       Execute inference with the registered model in async mode. Need an output callback.
-```
-For complete sample codes, please refer to [here](https://github.sec.samsung.net/AIP/NPU_SystemService/tree/tizen/tests/apptests)
diff --git a/docs/gen-hotdoc.sh b/docs/gen-hotdoc.sh
new file mode 100755 (executable)
index 0000000..b7687fc
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+export DOCS_HOME=$(readlink -f $0)
+export DOCS_HOME=$(dirname ${DOCS_HOME})
+export PROJ_HOME=${DOCS_HOME}/..
+export PROJ_NAME="NPU-DDK"
+
+pushd ${DOCS_HOME}
+
+mkdir -p build
+
+VERSION=$( grep -w version: ${PROJ_HOME}/meson.build | head -n 1 | perl -pe 'if(($v)=/([0-9]+([.][0-9]+)+)/){print"$v\n";exit}$_=""' )
+DEPS="build/npu-ddk-docs.deps"
+
+echo "Generate NPU-DDK documents"
+echo "NPU-DDK version: ${VERSION}"
+echo "Dependencies file path: ${DEPS}"
+
+hotdoc run -i markdown/index.md -o build \
+       --sitemap=sitemap.txt \
+       --deps-file-dest=${DEPS} \
+       --html-extra-theme=theme/extra \
+       --project-name=${PROJ_NAME} --project-version=${VERSION}
+
+popd
diff --git a/docs/markdown/Artifactory.md b/docs/markdown/Artifactory.md
new file mode 100644 (file)
index 0000000..f4fb01a
--- /dev/null
@@ -0,0 +1,35 @@
+---
+title: Artifactory
+short-description: Artifactory Debian Repository
+...
+
+# Artifactory Debian Repository
+
+[Artifactory](https://art.sec.samsung.net/artifactory/webapp/#/home) supports Debian repositories which can be accessed by the existing `apt` tool.
+
+## Configuration
+
+First, let's add our repository to your apt source list. If you're using Ubuntu 18.04, replace `xenial` with `bionic`.
+```console
+$ sudo echo "deb [trusted=yes] http://art.sec.samsung.net/artifactory/list/aip_debian xenial universe"\
+    | sudo tee /etc/apt/sources.list.d/artifactory.list
+$ wget -qO - https://art.sec.samsung.net:443/artifactory/api/gpg/key/public | sudo apt-key add -
+$ sudo apt update
+...
+```
+
+## Installation
+
+Then, you can easily download and install our packages in Debian dists.
+Note that all files are installed under `/opt/trinity/`.
+
+```console
+$ sudo apt install npu-engine npu-engine-examples npu-engine-testdata
+...
+$ ls /opt/trinity/lib
+libmrpsim.a  libmrpsim.so  libnpu-engine.so  pkgconfig
+$ ls /opt/trinity/bin
+apptests  unittests
+$ ls /opt/trinity/share/npu-engine/testdata
+TRIV221_8TOPS  TRIV223_2TOPS
+```
similarity index 83%
rename from doc/how_to_debug.md
rename to docs/markdown/Debugging.md
index 3e910ca..6ce2d06 100644 (file)
@@ -1,49 +1,50 @@
 ---
-title: How to debug
+title: Debugging
+short-description: Debugging Guide
 ...
 
-# How to debug your apps using NPU Engine library
+# Debugging Guide
 
 First of all, this guide describe how to quickly debug your apps in host PC (i.e., Ubuntu 16.04), before testing on the FastModel Simulator or FPGA boards.
 
 We currently provide two methods to configure the npu-engine library
 - .ini file (`/opt/trinity/etc/npu-engine.ini` in Ubuntu 16.04)
-- enviroment variables
+- environment variables
 
-## Log messages
+## Log Messages
 Basically, the log messages (especially errors) are printed to a log file. The default log file path is `/tmp/npu-engine.log`. Of course, you can configure this using the two methods.
 
 After modifying .ini file
-``` bash
+```console
 $ sudo sed -i "s|log_dir=.*|log_dir=/home/test/log_dir|" /opt/trinity/etc/npu-engine.ini
 $ ... [run your apps] ...
 ```
 
 After setting the env variable
-``` bash
+```console
 $ export NE_LOG_DIR=/home/test/log_dir
 $ ... [run your apps] ...
 ```
 
-Note that envionment variables have higher priority and we recommend to use them.
+Note that environment variables have higher priority and we recommend to use them.
 
-## Layer-level data dump
+## Layer-level Data Dump
 To check the intermediate input and output data of each layer, you can set `log_verbose` mode
 
 After modifying .ini file
-``` bash
+```console
 $ sudo sed -i "s|log_verbose=.*|log_verbose=true|" /opt/trinity/etc/npu-engine.ini
 $ ... [run your apps] ...
 ```
 
 After setting the env variable
-``` bash
+```console
 $ export NE_LOG_VERBOSE=true
 $ ... [run your apps] ...
 ```
 
 Then, you can find out the dumped input and output data for each layer.
-``` bash
+```console
 $ ls [log_dir]/layer_dump
 layer_0  layer_1  layer_2  layer_3  layer_4 ...
 $
similarity index 82%
rename from doc/usage_examples.md
rename to docs/markdown/Examples.md
index 2270a51..d1e0c7d 100644 (file)
@@ -1,10 +1,11 @@
 ---
 title: Examples
+short-description: Usage Examples
 ...
 
-# NPU Engine Usage Examples
+# Usage Examples
 
-We provide example applications which use the NPU Engline library and its APIs.
+We provide example applications which use the NPU Engine library and its APIs.
 They are good reference codes when you develop your applications using the NPU Engine library.
 Please visit [here](https://github.sec.samsung.net/AIP/NPU_SystemService/tree/tizen/tests/apptests) to get full source codes.
 
@@ -19,9 +20,12 @@ The `npu-engine-example` package contains useful unittests and apptests
 
 **Ubuntu**: `/opt/trinity/bin`
 
-## `npu-engine-testdata` package (from [NPU_SystemService_Testdata](https://github.sec.samsung.net/AIP/NPU_SystemService_Testdata))
+## `npu-engine-testdata` package
 The `npu-engine-testdata` package contains testdata used in some example test programs.
 
+* Repository: [NPU_SystemService_Testdata](https://github.sec.samsung.net/AIP/NPU_SystemService_Testdata)
+* Compiler: [NPU_Compiler](https://github.sec.samsung.net/AIP/NPU_Compiler)
+
 **FastModel**: `/usr/share/npu-engine/testdata`
 
 **Ubuntu**: `/opt/trinity/share/npu-engine/testdata`
@@ -32,7 +36,7 @@ Note that the testdata used here follows the NPU binary format ([npubinfmt.h](ht
 Also, TRIV2 currently works with npubinfmt v3 only.
 
 Let's assume you are testing the application in Ubuntu 16.04/18.04.
-```bash
+```console
 $ sudo apt-get install npu-engine-example npu-engine-testdata
 $ cd /opt/trinity
 $ ./bin/apptests/apptest_tvn_triv2_example share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
diff --git a/docs/markdown/FastModels.md b/docs/markdown/FastModels.md
new file mode 100644 (file)
index 0000000..c4f70e8
--- /dev/null
@@ -0,0 +1,209 @@
+---
+title: FastModels
+short-description: Arm FastModels Simulator
+...
+
+# Getting Started with FastModels
+
+Arm [FastModels](https://developer.arm.com/tools-and-software/simulation-models/fast-models) allows you to develop system software such as drivers, firmware, OS and applications prior to silicon availability.
+
+## Requirements
+
+FastModels officially supports Ubuntu 16.04 (GCC 5.4) and RHEL 7 (GCC 4.8) only. So, we assume that you use `Ubuntu 16.04` distribution.
+Also, you should have a SPIN account to access bootstrap packages. If you don't, please refer to [here](https://code.sec.samsung.net/confluence/display/NEWCOMM/SPIN+Account+Creation+Process)
+
+## Overview of Trinity OS
+
+NPU-DDK provides a Tizen-based OS, `Trinity OS`, image running on the FastModel simulator.
+After configuring the [SPIN](SPIN.md) repository, install `npu-bootstrap-fm`.
+
+```console
+$ sudo apt -y update
+$ sudo apt -y install npu-bootstrap-fm
+$ dpkg -l | grep npu-bootstrap-fm
+ii  npu-bootstrap-fm                       2.2.2  amd64  Bootstrap Package for ARM Cortex-A53x4-based NPU FM simulator
+ii  npu-bootstrap-fm-arm-tf                2.2.2  amd64  ARM Trusted Firmware
+ii  npu-bootstrap-fm-linux-fvp-initrd-dtb  2.2.2  amd64  DTB (initrd) for the Linux Kernel on Cortex-A53x4 Base Platform FVP
+ii  npu-bootstrap-fm-ramdisk               2.2.2  amd64  BusyBox-based AArch64 Linux RAMDisk Image
+$ ls /opt/trinity
+bin  emulator  etc  get_taos  include  lib  npu-bootstrap  npu-scc  run_taos  share
+```
+
+## Getting Root Image
+
+You can download `Trinity OS` as follows.
+```console
+$ cd /opt/trinity
+$ sudo vi get_taos
+...
+replace 'USER_ID' and 'USER_PASS' with your account.
+...
+$ sudo ./get_taos
+$ ls -al ROOTFS.img
+-rwxrwxrwx 1 root root 957349888  2월  5 15:33 ROOTFS.img
+```
+
+Also, please make sure `ARMLMD_LICENSE_FILE` is exported.
+We recommend you to add this in your `~/.bashrc`.
+```console
+$ vi ~/.bashrc
+export ARMLMD_LICENSE_FILE=8224@10.113.242.30
+$ source ~/.bashrc
+```
+
+Then, you can run the FastModels simulator.
+Note that we can run only 6 instances with ARM Fast Models simultaneously. Don't spawn instances unnecessarily. 
+
+```console
+$ /opt/trinity
+$ ./run_taos
+...
+```
+
+## Configuring your OS
+
+After running the simulator, you have to connect the shell using `telnet`.
+```console
+$ telnet localhost 5000
+Trying 127.0.0.1...
+Connected to localhost.
+Escape character is '^]'.
+...
+sh-3.2#
+sh-3.2# ls
+bin   dev  init  lib64       mnt   root  sbin  tmp  var
+boot  etc  lib   lost+found  proc  run   sys   usr
+```
+
+Now, you need to configure your FastModels environment.
+
+### File Sharing with Host PC
+
+You may utilize `/opt/trinity/share` to share files between host PC and FastModels. We recommend you to use `ssh-copy-id` command to mount a folder without password for your convenience.
+
+```console
+sh-3.2# ssh-copy-id -i /root/.ssh/id_rsa.pub  {SSH_ID}@{YOUR_UBUNTU_IP}
+```
+
+Then, please use `sshfs` command to mount the `/opt/trinity/share` folder of Host PC.
+
+```console
+sh-3.2# sshfs {SSH_ID}@{YOUR_UBUNTU_IP}:/opt/trinity/share /mnt
+sh-3.2# ls /mnt
+```
+
+### Package Installation
+
+Trinity OS supports the `taos-mgr` command to give developers a convenient development environment. For example, if you`` want to install the curl package, please type commands like below.
+
+```console
+sh-3.2# taos-mgr update
+sh-3.2# taos-mgr install curl
+```
+
+Also, you may install NPU-DDK packages with the below command.
+```console
+sh-3.2# taos-mgr install npu-engine*
+...
+sh-3.2# ls /usr/lib64 | npu-engine
+libnpu-engine.a libnpu-engine.so
+sh-3.2# ls /usr/lib64/npu-engine/bin
+apptests unittests
+sh-3.2# ls /usr/share/npu-engine/testdata
+TRIV221_8TOPS TRIV223_2TOPS
+```
+
+### Termination
+Don't terminate the simulator by force. Any changes should be flushed to the image. Always use `toybox poweroff` when you want to turn off.
+
+```console
+sh-3.2# toybox poweroff
+```
+
+## Manual Package Build
+
+Tizen packages are being built using `gbs` command. Thus, let's install `gbs` first.
+
+```console
+$ sudo echo "deb [trusted=yes] http://download.tizen.org/tools/latest-release/Ubuntu_16.04 /"\
+    | sudo tee /etc/apt/sources.list.d/tizen.list
+$ sudo apt update
+$ sudo apt install gbs
+```
+
+Also, as NPU-DDK uses SPIN repository, you should configure `gbs` in `.gbs.conf`.
+Here is the example `~/.gbs.conf` and replace SPIN account information.
+```console
+$ cat ~/.gbs.conf
+[general]
+profile = profile.tizen
+tmpdir = /var/tmp
+editor = vim
+packaging_branch = tizen
+workdir = .
+
+[profile.tizen]
+repos = repo.spin, repo.base, repo.unified
+buildroot = ~/GBS-ROOT/
+
+[repo.spin]
+url = http://10.113.136.32/download_trbs/snapshots/devel/tizen-6.0-ai/latest/repos/Tizen_Unified_standard/packages/
+user = [YOUR_SPIN_ACCOUNT]
+passwd = [YOUR_SPIN_PW]
+
+[repo.base]
+url = http://download.tizen.org/snapshots/tizen/base/latest/repos/standard/packages/
+[repo.unified]
+url = http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/
+```
+
+Then, you can build packages in a sandboxed build system using `gbs`. Select any architecture among armv7l, aarch64, and x86_64.
+```console
+$ git clone https://github.sec.samsung.net/AIP/NPU_SystemService
+$ cd NPU_SystemService
+$ gbs build -A aarch64 --clean
+...
+```
+
+If the build has finished successfully, you should find the built packages like below.
+```console
+$ ls ~/GBS-ROOT/local/repos/tizen/aarch64/RPMS/
+npu-engine-2.3.0-1.aarch64.rpm        npu-engine-example-2.3.0-1.aarch64.rpm
+npu-engine-devel-2.3.0-1.aarch64.rpm  npu-engine-utils-2.3.0-1.aarch64.rpm
+```
+
+## Library Linking
+
+To link the library to your application, its dependency declaration should be appended to your build script.
+For example, `packaging/[app-name].spec` may include `BuildRequires: npu-engine-devel` for gbs build.
+Please refer to [here](https://github.sec.samsung.net/dongju-chae/npu-engine-app) for the detailed example for packaging.
+
+## API Usage
+
+After `npu-engine-devel` is successfully installed, your application can access the required header files in `/use/include/npu-engine`.
+
+```console
+$ ls /usr/include/npu-engine
+libnpuhost.h  npubinfmt.h  typedef.h
+```
+
+The header files NPU Engine provides are as follows:
+
+```
+libnpuhost.h: The user APIs that NPU Engine provides 
+npubinfmt.h:  The format of NPU model binary
+typedef.h:    The type definitions used in NPU Engine
+```
+
+Thus, what you need to do is just to include these headers and use the defined APIs in your application. Here are a few APIs that you may use frequently:
+
+```
+getNPUdeviceByType(): Get a device instance with the given type.
+registerNPUmodel():   Register the model data to NPU Engine.
+runNPU_sync():        Execute inference with the registered model in sync mode.
+runNPU_async():       Execute inference with the registered model in async mode with an output callback.
+getNPU_profile():     Get the profile data of previous executions.
+```
+
+For complete sample codes, please refer to [here](https://github.sec.samsung.net/AIP/NPU_SystemService/tree/tizen/tests/apptests).
diff --git a/docs/markdown/GettingStarted.md b/docs/markdown/GettingStarted.md
new file mode 100644 (file)
index 0000000..a4fef1d
--- /dev/null
@@ -0,0 +1,12 @@
+---
+title: Getting Started
+short-description: Getting Started
+...
+
+# Getting Started
+
+NPU-DDK provides three different development environments. It's depending on the user which environment is appropriate.
+
+* Host PC (Ubuntu): simulate HW without kernel drivers.
+* Fast Model (Tizen): simulate HW with kernel drivers. 
+* FPGA (PetaLinux): execute real HW with kernel drivers.
diff --git a/docs/markdown/Installing.md b/docs/markdown/Installing.md
new file mode 100644 (file)
index 0000000..0f6c412
--- /dev/null
@@ -0,0 +1,13 @@
+---
+title: Installing Packages
+short-description: Installing NPU-DDK packages
+...
+
+# Installing NPU-DDK
+
+We provide NPU-DDK packages from the following two repositories.
+
+* [Artifactory](Artifactory.md): Essential packages to use NPU-DDK
+* [SPIN OBS](SPIN.md): Full packages including build-dependent ones
+
+Please note that SPIN provides both Ubuntu and Tizen packages but Artifactory supports Ubuntu only.
diff --git a/docs/markdown/PetaLinux.md b/docs/markdown/PetaLinux.md
new file mode 100644 (file)
index 0000000..56f0150
--- /dev/null
@@ -0,0 +1,157 @@
+---
+title: PetaLinux
+short-description: Xilinx PetaLinux (FPGA)
+...
+
+# Getting Started with PetaLinux
+
+Xilinx PetaLinux provides a reference Linux distribution that has been integrated and tested for Xilinx devices.
+
+[meta-trinity](https://github.sec.samsung.net/AIP/meta-trinity) contains bitbake recipes to enable the Trinity Driver Development Kit (DDK) and its relevant software in PetaLinux running on the `ZCU102-ZYNQMP` board.
+Therefore, You need to prepare the PetaLinux SDK and the BSP package for ZCU102 before starting the build.
+
+Here are links to download the SDK and BSP (signing-up and signing-in are required).
+- [https://www.xilinx.com/member/forms/download/xef.html?filename=petalinux-v2019.2-final-installer.run](https://www.xilinx.com/member/forms/download/xef.html?filename=petalinux-v2019.2-final-installer.run)
+- [https://www.xilinx.com/member/forms/download/xef.html?filename=xilinx-zcu102-v2019.2-final.bsp](https://www.xilinx.com/member/forms/download/xef.html?filename=xilinx-zcu102-v2019.2-final.bsp)
+
+## SDK Installation
+
+Please make sure you have downloaded the SDK and BSP.
+```console
+$ ls -1
+  petalinux-v2019.2-final-installer.run
+  xilinx-zcu102-v2019.2-final.bsp
+
+$ chmod +x petalinux-v2019.2-final-installer.run
+$ ./petalinux-v2019.2-final-installer.run
+  INFO: Checking installation environment requirements...
+  INFO: Checking free disk space
+  INFO: Checking installed tools
+  INFO: Checking installed development libraries
+  ...
+  INFO: Installing PetaLinux...
+  ...
+$ rm ./petalinux-v2019.2-final-installer.run
+$ ls -1
+  components
+  doc
+  etc
+  petalinux_installation_log
+  settings.csh
+  settings.sh
+  tools
+  xilinx-zcu102-v2019.2-final.bsp
+```
+
+## Project Creation
+
+In this example, we are using `trinity` as a name of the project.
+```console
+$ source settings.sh
+  PetaLinux environment set to '~/Work/PetaLinux'
+  INFO: Checking free disk space
+  INFO: Checking installed tools
+  INFO: Checking installed development libraries
+  INFO: Checking network and other services
+  ...
+$ petalinux-create --type project --source ./xilinx-zcu102-v2019.2-final.bsp --name trinity
+  INFO: Create project: trinity
+  INFO: New project successfully created in /home/wook/Work/PetaLinux/trinity
+```
+
+## Project Configuration
+
+In order to configure the project to fit ZCU102, you need a Xilinx proprietary file (.xsa or .hdf) exported from [VIVADO](https://www.xilinx.com/products/design-tools/vivado.html).
+The default .hdf file for ZCU102 is placed in the hw directory of this repository.
+Note that this file would be changed or updated as the hardware design is changed.
+
+```console
+$ cd ~/Work
+$ git clone https://github.sec.samsung.net/AIP/meta-trinity.git
+$ ls -1
+  meta-trinity
+  PetaLinux
+  ...
+$ cp -r ./meta-trinity/hw ./PetaLinux/trinity
+$ ls ./PetaLinux/trinity/hw
+design_1_wrapper.hdf
+```
+
+Run `petalinux-config` as follows:
+
+```console
+    $ cd PetaLinux/trinity
+    $ petalinux-config --get-hw-description=hw
+```
+
+And then, you get to face the ncurses-based configuration interface. To include the meta-trinity as one of the user-layers,
+set the meta-trinity directory cloned above to `Yocto Settings -> User Layers`. By selecting `Exit` in the configuration interface, you can finalize the configuration and the tool would generate several files required to build the project.
+
+## System/Apps Setting
+
+By default, PetaLinux will be booted on read-only initramfs. To mount non-volatile storage, you need to change a few configurations. Note that your SD card should be prepared with multiple partitions to contain rootfs image first.
+
+```console
+$ petalinux-config
+Image Packaging Configuration
+  Root filesystem type (INITRAMFS --> EXT)
+DTG Settings
+  Kernel Bootargs
+    generate boot args automatically --> unset
+    user set kernel bootargs --> 'console=ttyPS0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait'
+```
+Note that `/dev/mmcblk0p2` indicates the second partition of SD card.
+
+Also, If you're using static IP address rather than DHCP...
+
+```console
+$ petalinux-config
+Subsystem AUTO Hardware Settings
+  Ethernet settings
+    Obtain IP address automatically --> unset
+    Static IP address/netmask/gateway --> 'your settings'
+```
+
+Lastly, you may configure rootfs to change account info and activate some useful apps
+```console
+$ petalinux-config -c rootfs
+PetaLinux RootFS Settings
+  Root password
+...
+Image Features
+  ssh-server-openssh
+...
+```
+
+## Project build
+
+When the configuration is successfully done, you can find the `build` directory in the `trinity` (which is your project) directory as follows.
+
+To include the Trinity DDK into the bootable images, it is required to replace `local.conf` in the build directory with [the other](https://github.sec.samsung.net/AIP/meta-trinity/blob/linux-xlnx-fpga-v4.19/build/conf/local.conf) provided by this repository. This would enable to include the modified kernel for Trinity drivers and the system software, npu-engine, to use the drivers.
+
+```console
+$ cd ~/Work
+$ cp meta-trinity/build/conf/local.conf PetaLinux/trinity/build/conf
+```
+
+If you want to add other packages, modify the value of `IMAGE_INSTALL_append` in `[YOUR_PROJECT_NAME]/build/local.conf`, e.g., `PetaLinux/trinity/build/conf/local.conf`.
+
+Then, you need to make packages bootable from a SDcard to use the built images on the FPGA.
+
+```console
+$ cd ~/Work/PetaLinux/trinity/images/linux
+$ petalinux-package --boot --fsbl zynqmp_fsbl.elf --fpga system.bit --uboot u-boot.elf
+$ cp BOOT.bin /media/sdcard/first_partition/
+$ cp image.ub /media/sdcard/first_partition/
+$ sync
+```
+
+Optionally, if you configured non-volatile storage, extract the rootfs image to the second partition of SD card.
+```console
+$ pwd
+  ~/Work/PetaLinux/trinity/images/linux
+$ tar zxf rootfs.tar.gz -C /media/sdcard/second_partition/
+$ sync
+```
+
+Done! let's boot the FPGA with your customized PetaLinux.
diff --git a/docs/markdown/QuickStart.md b/docs/markdown/QuickStart.md
new file mode 100644 (file)
index 0000000..4bc77c2
--- /dev/null
@@ -0,0 +1,44 @@
+---
+title: Quickstart Guide
+short-description: Quick Start Guide
+...
+
+# Using Docker
+
+This page describes a quick-start guide to use NPU-DDK's user library, `npu-engine`, in `Docker` environment. It is meant for people who are new to using NPU-DDK, and emulate NPU inferences using [libmrpsim](https://github.sec.samsung.net/AIP/SIM_TrinityVision2/tree/master/mRPsim).
+
+* Docker images supported: Ubuntu 16.04 (xenial) and 18.04 (bionic)
+
+## Docker Images
+
+```console
+$ sudo apt install docker.io
+$ sudo docker pull art.sec.samsung.net/aip_docker/n2s2_docker/xenial
+$ sudo docker run -i -t art.sec.samsung.net/aip_docker/n2s2_docker/xenial /bin/bash
+root# ls /opt/trinity/lib
+libmrpsim.a  libmrpsim.so  libnpu-engine.a  libnpu-engine.so  pkgconfig
+```
+
+Please replace `xenial` with `bionic` to use Ubuntu 18.04.
+
+## Example: Inference with MobileNetV1
+
+You can start with our example programs (`/opt/trinity/bin/ and testdata.
+Please check `/opt/trinity/share/npu-engine/testdata` for many other models.
+
+```console
+root# ls /opt/trinity/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
+input_fmap_0.bin  model.tvn  output_fmap_0.bin
+
+root# apptest_tvn_triv2 /opt/trinity/share/npu-engine/testdata/TRIV223_2TOPS/MOBILENET_V1
+>>> Initializaing SPM with zero. It can be time-consuming...
+>>> Initializaing SPM with zero. It can be time-consuming...
+[Core Name: NPCore0], [File Name: /opt/trinity/share/mRPsim/decoder-triv2-emul.bin], [Ver: 1]
+        Section(.SRP.FLIH) Base (22000000) Size(36)
+...
+[APPTEST] apptest_tvn_triv2: PASSED
+```
+
+## Next Step
+Now, you have get some understanding of how to use NPU-DDK, but this might be not the one you want.
+Then, let's move on to [GettingStarted](GettingStarted.md).
diff --git a/docs/markdown/SPIN.md b/docs/markdown/SPIN.md
new file mode 100644 (file)
index 0000000..e727a09
--- /dev/null
@@ -0,0 +1,49 @@
+---
+title: SPIN OBS
+short-description: SPIN Open Build Service (OBS)
+...
+
+# SPIN Open Build Service (OBS)
+
+[SPIN](http://10.113.136.201) is designed to support the Tizen developers' open source activities and related projects. With `SPIN`, packages can be easily built and deployed to us.
+In addition to `Tizen` packages, it provides `Ubuntu` build environment.
+However, please note that before accessing the packages, you need to get the `Access Permission` for SPIN repository. Please refer to [here](https://code.sec.samsung.net/confluence/display/NEWCOMM/SPIN+Request+Process).
+
+* [Tizen](http://10.113.136.32/download_trbs/snapshots/devel/tizen-6.0-ai/latest/repos/Tizen_Unified_standard/packages): armv7l, aarch64, and x86_64
+* [Ubuntu](http://10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools): x86_64 on Ubuntu 16.04/18.04
+
+## Ubuntu
+
+Please make sure you have SPIN account and configure the apt source list.
+For example, if your host PC is Ubuntu 16.04,
+
+```console
+$ sudo echo "deb [trusted=yes] http://10.113.136.32/download_trbs/newlive/devel:/Tizen:/6.0:/AI:/UbuntuTools/Ubuntu_16.04 /" \
+    | sudo tee /etc/apt/sources.list.d/spin.list
+$
+$ cat /etc/apt/auth.conf.d/spin.conf
+machine 10.113.136.32
+login [YOUR_SPIN_ACCOUNT]
+password [YOUR_SPIN_PW]
+$
+$ sudo apt-get update
+$ sudo apt-get install npu-engine
+$ ls /opt/trinity/lib
+libnpu-engine.so
+```
+
+## Tizen (FastModels)
+
+Please refer to [here](FastModels.md) about how to setup FastModels.
+
+```console
+$ telnet localhost 5000
+Trying 127.0.0.1...
+Connected to localhost.
+Escape character is '^]'.
+
+sh-3.2# taos-mgr refresh
+sh-3.2# taos-mgr install npu-engine
+sh-3.2# ls /usr/lib64 | grep npu-engine
+libnpu-engine.a libnpu-engine.so
+```
diff --git a/docs/markdown/Ubuntu.md b/docs/markdown/Ubuntu.md
new file mode 100644 (file)
index 0000000..bd99af2
--- /dev/null
@@ -0,0 +1,83 @@
+---
+title: Ubuntu
+short-description: Ubuntu 16.04 (xenial) and 18.04 (bionic)
+...
+
+# Getting Started with Ubuntu
+
+The NPU-DDK's primary targets are [FastModels](FastModels.md) and [FPGA](PetaLinux.md).
+However, we also support host PC using `Ubuntu` (16.04/18.04) for fast development and testing purpose.
+
+This page describes how to install and use NPU-DDK in your host PC.
+Note that this environment simulates NPU HW behaviors and does not need to install kernel drivers.
+
+## Installation using Artifactory
+
+If you just want to use NPU-DDK in Ubuntu environment, [Artifactory](Artifactory.md) would be the best option.
+
+## Manual Package Build
+
+Optionally, you can change source codes and build packages manually. But, please make sure you added the [Artifactory](Artifactory.md) repository was added to your apt source list to resolve build dependencies.
+
+First, clone the github repository and build using `debuild`.
+If some build-dependent packages are missing, please install them (e.g., `libmrpsim-dev`).
+```console
+$ git clone https://github.sec.samsung.net/AIP/NPU_SystemService
+$ cd NPU_SystemService
+$ debuild -us -uc
+...
+```
+
+If the build has finished successfully, you should find the built packages like below.
+```console
+$ ls ../*.deb
+../npu-engine_2.3.0_amd64.deb      ../npu-engine-example_2.3.0_amd64.deb
+../npu-engine-dev_2.3.0_amd64.deb  ../npu-engine-utils_2.3.0_amd64.deb
+```
+
+Then, install your packages manually. 
+```console
+$ dpkg -i ../npu-engine_2.3.0_amd64.deb
+$ ls /opt/trinity/lib
+libnpu-engine.so
+```
+
+## Library Linking
+
+After installing, your applications can be built and linked with NPU-DDK libraries in any convenient way.
+For example, if you're using `make` and `pkg-config`,
+
+```console
+$ cd [YOUR_APP_HOME]
+$ export PKG_CONFIG_PATH=/opt/trinity/lib/pkgconfig:$PKG_CONFIG_PATH
+$ make `pkg-config npu-engine --cflags --libs`
+```
+
+## API Usage
+
+After `npu-engine-dev` is successfully installed, your application can access the required header files in `/opt/trinity/include`.
+
+```console
+$ ls /opt/trinity/include/npu-engine
+libnpuhost.h  npubinfmt.h  typedef.h
+```
+
+The header files NPU Engine provides are as follows:
+
+```
+libnpuhost.h: The user APIs that NPU Engine provides 
+npubinfmt.h:  The format of NPU model binary
+typedef.h:    The type definitions used in NPU Engine
+```
+
+Thus, what you need to do is just to include these headers and use the defined APIs in your application. Here are a few APIs that you may use frequently:
+
+```
+getNPUdeviceByType(): Get a device instance with the given type.
+registerNPUmodel():   Register the model data to NPU Engine.
+runNPU_sync():        Execute inference with the registered model in sync mode.
+runNPU_async():       Execute inference with the registered model in async mode with an output callback.
+getNPU_profile():     Get the profile data of previous executions.
+```
+
+For complete sample codes, please refer to [here](https://github.sec.samsung.net/AIP/NPU_SystemService/tree/tizen/tests/apptests).
diff --git a/docs/markdown/index.md b/docs/markdown/index.md
new file mode 100644 (file)
index 0000000..2108a58
--- /dev/null
@@ -0,0 +1,37 @@
+---
+render-subpages: false
+...
+
+# NPU Driver Development Kit (NPU-DDK)
+
+## Overview
+
+NPU-DDK is a collection of software development tools for Samsung Research (SR)
+Trinity NPU device family.
+This includes user APIs, core engines, driver wrappers, and kernel drivers.
+
+* User APIs and Library: [AIP/NPU_SystemService](https://github.sec.samsung.net/AIP/NPU_SystemService)
+* Linux Kernel Driver: [AIP/NPU_Linux-kernel](https://github.sec.samsung.net/AIP/NPU_Linux-kernel)
+* Bootstrap for FastModels: [AIP/NPU_bootstrap](https://github.sec.samsung.net/AIP/NPU_bootstrap)
+* Bitbake recipes for FPGA: [AIP/meta-trinity](https://github.sec.samsung.net/AIP/meta-trinity)
+
+## Features
+
+* Trinity Vision2 (TRIV2) multi-NPU support
+* Model inference on iommu-enabled NPU devices
+* Model profiling with per-layer performance counters
+* Multi-platform support (Ubuntu, Tizen, and PetaLinux)
+
+## Quickstart for beginners
+
+* Please read this [Quickstart](QuickStart.md) guide to get started.
+
+## Package Deployment
+
+* [Artifactory](Artifactory.md): Essential packages for Ubuntu
+* [SPIN OBS](SPIN.md): Full packages for both Ubuntu and Tizen
+
+## CI System
+
+* [http://nnsuiteci.mooo.com](http://nnsuiteci.mooo.com): Please refer to [TAOS-CI](https://github.com/nnstreamer/TAOS-CI) for details
+
diff --git a/docs/sitemap.txt b/docs/sitemap.txt
new file mode 100644 (file)
index 0000000..454a5a1
--- /dev/null
@@ -0,0 +1,11 @@
+index.md
+       QuickStart.md
+       GettingStarted.md
+               Ubuntu.md
+               FastModels.md
+               PetaLinux.md
+       Installing.md
+               Artifactory.md
+               SPIN.md
+       Examples.md
+       Debugging.md
diff --git a/docs/theme/extra/templates/navbar_center.html b/docs/theme/extra/templates/navbar_center.html
new file mode 100644 (file)
index 0000000..8e440fe
--- /dev/null
@@ -0,0 +1 @@
+<p><b>NPU Driver Developoment Kit (NPU-DDK)</b></p>
diff --git a/docs/theme/extra/templates/navbar_links.html b/docs/theme/extra/templates/navbar_links.html
new file mode 100644 (file)
index 0000000..30fac5a
--- /dev/null
@@ -0,0 +1,18 @@
+@require(page)
+
+<li class="dropdown">
+       <a class="dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+               Quick References <span class="caret"></span>
+       </a>
+       <ul class="dropdown-menu" id="quick-refs-menu">
+               @for tup in (("QuickStart.html", "QuickStart"), \
+           ("GettingStarted.html", "GettingStarted"), \
+           ("Installing.html", "Installing"), \
+           ("Examples.html", "Examples"), \
+           ("Debugging.html", "Debugging")):
+                       <li>
+                               <a href="@tup[0]">@tup[1]</a>
+                       </li>
+               @end
+       </ul>
+</li>
index 210664f..b05d88a 100644 (file)
@@ -79,8 +79,8 @@ static inline uint64_t NPUBIN_META_TOTAL_SIZE (uint64_t magiccode) {
 
 /**
  * @brief Meta data, "MAIN".
- * @detail First 2048 bytes are to be accessed by NPU Engine
- *         Then, next 2048 bytes are reserved for compilers and runtime
+ * @detail First 3072 bytes are to be accessed by NPU Engine
+ *         Then, next 1024 bytes are reserved for compilers and runtime
  *         The remaining bytes (if exist) are reserved for future usage.
  */
 typedef struct {
index dc3a7ab..c7b3534 100644 (file)
@@ -540,8 +540,6 @@ int getNPU_deviceStatus(npudev_h dev, npu_status *status, uint32_t *num_requests
  *
  * @note For most npu-engine users, the extended data is not useful because it will be
  *       used for second-party users (e.g., compiler, simulator).
- *       Also, the caller needs to free the metadata.
- *
  * @note the caller needs to free the metadata
  */
 npubin_meta * getNPUmodel_metadata (const char *model, bool need_extended)