Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of contents

...

Table of Contents
minLevel1
maxLevel4

Introduction

...

AdamApp must be packaged into a defined format and be installed. AdamAppSDK provides the environment to make building and packaging AdamApps with ease.

...

Also, this tutorial refers to the SDK installation directory as ${SDK_DIR}.

Packaging format of AdamApp

AdamApp needs to be in a package format when it is installed into IP camera. Create a zip file and encrypt it with a directory structure indicated below.

bin/

Directory to store AdamApp execution program

config/

Directory to store configuration files

data/

Directory to store external data files for AdamApp

external/

Directory to allocate external software files that will be used in AdamApp

setup/

Directory to store set-up scripts

AdamApp execution file, data files and configuration files will be stored in the directories above. Detail of each directory is introduced below.

⚫ bin directory: for AdamApp execution program

bin directory stores execution program of AdamApp. You can name the program as you like. If you built and package AdamApp using AdamAppSDK, the execution program will be automatically stored in this directory and will be named as specified by PROG_NAME macro in Makefile.

⚫ config directory: for configuration files

This directory stores configuration information which is always a combination of Applicense.bin
file and profile.bin file. These 2 files are created out of a configuration file (placed by the name
of configuration.txt as a sample of AdamAppSDK) by using a tool called adamapp_configurator.
Please refer to here★link★ for how to write a configuration.txt.

Note that you will have to place the files in this directory once your built and packaged AdamApp by using AdamAppSDK to automatically generate applicense.bin as well as profile.bin out of configuration.txt.

⚫ data directory: for external data files of AdamApp

Data directory is the only place where you can store external data files for AdamApp. Files which were placed in this directory will be copied when AdamApp is installed. This directory should be empty if you do not have data files you need to copy.

⚫ external directory: for external software files used in AdamApp

Place library files (.a .so etc) and header files (.h .hpp .hxx etc) included in the external software under external directory.

⚫ setup directory: for set-up shell script

setup directory is to store shell scripts which will be executed when installing, updating, or uninstalling AdamApp. The format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

Shell script will be executed after the environment variables listed below are passed on. Thus, you can review these environment variables within the shell script.

ADAM_INSTALLID

Install ID of AdamApp.

ADAM_APP_DATA_DIR

Directory path for AdamApp external data files.(= Data directory path)

ADAM_APP_TMP_DIR

Directory path for AdamApp temporary files.

The name of each shell script should be specified by the configuration file. Your preference of using or not using shell script can be set up for each script. Do not write a file name of the shell script for the configuration file if you are not using a shell script. (In this case, keep setup directory empty in order to save some file space)

➢ Install Script (optional)

This script is executed just after AdamApp is installed. Format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

➢ Update Script (optional)

This script is executed after an AdamApp has been updated. Format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

➢ Uninstall Script (optional)

This script is executed right before AdamApp is uninstalled. Format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

Target Dependent Macro

This section explains target dependent macros, which represent differences of models, OSs, and so on. They are defined as macro variables and are available within source files, header files and Makefiles. You can use these macros to change implementation of AdamApp on a specific model or OS that you are using.

Macros for source file and header file

Target dependent macros for source file and header file are as follows:

...

Macro Name

...

Description

...

Macro to represent the architecture (ADAM_TARGET_ARCH_XXX)

...

ADAM_TARGET_ARCH_aarch64-linux-gnu

...

Linux 64bit on aarch64 (For ambaCV2X)

...

Macro to represent the model name (ADAM_TARGET_MODEL_XXX)

...

ADAM_TARGET_MODEL_ipro

...

i-pro Model

...

Macro to represent the OS (ADAM_TARGET_OS_XXX)

...

ADAM_TARGET_MODEL_linux

...

Linux

...

Macro to represent the detail platform (ADAM_TARGET_PF_XXX)

...

ADAM_TARGET_PF_ipro_ambaCV2X_linux

...

i-pro Model / ambaCV2X / Linux

Macros for Makefile

Target dependent macros for Makefile are as follows:

...

Macro Name

...

Value

...

Description

...

ADAM_TARGET_ARCH

...

Macro to represent the architecture

...

aarch64-linux-gnu

...

Linux 64bit on aarch64 (For ambaCV2X)

...

ADAM_TARGET_MODEL

...

Macro to represent the model name

...

ipro

...

i-pro Model

...

ADAM_TARGET_OS

...

Macro to represent the OS

...

linux

...

Linux

...

ADAM_TARGET_PF

...

Macro to represent the detail platform

...

ipro_ambaCV2X_linux

...

i-pro Model / ambaCV2X / Linux

Procedure for generation of AdamApp package

The procedure to generate an AdamApp package using a sample application (SkeltonSampleApp) is discussed in this section. There are three phases to generate a package.

1.Generate source files and Makefile

Generate AdamApp source file.

2.Generate and place files

Generate files to build and run AdamApp and place them in the appropriate directories.

3.Build and generate package

Build (compile and link) AdamApp and generate a package.

Each specific method will be explained below.

Generate source file and Makefile

(1) Generate and place source files

Source files of the AdamApp must be placed in the following directory.
<AdamAppSDK installation directory>/src/adamapp
Thus, source codes of the sample program (SkeltonSampleApp) should be placed in the following
directory.
<AdamAppSDK installation directory>/src/adamapp/skeleton_sample_app

When you generate new AdamApp, also generate the following directory and place the source files,
header files and Makefile in there.
<AdamAppSDK installation directory>/src/adamapp/<directory name of the new AdamApp>
It’s recommended that you copy and modify skeleton_sample_app directory to generate new
application for ease.

(2) Place libraries files and header files of external software. (if you use an external software)

Place library files (.a .so etc) and header files (.h .hpp .hxx etc) included in external software used for AdamApp in the external directory.

(3) Edit Makefile

Edit Makefile after you create the source files and the header files. Input required information in
the Makefile template provided. Variables are listed in the template so that you can add the required values.
Typical variables from the template are shown below. Please refer to this part to edit your Makefile.

PROG_NAME= SkeletonSampleApp

PROG_NAME is a variable for setting generated program name.
Alpha-numeral, hyphen, underscore, period can be used for the name.
Length of the name is up to 32.

SRC_FILES= skeletonSampleApp.cpp

SRC_FILES is a variable for indicating build-target source file.
Developers need to describe all build-target source files.
By the way, developers can describe both of C source files (extension is .c) and C++ source files (extension is .cpp).

ADD_LIB_PATH=$(ADAM_ADD_LIB_PATH)

ADD_LIB_PATH+=

ADD_LIB_PATH is a variable for setting the path of library.
Developers have to describe the only path name.
If developers need to link any libraries in addition to Adam library, please describe value (the name of library).
By the way, DO NOT delete pre-set value $(ADAM_ADD_LIB_PATH).

ADD_LIBS=$(ADAM_ADD_LIBS)

ADD_LIBS+=

ADD_LIBS は、リンクするライプラリ名を指定する変数です。 Adam のライブラリ以外をリンクする場合は、この変数に追記してください。 なお、ADD_LIBS に設定済みの値[$(ADAM_ADD_LIBS)]は、消さないでください。

ADD_INCLUDE_PATH=$(ADAM_ADD_INCLUDE_PATH)

ADD_INCLUDE_PATH+=

ADD_INCLUDE_PATH は、include パスを指定する変数です。 Adam の include ファイル以外を include する場合に、そのパスを追記して下さ い。 なお、ADD_INCLUDE_PATH に設定済みの値[$(ADAM_ADD_INCLUDE_PATH)]は、 消さないでください。

PROG_CPPFLAGS= $(ADAM_DFLAGS)

PROG_CPPFLAGS+=

PROG_CPPFLAGS は、プリプロセッサオプションを指定する変数です。 AdamApp 独自のプリプロセッサオプションがある場合は、この変数に追記して下さ い。 なお、PROG_CPPFLAGSに設定済みの値[$(ADAM_DFLAGS)]は、消さないでくださ い。

PROG_CFLAGS= $(ADAM_CFLAGS)

PROG_CFLAGS+=

PROG_CFLAGS は、C のコンパイルオプションを指定する変数です。 AdamApp 独自の C コンパイルオプションがある場合は、この変数に追記して下さ い。 なお、PROG_CFLAS に設定済みの値[$(ADAM_CFLAGS)]は、消さないでくださ い。

PROG_CXXFLAGS= $(ADAM_CXXFLAGS)

PROG_CXXFLAGS+= -fno-rtti

PROG_CXXFLAGS+=

PROG_CXXFLAGS は、C++のコンパイルオプションを指定する変数です。 AdamApp 独自の C++コンパイルオプションがある場合は、この変数に追記して下さ い。 なお、PROG_CXXFLAGS に設定済みの値[$(ADAM_CXXFLAGS)]は、消さないでく ださい。

ファイルの生成と配置

(1) AdamApp 用外部データファイルの作成と配置

AdamApp から Read/Write したいファイルがある場合は、skeleton_sample_app/data ディレクトリ
以下に、作成・配置してください。なお、data ディレクトリ以下に配置されたファイルは、AdamApp
パッケージ作成時に、AdamApp パッケージの中に一緒に含められます。このため、AdamApp が実行
時には、AdamApp から data ディレクトリに配置されたファイルにアクセスすることができます。

(2) スクリプトファイルの作成と配置

AdamApp は、インストール時(直後)、アップデート時(直後)、アンインストール時(直前) に、指定されたスクリプトを実行する機能を持っています。それぞれの時に、実行したいスクリプトが あれば、skeleton_sample_app/setup ディレクトリに配置してください。もし、実行したいスクリプト がなければ、配置する必要はありません。

(3) コンフィギュレーションファイルの作成

コンフィギュレーションファイルのフォーマットに示す記載方法に従って、コンフィギュレーションファイルを作成し、configuration.txt という ファイル名で、skeleton_sample_app/ディレクトリ直下に配置してください。

(4) 設定値ファイルの作成

AdamApp で、設定値管理機能を用いる場合は、「App Preference Function Guide」★に従って、設定 値管理ファイルを作成し、appPrefs.json というファイル名で、skeleton_sample_app/ディレクトリ直 下に配置してください。

AdamApp のビルドとパッケージの生成

AdamApp に必要なファイルの作成と配置が完了したら、AdamApp のビルドとパッケージ作成を行いま
す。具体的には、(1)AdamApp の実行環境に対応する設定ファイルを読み込み、(2)make の実行、を実施し
ます。
詳しい手順について、これ以降で説明します。

(1) ビルド用環境設定ファイルの読み込み

ビルド用環境設定ファイルとして、setup_env.sh が用意されています。これを source コマンドを用い て読み込むことで、環境設定が完了します。その際、AdamApp を動作させる実行環境に応じて、引数 を指定する必要があります。

指定できる引数は下記の通りです。

i-pro ambaCV2X 用の AdamApp を作成する場合:

 ipro-ambaCV2X

下記に、それぞれの場合の詳細な手順を示します。

Code Block
$ cd ${SDK_DIR}
$ source setup_env.sh ipro-ambaCV2X
Info

下記のようなメッセージが表示されれば、ビルド用環境設定ファイルの読み込みは成功です。

***** /usr/local/linaro-aarch64-2018.08-gcc8.2/bin/aarch64-linux-gnu-gcc found. *****
PF_BASEDIR = /home/user/adamappsdk
BUILD_TARGET = ipro-ambaCV2X
TARGET_FOR_ADAM = ambaCV2X
TARGET_ARCH = aarch64-linux-gnu
VERBOSE = 0
PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

(2) make の実行(AdamApp のビルド&パッケージの作成)

続いて、AdamApp(追加アプリ)のビルドとパッケージ作成を行うために、make を実行します。
make を実行すると、ビルドとパッケージの作成を一気に行います。make が成功した場合には、
skeleton_sample_app ディレクトリ直下に、

SkeletonSampleApp :

SkeletonSampleApp の実行プログラム

SkeletonSampleApp.zip :

SkeletonSampleApp のパッケージ

SkeletonSampleApp.ext :

SkeletonSampleApp.zip を Base64 化したもの

の 3 つのファイルが生成されます。

Code Block
$ cd src/adamapp/skeleton_sample_app
$ ls –CF
Makefile configuration.txt skeletonSampleApp.cpp
bin/ data/ setup/
$ make
(略)
$ ls –CF
Makefile bin/ setup/
SkeletonSampleApp* configuration.txt skeletonSampleApp.cpp
SkeletonSampleApp.ext conf/ skeltonSampleApp.d
SkeletonSampleApp.zip data/ skeltonSampleApp.o

make の実行によって、生成される 3 つのファイルの詳細な説明は、下記の通りです。

SkeletonSampleApp :

デバッグ情報付きの実行プログラムです。gdbserver などを使って、AdamApp のデバッグする時に は、このファイルを用いて、デバッグ情報の読み込みを行います。なお、bin/SkeletonSampleApp は、デバッグ情報を取り除かれた実行プログラムです。

SkeletonSampleApp.zip :

必要な情報を格納した bin, data, config, setup の各ディレクトリを zip 化したパッケージファイルで す。AdamApp をインストールする際には、このファイルを用います。また暗号化する際は、この ファイルを i-PRO 株式会社へ送付します。

SkeletonSampleApp.ext :

SkeletonSampleApp.zip を Base64 化したパッケージファイルです。AdamApp のインストールす る際に、zip ファイルではなく、Base64 ファイルを指定する必要がある場合に、このファイルを用 います。(監視カメラの商品 UI を用いてのインストールなど)

コンフィギュレーションファイルのフォーマット

コンフィギュレーションファイルとは、AdamApp の動作に必要な情報を記述したファイルです。Adam
実行環境は、このファイルの内容を参照して、AdamApp の制御(インストール/開始など)を行います。このため、このファイルの内容が誤っている場合は、AdamApp のインストールや開始に失敗することがありますので、正確に記述してください。
なお、このファイルは、AdamApp パッケージの作成時に参照されますので、AdamApp 作成のための
make 実行前までに作成しておく必要があります。

具体的な記述例については、任意のサンプルアプリのconfiguration.txt を参照してください。

${SDK_DIR}/src/adamapp/[任意のサンプルアプリ]/configuration.txt

configuration.txt の各用語

コンフィギュレーションファイルの各項目は、タグと値で構成されており、下記のフォーマットで記述し ます。

# 行頭の「#」はコメントアウトを表わす

# head of line ‘#’ means comment out

TagName Value

TagName と Value の間の空白は、1文字以上のスペースか、タブで構成してください。行頭の「#」は、
コメントアウトを表わします。なお、行の途中に「#」が来ても、コメントアウトとは認識されませんの
で、ご注意ください。
具体的なタグの種類は、Table1.4.1-1 に示しています。また、Value に使える文字は、タグの種類によって異なりますので、こちらについても Table1.4.1-1 を参照してください。
記述の具体例を下記に示します。

# AdamApp 実行ファイル名の設定

# set of the name of execution file of AdamApp

APPLICATION SkeletonSampleApp

# AdamApp のバージョンの設定

# set of version of AdamApp

APPVERSION V0.01

また、項目によっては、複数設定することも可能です。複数設定する場合は、下記のように項目を複数の 項目を並べて記述してください。

# APPNAME(AdamApp の正式名称)の設定

# set of the official name of AdamApp

APPNAME0 Sample Application

APPNAME1 サンプルアプリケーション

APPNAME5 esempio di applicazione

コンフィギュレーションファイルに記載できるタグ名の種類は、下記の通りです。
なお、選択性に、「M(Mandatory)」と書かれている項目は、記述必須の項目です(何も書かれていてい
ない項目は、省略可能です)。

Table 1.4.1-1 コンフィギュレーションファイルに記載するタグの説明

...

タグ名

...

説明

...

複数指定

...

選択性

...

ア プ リ ケ ー シ ョ ン 名 関 連 情 報

...

APPLICATION

...

AdamApp の実行ファイル名。 Makefile の PROG_NAME 変数と同じ名前を記載します。 使える文字は、英数字、ハイフン、アンダースコア、ピリオド で、256 文字以内です。

...

M

...

APPVERSION

...

AdamApp のバージョン。 使える文字は、英数字、ピリオドで、7 文字以内です。

...

M

...

APPNAME

...

AdamApp の正式名称。
この AdamApp の正式名称は、複数言語に対応しているため、
APPNAME0 Sample Application
というように APPNAME + リージョンコードというタグ名を構成
します。複数言語の正式名称を記載する場合には、この項目を複
数記載してください。

各言語に対応するタグ名は下記の通りです。

APPNAME0:英語

APPNAME1:日本語

APPNAME5:イタリア語

APPNAME7:フランス語

APPNAME9:ドイツ語

APPNAME11:スペイン語

APPNAME12:中国語

APPNAME13:ロシア語

APPNAME14:ポルトガル語

なお、APPNAME0(英語)は、必ず指定してください。その他の
APPNAME の指定については、任意です。
シングルクォートは使用できません。文字数は、32 文字以内です。
なお、文字コードは UTF-8 でなければなりません。

...

O

...

M

...

リ ソ ー ス 関 連 情 報

...

ROMSIZE (*1)

...

AdamApp が利用する ROM 使用量 (KB)。
この ROM 使用量には、AdamApp の実行ファイルだけでなく、
data ディレクトリに格納するファイルのサイズなども含みます。
AdamApp のインストール時に、この値を参照して、インストール可能かどうかを判断します。

...

M

...

RAMSIZE (*2)

...

AdamApp が利用する RAM 使用量(KB)。
AdamApp のインストール時に、この値を参照して、インストール可能かどうかを判断します。
AdamApp の開始時に、この値を参照して、開始可能かどうかを判断します。

...

M

...

CPURATE (*2)

...

AdamApp が利用する CPU 使用率(%)。

...

M

...

AIACCRATE (*2)

...

AdamApp が利用する AI アクセラレータ使用率(%)
AdamApp の開始時に、この値を参照して、開始可能かどうかを判断します。

...

AIMEMSIZE (*3)

...

AdamApp が利用する AI メモリ使用量(KB)
AdamApp の開始時に、この値を参照して、開始可能かどうかを判断します。

...

ス ク リ プ ト フ ァ イ ル 情 報

...

INSTALLER

...

インストール実行直後に実行されるシェルスクリプト名。
記述できるシェルスクリプトは、Bourne Shell(実際には、Bourne Shell 互換シェルである ash を利用)スクリプトのみです。
使える文字は、英数字、ハイフン、アンダースコア、ピリオドで、256 文字以内です。
なお、このシェルスクリプトを用いない場合は、値を記載しないか、この項目をコメントアウトしてください。

...

UPDATER

...

アップデート実行直後に実行されるシェルスクリプト名。
記述できるシェルスクリプトは、Bourne Shell(実際には、Bourne Shell 互換シェルである ash を利用)スクリプトのみです。
使える文字は、英数字、ハイフン、アンダースコア、ピリオドで、256 文字以内です。
なお、このシェルスクリプトを用いない場合は、値を記載しないか、この項目をコメントアウトしてください。

...

UNINSTALLER

...

アンインストール実行直前に実行されるシェルスクリプト名。
記述できるシェルスクリプトは、Bourne Shell(実際には、Bourne Shell 互換シェルである ash を利用)スクリプトのみです。
使える文字は、英数字、ハイフン、アンダースコア、ピリオドで、256 文字以内です。
なお、このシェルスクリプトを用いない場合は、値を記載しないか、この項目をコメントアウトしてください。

...

ラ イ セ ン ス 関 連 情 報

...

FUNCID

...

機能 ID。機能 ID は、AdamApp 毎に一意に割当てられる値で、通常、i-PRO 株式会社によって定められます。
この項目は、AdamApp に機能 ID を紐づけるためのものです。
使える文字は、16 進数で 8 桁の値です。

Info

AdamApp 開発時には、0000FF01~0000FFFF の間で設定してください。
なお、AdamApp 毎に違う機能 IDを設定してください。
もし、同じ機能 ID を設定されたAdamApp をインストールした時、後からインストールした AdamApp は、インストールエラーになります。

...

M

*1: ROMSIZE
以下の合計:
実行可能なファイルと共有ライブラリ(Linux サイズコマンドで取得した”text”と”data”のフィールドの合計値)。
Data ディレクトリの容量
Conf ディレクトリの容量

*2: RAMSIZE, CPURATE, AIACCRATE,
初めにサンプルアプリケーションと同じ値を設定してください。最後に、i-PRO カメラ上でアプリケーションを実行した際の値を設定してください。これらのパラメータについてはResource Monitorを参照ください。
また、利用可能な ROM/RAM のリソースについてはAppendix B: AdamApp で利用可能な CPU と RAMを参照ください。

*3: AIMEMSIZE

サンプルアプリケーションと同じ値を設定してください。

AIアクセラレーターの活用事例

Note

・AI アクセラレータは i-pro ambaCV2X モデル向けの AdamApp でのみ、利用可能です。

・ツール(cvtool)は AdamAppSDK には含まれていません。必要な場合には、i-PRO 株式会社にお問合せください。

i-pro ambaCV2X モデルのカメラには、AI の推論処理用アクセラレータ(CVFlow)を内蔵しています。
AdamApp からは、専用の API 経由でこのアクセラレータを使用することが可能です。API の入力として、アクセラレータ用のバイナリファイルが必要になります。以下の手順でバイナリの作成、およびAdamApp への組み込みを行ってください。

[手順]

  1. 学習済みの AI モデルを、アクセラレータ用のバイナリファイルに変換します。

  2. AdamApp パッケージの生成手順の記載手順にしたがって、AdamApp パッケージを作成します。この際に、手順 1.で作成したバイナリを data/cnn ディレクトリの下に置いてください。

...

Adam では、上記の手順 1.を行うためのツール(cvtool)を用意しています。cvtool の使用方法については、 別冊のドキュメント AdamApp_CVtool_UserManual ★を参照してください。

Appendix

Appendix A: 製品のセキュリティについて

製品セキュリティを確保するため以下の事に注意して開発してください。
・静的解析を実施してください。
・脆弱性の検証を行ってください。
・OSS 使用時には、最新の OSS を使用する、或いは、既知の脆弱性を確認してからご使用ください。

Appendix B: AdamApp で利用可能な CPU と RAM

AdamApp で利用可能な CPU 使用率及び RAM 使用量は、i-PRO カメラの機種によって異なります。
CPU 使用率が上限に達すると、カメラはそれ以上 AdamApp が CPU を使用しないように制限します。
メモリ使用量が上限に達すると、AdamApp は強制終了されます。
機種ごとの利用可能なリソース情報は下記 URL を参照下さい。

...

Directory structure of development environment

...

Directory structure of AdamAppSDK is as follows.

${SDK_DIR}/ Top directory

bin/ Directory for Adam execution program

build_config/ Directory for rule files for make

conf/ Directory for configuration information

external/ Directory for open source library files for AdamApp

include/ Directory for header files for AdamApp

lib/ Directory for library files for AdamApp

src/ Directory for source files for AdamApp

tool/ Directory for tools

www/ Directory for HTML files for operation of Adam (Not used)

sdk_version.txt Text file described version of AdamSDK

setup_env.sh Script file for configuration of make

Details of each directory/file are discussed in the next section.

 

include: Directory of header files of AdamApp

The following header files which are required for generation of AdamApp are placed in include directory.

AdamType.h Types of Adam are defined

AdamApi.h API for AdamApp is defined

 

lib: Directory of libraries for AdamApp

The following library files which are required for generation of AdamApp are placed in lib directory.

libadam_common.so / libadam_common.a

Adam common library: common library for Adam processes

libadam.so / libadam.a
AdamApp API library: described API for AdamApp

Note that separate library file must be used in accordance with the execution environment. Directories for each execution environment and library files for them are provided.

${SDK_DIR}/lib/aarch64-linux-gnu/

Library for i-pro ambaCV2X model.

 

src: Directory of source files of AdamApp

Source files of AdamApp are placed in src directory. You could generate sub-directories and place source
files in them.skelton_sample_app directory is located in src directory as a sample for you to understand
how to place source files with ease. It is easier if you copy this sample directory and create a source file
within the copied directory to create a building environment.
In addition, sample applications are stored under skelton_sample_app directory which can be used for
actual building of an environment with ease. Use this samples as references for how to use AdamApp
API. Directory structure of src and skeleton_sample_app is as follows.

${SDK_DIR}/src/adamapp/

adamapp_setting.mk common configuration file for make

adam_make_package.mk common rule file for make

 

${SDK_DIR}/src/adamapp/skeleton_sample_app/

bin/ for execution program of AdamApp

conf/ for configuration information

data/ for data files of AdamApp

external/ for external software files using in AdamApp

setup/ for setup script files

Makefile Makefile

configuration.txt configuration file

skeletonSampleApp.cpp sample source file

 

bin: Directory of Adam execution program

Bin files which are required for execution of AdamApp are placed in bin directory. Execution programs provided are listed below.

adamCore : Adam Core program
adam.cgi : Adam CGI program, which is called by HTTP server
sdkCam : sdkCAM program

Note that separate library file must be used in accordance with the execution environment. Directories for each execution environment and library files for them are provided.

${SDK_DIR}/bin/

i686-linux-gnu/ Binary for execution on PC (32 bit version)

X86_64-linux-gnu/ Binary for execution on PC (64 bit version)

 

build_config: Directory of basic setting file for build

Make rule file which is required for AdamApp building is placed in build_config directory. You normally
don’t need to edit the files in this directory unless you want to change the existing make rule.

tool: Directory for tools

The tools for creating or executing Adam related files, such as a tool to generate Adam configuration data or a script file to launch Adam, are placed in tool directory.

adamapp_configurator A script that generates configuration data out of the configuration file.
httpdctl.sh A script to start and stop httpd
startAdam.sh Start Adam script
stopAdam.sh Stop Adam script

 

external: Directory of Open Source library used for AdamApp

Open Source library files which are required AdamApp building are placed in external directory. Please
refer to adamappsdk/external/license for the available Open Source.
Note that separate library file must be used in accordance with the execution environment. Directories
for each execution environment and library files for them are provided.

${SDK_DIR}/external/license/
Location of Open Source license files in external directory

${SDK_DIR}/external/lib/aarch64-linux-gnu/
Library for i-pro ambaCV2X model.

 

sdk_version.txt: version file of SDK

Version information of iPRO_CAMERA_SDK in sdk_version.txt.

 

setup_env.sh: setting file

setup_env.sh is provided as an environment setup file for building.

Packaging format of AdamApp

...

AdamApp needs to be in a package format when it is installed into IP camera. Create a zip file and encrypt it with a directory structure indicated below. *C/C++ is described as an example.

bin/

Directory to store AdamApp execution program

conf/

Directory to store configuration files

data/data_CV2X/data_CV5X

Directory to store external data files for AdamApp
*data_CV2X/data_CV5X only for SDK1.80 or later

external/

Directory to allocate external software files that will be used in AdamApp

setup/

Directory to store set-up scripts

AdamApp execution file, data files and configuration files will be stored in the directories above. Detail of each directory is introduced below.

⚫ bin directory: for AdamApp execution program

bin directory stores execution program of AdamApp. You can name the program as you like. If you built and package AdamApp using AdamAppSDK, the execution program will be automatically stored in this directory and will be named as specified by PROG_NAME macro in Makefile.

⚫ conf directory: for configuration files

This directory stores configuration information which is always a combination of Applicense.bin
file and profile.bin file. These 2 files are created out of a configuration file (placed by the name
of configuration.txt as a sample of AdamAppSDK) by using a tool called adamapp_configurator.
Please refer to here for how to write a configuration.txt.

Note that you will have to place the files in this directory once your built and packaged AdamApp by using AdamAppSDK to automatically generate applicense.bin as well as profile.bin out of configuration.txt.

⚫ data/data_CV2X/data_CV5X directory: for external data files of AdamApp

Data directory is the only place where you can store external data files for AdamApp. Files which were placed in this directory will be copied when AdamApp is installed. This directory should be empty if you do not have data files you need to copy.
The data_CV2X directory is a directory where you can place external data files for AdamApp for ambaCV2X. The data_CV5X directory is a directory where you can place external data files for AdamApp for ambaCV5X. If you want to share it between ambaCV2X and ambaCV5X, store the external data file for AdamApp in the data directory and it will be shared. If you want to differentiate external data files for AdamApp between ambaCV2X and ambaCV5X, place them under the data_CV2X and data_CV5X directories.

If you are using the AI ​​accelerator, place the converted binary data under the cnn directory.

⚫ external directory: for external software files used in AdamApp

Place library files (.a .so etc) and header files (.h .hpp .hxx etc) included in the external software under external directory.

⚫ setup directory: for set-up shell script

setup directory is to store shell scripts which will be executed when installing, updating, or uninstalling AdamApp. The format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

Shell script will be executed after the environment variables listed below are passed on. Thus, you can review these environment variables within the shell script.

ADAM_INSTALLID

Install ID of AdamApp.

ADAM_APP_DATA_DIR

Directory path for AdamApp external data files.(= Data directory path)

ADAM_APP_TMP_DIR

Directory path for AdamApp temporary files.

The name of each shell script should be specified by the configuration file. Your preference of using or not using shell script can be set up for each script. Do not write a file name of the shell script for the configuration file if you are not using a shell script. (In this case, keep setup directory empty in order to save some file space)

➢ Install Script (optional)

This script is executed just after AdamApp is installed. Format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

➢ Update Script (optional)

This script is executed after an AdamApp has been updated. Format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

➢ Uninstall Script (optional)

This script is executed right before AdamApp is uninstalled. Format is based on Bourne Shell ( Bourne Shell compatible ash should be used).

For Python it is as follows. A detailed explanation is omitted because it is similar to C/C++.

bin/

Directory to store AdamApp execution program

conf/

Directory to store configuration files

data/

Directory to store external data files for AdamApp

python/

Directory to place Python scripts

setup/

Directory to store set-up scripts

Target Dependent Macro

...

This section explains target dependent macros, which represent differences of models, OSs, and so on. They are defined as macro variables and are available within source files, header files and Makefiles. You can use these macros to change implementation of AdamApp on a specific model or OS that you are using.

Macros for source file and header file

Target dependent macros for source file and header file are as follows:

Macro Name

Description

Macro to represent the architecture (ADAM_TARGET_ARCH_XXX)

ADAM_TARGET_ARCH_aarch64-linux-gnu

Linux 64bit on aarch64 (For ambaCV2X)

Macro to represent the model name (ADAM_TARGET_MODEL_XXX)

ADAM_TARGET_MODEL_ipro

i-pro Model

Macro to represent the OS (ADAM_TARGET_OS_XXX)

ADAM_TARGET_MODEL_linux

Linux

Macro to represent the detail platform (ADAM_TARGET_PF_XXX)

ADAM_TARGET_PF_ipro_ambaCV2X_linux

i-pro Model / ambaCV2X / Linux

Macros for Makefile

Target dependent macros for Makefile are as follows:

Macro Name

Value

Description

ADAM_TARGET_ARCH

Macro to represent the architecture

aarch64-linux-gnu

Linux 64bit on aarch64 (For ambaCV2X)

ADAM_TARGET_MODEL

Macro to represent the model name

ipro

i-pro Model

ADAM_TARGET_OS

Macro to represent the OS

linux

Linux

ADAM_TARGET_PF

Macro to represent the detail platform

ipro_ambaCV2X_linux

i-pro Model / ambaCV2X / Linux

Procedure for generation of AdamApp package

...

The procedure to generate an AdamApp package using a sample application (SkeltonSampleApp) is discussed in this section. There are three phases to generate a package.

1.Generate source files and Makefile

Generate AdamApp source file.

2.Generate and place files

Generate files to build and run AdamApp and place them in the appropriate directories.

3.Build and generate package

Build (compile and link) AdamApp and generate a package.

Each specific method will be explained below.

Generate source file and Makefile

(1) Generate and place source files

Source files of the AdamApp must be placed in the following directory.
<AdamAppSDK installation directory>/src/adamapp

Info

The Python source code should be placed below.

<AdamAppSDK installation directory>/src/adamapp-py

Thus, source codes of the sample program (SkeltonSampleApp) should be placed in the following
directory.
<AdamAppSDK installation directory>/src/adamapp/skeleton_sample_app

When you generate new AdamApp, also generate the following directory and place the source files,
header files and Makefile in there.
<AdamAppSDK installation directory>/src/adamapp/<directory name of the new AdamApp>
It’s recommended that you copy and modify skeleton_sample_app directory to generate new
application for ease.

Info

*For Python, we recommend using the jpeg_app directory.

(2) Place libraries files and header files of external software. (if you use an external software)

Place library files (.a .so etc) and header files (.h .hpp .hxx etc) included in external software used for AdamApp in the external directory.

(3) Edit Makefile

Edit Makefile after you create the source files and the header files. Input required information in
the Makefile template provided. Variables are listed in the template so that you can add the required values.
Typical variables from the template are shown below. Please refer to this part to edit your Makefile.

PROG_NAME= SkeletonSampleApp

PROG_NAME is a variable for setting generated program name.
Alpha-numeral, hyphen, underscore, period can be used for the name.
Length of the name is up to 32.

SRC_FILES= skeletonSampleApp.cpp

SRC_FILES is a variable for indicating build-target source file.
Developers need to describe all build-target source files.
By the way, developers can describe both of C source files (extension is .c) and C++ source files (extension is .cpp).

ADD_LIB_PATH=$(ADAM_ADD_LIB_PATH)

ADD_LIB_PATH+=

ADD_LIB_PATH is a variable for setting the path of library.
Developers have to describe the only path name.
If developers need to link any libraries in addition to Adam library, please describe value (the name of library).
By the way, DO NOT delete pre-set value $(ADAM_ADD_LIB_PATH).

ADD_LIBS=$(ADAM_ADD_LIBS)

ADD_LIBS+=

ADD_LIBS is a variable for setting the name of linked library.
If developers need to link any libraries in addition to libraries for Adam, please describe value.
By the way, DO NOT delete pre-set value $(ADAM_ADD_LIBS).

ADD_INCLUDE_PATH=$(ADAM_ADD_INCLUDE_PATH)

ADD_INCLUDE_PATH+=

ADD_INCLUDE_PATH is a variable for setting include path.
If developers need to any include files in addition to include file for Adam, please describe value.
By the way, DO NOT delete pre-set value $(ADAM_ADD_INCLUDE_PATH).

PROG_CPPFLAGS= $(ADAM_DFLAGS)

PROG_CPPFLAGS+=

PROG_CPP_FLAGS is a variable for setting preprocessor option.
If developers need the unique preprocessor option for AdamApp, please describe value.
By the way, DO NOT delete pre-set value $(ADAM_DFLAGS).

PROG_CFLAGS= $(ADAM_CFLAGS)

PROG_CFLAGS+=

PROG_CFLAGS is a variable for setting C compile option.
If developers need the unique C compile option for AdamApp, please describe value.
By the way, DO NOT delete pre-set value $(ADAM_CFLAGS).

PROG_CXXFLAGS= $(ADAM_CXXFLAGS)

PROG_CXXFLAGS+= -fno-rtti

PROG_CXXFLAGS+=

PROG_CXXFLAGS is a variable for setting C++ compiling option.
If developers need the unique C++ compiling option for AdamApp, please describe value.
By the way, DO NOT delete pre-set value $(ADAM_CXXFLAGS).

Generate and place files

(1) Generate and place external data files for AdamApp

Create and place the file under skeleton_sample_app/data directory if you need to read and write on the files (e.g., parameters of threshold). The files placed under the data directory will be included in the AdamApp package. You can access these files when AdamApp is executed.

(2) Generate and place script files

AdamApp has a function to execute specified script right after its installation and update or right
before its uninstallation. Place the script that you want to execute on each occasion under
skeleton_sample_app/setup. skeleton_sample_app/setup directory can be empty if you do not have a
specific script that you want to execute.

(3) Generate configuration file

Follow the procedure indicated in the here to create a configuration file. Place the file under skeleton_sample_app/ directory by the name of configuration.text.

(4) Generate preferences file

Please refer to here to create setting value control file when using setting
value control function. Place the file under skeleton_sample_app/ directory by the name of
appPref.json.

Building AdamApp & generate package

Build and create a package of AdamApp after creating and placing the required files for AdamApp.
(1) Read configuration file for the AdamApp execution environment and (2) Execute make
For detailed instructions, please see here if you are using SDK v1.71 or earlier.
If you are using SDK v1.80 or later, please refer here.

Build the ambaCV2X and ambaCV5X extension apps into one file

This article explains how to combine ambaCV2X and ambaCV5X applications into one file. If there is no need to combine them into one file, there is no problem if you do not perform this. Build the ambaCV2X and ambaCV5X apps in advance. As an example, if you build Python's sqlite_app, the following files will be generated.

SQLiteSampleAppPy_V0_1_ambaCV2X.ext
SQLiteSampleAppPy_V0_1_ambaCV2X.zip
SQLiteSampleAppPy_V0_1_ambaCV5X.ext
SQLiteSampleAppPy_V0_1_ambaCV5X.zip

Now, move to the target directory as shown below and run make pack.

Code Block
cd ${SDK_DIR}/src/adamapp-py/sqlite_app/
make pack

If successful, the ambaCV2X and ambaCV5X apps will be combined into one file.

SQLiteSampleAppPy_V0_1_ambaCV2X5X.ext
SQLiteSampleAppPy_V0_1_ambaCV2X5X.zip

The above files are available for ambaCV2X and ambaCV5X cameras.

Note

If the ambaCV2X and ambaCV5X apps are combined into one file, the file size will increase accordingly. The app may not work if the file size is large. Please note that the file size limit varies depending on the camera model and condition.

 

Format of configuration file

...

Configuration file contains essential information to run AdamApp. AdamApp is controlled within Adam execution environment in line with the contents of this file (e.g., at the time of installation or starting). Therefore, installation or starting of AdamApp may fail if the content in this file is incorrect. In addition, this file is also used when AdamApp is packaged, which means that you need to create this file before the execution of make to create AdamApp.

See the configuration.txt of any sample app for specific examples.

${SDK_DIR}/src/adamapp/[any sample app]/configuration.txt

Each term in configuration.txt

Each item has a tag and a value as shown below.

# head of line ‘#’ means comment out

TagName Value

Add a space between TagName and Value for one or more characters, or a tab.
‘#’ placed at the beginning of a sentence means ‘comment out’ whereas, a ‘#’ in the middle of sentence
means otherwise.
Details of each tag is shown in Table 1.4.1-1. Please refer to this table to determine what character can be
used for Value for each tag. Examples are shown below.

# set of the name of execution file of AdamApp

APPLICATION SkeletonSampleApp

# set of version of AdamApp

APPVERSION V0.01

More than one item can be selected. Example is as follows.

# set of the official name of AdamApp

APPNAME0 Sample Application

APPNAME1 サンプルアプリケーション

APPNAME5 esempio di applicazione

Following tag names can be used in the configuration file. The optionality field where ‘M (Mandatory)’ is indicated must be filled. The field can be left blank if it is not indicated as mandatory.

Table 1.4.1-1 Tags written in the configuration file

Tag name

Description

Multi selectable

Optionality

Application name related information

APPLICATION

The name of AdamApp execution file. Write the same name as PROG_NAME variable in Makefile. Up to 256 characters using alpha-numeral, hyphen, under score, and period.

M

APPVERSION

AdamApp version information. Up to 7 characters using alpha-numeral and period.

M

APPNAME

The AdamApp official name Tag name should be a combination of APPNAME + region code. This is because an AdamApp official name supports multiple language.

e.g., APPNAME0 SampleApplication

Tag names of languages are as follows:

APPNAME0:English

APPNAME1:Japanese

APPNAME5:Italian

APPNAME7:French

APPNAME9:German

APPNAME11:Spanish

APPNAME12:Chinese

APPNAME13:Russian

APPNAME14:Portuguese

Please always specify APPNAME0(English). The other languages are optional. Single quote cannot be used. The number of characters is up to 32. Character code must be UTF-8

O

M

Information of release

ROMSIZE (*1)

ROM size used for AdamApp. ROM size includes not only execution file of AdamApp but also the file size stored in data directory. Whether AdamApp can be installed or NOT is determined depending on these values.

M

RAMSIZE (*2)

RAM size used for AdamApp. Whether AdamApp can be installed or NOT is determined depending on these values. Whether AdamApp can be started or NOT is determined depending on these values when starting AdamApp.

M

CPURATE (*2)

AdamApp CPU usage.

This will be used in the response of WEB API getApplicationList.

M

AIACCRATE (*3)

Adam App AI Accelerator utilization.

AIMEMSIZE (*3)

AI Memory size used by AdamApp.

Information of script file

INSTALLER

Name of the shell script that is executed soon after the installation. Only in Bourne Shell format (Bourne Shell compatible ash should be used). Alpha-numeral, hyphen, under score, and period can be used. The number of characters should be within 256. When this shell script is not used, do not indicate any value or comment out this item.

UPDATER

The name of the shell script executed soon after an update. Only in Bourne Shell format (Bourne Shell compatible ash should be used). Alpha-numeral, hyphen, under score, and period can be used. The number of characters should be within 256. When this shell script is not used, do not indicate any value or comment out this item.

UNINSTALLER

Name of the shell script executed right before the uninstallation. Only in Bourne Shell format (Bourne Shell compatible ash should be used). Alpha-numeral, hyphen, under score, and period can be used. The number of characters should be within 256. When this shell script is not used, do not indicate any value or comment out this item.

Information of license

FUNCID

Function ID This is a unique value for each AdamApp which is normally assigned by i-PRO Co., Ltd. This value can link AdamApp to the function ID. The ID should be 8 digit and in hex.

Info

Use any value between 0000FF01 to 0000FFFF during the development. The ID should be different for each AdamApp. Installation error occurs if AdamApp had the same function ID with AdamApp that has been already installed.

M

*1: ROMSIZE
Sum of followings.
Size of executable file and shared libraries (sum of “text” and “data” field value obtained with the
Linux size command.)
Size of data directory.
Size of conf directory.

*2: RAMSIZE, CPURATE
At first, set the same value as the sample application.
At last, set the value when running the application on the i-PRO camera.
How to see these parameters described in here.
Available ROM/RAM resources described in here.

*3: AIACCRATE, AIMEMSIZE

Set the same value as the sample application. These are not used in internal processing.

Appendix

...

Appendix A: Regarding product security

Please be aware of the following matters to ensure product security throughout the course of your development.

- Perform static analysis

- Verify vulnerability of the app.

- When using OSS, use the latest OSS or check for known vulnerabilities before using.