> For the complete documentation index, see [llms.txt](https://docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verifone.com/adk-os-platform/readme/developing-applications/developing-application.md).

# Developing application

## Development environment for Application Developers

Developers use the system development kit for developing applications. This includes the following:

<table><thead><tr><th width="276">Item</th><th>Contents</th></tr></thead><tbody><tr><td>VOS3 build tools</td><td><ul><li>gcc compiler</li><li>gcc build tools</li></ul></td></tr><tr><td>VOS3 host debug tools</td><td><ul><li>gdb debugger</li></ul></td></tr><tr><td>VOS3 device debug tools</td><td><ul><li>debug tools download package (dropbear, gdb, gdbserver, strace, etc.)</li></ul></td></tr><tr><td>VOS3 packaging and<br>development signing tool</td><td><ul><li>packman</li></ul></td></tr><tr><td>VOS3 system download files</td><td><ul><li>VOS3 system download files for system update</li></ul></td></tr><tr><td>VOS3 / ADK APIs</td><td><ul><li>ADK headers, link libraries</li></ul></td></tr><tr><td>ADK Documentation</td><td><ul><li><a href="https://docs.verifone.com/adk-release-notes/">ADK release notes</a></li><li><a href="https://docs.verifone.com/adk-5-1-programmers-guide/">ADK component programmers guides</a></li><li>examples</li></ul></td></tr></tbody></table>

## ADK API Libraries

Applications use API prototypes from provided header files and link against the ADK libraries to access these APIs.

<table><thead><tr><th width="276">Component</th><th width="338">Client Libraries</th><th>Client Header Files</th></tr></thead><tbody><tr><td>ADK GUIPRT</td><td><ul><li>libvfiguiprt.so</li></ul></td><td><ul><li>html/gui.h</li><li>html/prt.h</li></ul></td></tr><tr><td>ADK IPC</td><td><ul><li>libvfiipc.so</li><li>libvfiipctls.so</li></ul></td><td><ul><li>ipc/ipc.h</li><li>ipc/notify.h</li><li>ipc/jsobject.h</li><li>ipc/tls.h</li></ul></td></tr><tr><td>ADK COM</td><td><ul><li>libcom.so</li></ul></td><td><ul><li>com/libcom.h</li><li>com/libcom3.h</li></ul></td></tr><tr><td>ADK CCP</td><td><ul><li>libccp.so</li></ul></td><td><ul><li>com/libccp.h</li></ul></td></tr><tr><td>ADK MAC</td><td><ul><li>libvfimac.so</li><li>libvficpr.so</li></ul></td><td><ul><li>sysinfo/mac.h</li></ul></td></tr><tr><td>ADK PM</td><td><ul><li>libvfisyspm.so</li></ul></td><td><ul><li>sysinfo/vfisyspm.h</li></ul></td></tr><tr><td>ADK EMV</td><td><ul><li>libEMV_CTLS_Client.a</li><li>libEMV_CT_Client.a</li><li>libEMV_CT_Link.so</li><li>libEMV_CTLS_Link.so</li><li>libsdiclient.a</li><li>libTLV_Util.so</li></ul></td><td><ul><li>emv/EMV_Common_Interface.h</li><li>emv/EMV_CT_Interface.h</li><li>emv/EMV_CTLS_Interface.h</li><li>emv/EMV_CT_SerInterface.h</li><li>emv/EMV_CTLS_SerInterface.h</li><li>emv/E2E_EMV_CT_Serialize.h</li><li>emv/E2E_EMV_CTLS_Serialize.h</li><li>emv/btlv.h</li><li>emv/EMV_CT_XML.h</li><li>emv/EMV_CTLS_XML.h</li><li>emv/hexutil.h</li></ul></td></tr><tr><td>ADK MSR</td><td><ul><li>libsdiclient.a</li></ul></td><td><ul><li>msr/msr.h</li></ul></td></tr><tr><td>ADK TEC</td><td><ul><li>libsdiclient.a</li></ul></td><td><ul><li>tec/tec.h</li></ul></td></tr><tr><td>ADK NFC</td><td><ul><li>libsdiclient.a</li></ul></td><td><ul><li>nfc/NFC_Client.h</li><li>nfc/NFC_Interface.h</li></ul></td></tr><tr><td>ADK SYS</td><td><ul><li>libvfisysinfo.so</li><li>libvfisysbar.so</li></ul></td><td><ul><li>sysinfo/sysinfo.h</li><li>sysinfo/leds.h</li><li>sysinfo/sysbar.h</li><li>sysinfo/sysbeep.h</li><li>sysinfo/inifile.h</li></ul></td></tr><tr><td>ADK CPL</td><td><ul><li>libcpl.so</li></ul></td><td><ul><li>commerce/commerce.h</li></ul></td></tr><tr><td>ADK LOG</td><td><ul><li>liblog.so</li></ul></td><td><ul><li>log/liblog2.h</li></ul></td></tr><tr><td>ADK ISO8583</td><td><ul><li>libiso8583.so</li></ul></td><td><ul><li>iso8583/ConstData.h</li><li>iso8583/dl_err.h</li><li>iso8583/dl_str.h</li><li>iso8583/dl_iso8583.h</li><li>iso8583/SafeBuffer.hpp</li><li>iso8583/dl_iso8583_fields.</li><li>iso8583/dl_base.h</li><li>iso8583/dl_iso8583_common.</li><li>iso8583/dl_mem.h</li><li>iso8583/defs/dl_iso8583_de</li><li>iso8583/defs/dl_AS2805_def</li><li>iso8583/fwd/ConstData.h</li><li>iso8583/fwd/SafeBuffer.hpp</li></ul></td></tr><tr><td>ADK INF</td><td><ul><li>libinf.so</li><li>libinf_util.so</li></ul></td><td><ul><li>inf/infodb.h</li><li>inf/inf_util.h</li></ul></td></tr><tr><td>ADK SND</td><td><ul><li>libsound.so</li></ul></td><td><ul><li>sound/sound.h</li></ul></td></tr><tr><td>ADK SEC</td><td><ul><li>libsec2.so</li></ul></td><td><ul><li>sec/libsec.h</li></ul></td></tr><tr><td>ADK EVT</td><td><ul><li>libevt.so</li></ul></td><td><ul><li>evt/libevt.h</li></ul></td></tr><tr><td>ADK AGT</td><td><ul><li>libsvc_tms.so</li></ul></td><td><ul><li>agt/svc_tms.h</li><li>agt/tms_status.h</li></ul></td></tr><tr><td>SDI CLIENT</td><td><ul><li>libsdiclient.a</li><li>libsdiprotocol.so</li></ul></td><td><ul><li>sdiclient/sdi_if.h</li><li>sdiclient/sdiprotocol.h</li></ul></td></tr><tr><td>SDI C++ API</td><td><ul><li>libsdiapi.so</li></ul></td><td><ul><li>sdiapi/sdi.h</li></ul></td></tr><tr><td>INSTALLER</td><td><ul><li>libinstall.so</li></ul></td><td><ul><li>installer/installer.hpp</li></ul></td></tr></tbody></table>

### Open Source libraries

In addition to ADK APIs, applications can use the following provided Open Source libraries directly from within applications.

| **Component** | **libraries**                                    | **header files** | **Notes**                  |
| ------------- | ------------------------------------------------ | ---------------- | -------------------------- |
| OpenSSL       | <ul><li>libssl.so</li><li>libcrypto.so</li></ul> | all headers      |                            |
| Compression   | <ul><li>libz.so</li></ul>                        | all headers      |                            |
| CURL          | <ul><li>libcurl.so</li></ul>                     | all headers      |                            |
| SQLite        | <ul><li>libsqlite3.so</li></ul>                  | all headers      |                            |
| Libxml        | <ul><li>libxml.so</li><li>libxml2.so</li></ul>   | all headers      | added in OSS release 1.9.1 |

### Secondary Library dependencies

Provided client libraries have additional dependencies that are usually not reflected to the applications and they are being resolved internally.

Applications should only link to the above libraries, unless told differently.

### VOS3 Platform internal libraries

Do not use internal libraries

The SDK contains additional libraries not listed above as supported ADK or Open Source libraries.

These libraries do not expose public interfaces for applications and can be subject to change with new VOS3 releases.

{% hint style="danger" %}
Please do not use these libraries directly!
{% endhint %}

## Building Applications

The VOS3 toolchain comes with all typical tools to cross-compile and link applications:

| **Toolchain Application**                                                                                       | **Description**                                                     |
| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| arm-none-linux-gnueabihf-addr2line                                                                              | Convert addresses or symbol+offset into file names and line numbers |
| arm-none-linux-gnueabihf-ar                                                                                     | Create, modify, and extract from archives                           |
| arm-none-linux-gnueabihf-as                                                                                     | The portable GNU assembler                                          |
| arm-none-linux-gnueabihf-c++                                                                                    | GNU project C and C++ compiler                                      |
| arm-none-linux-gnueabihf-c++filt                                                                                | Demangle C++ and Java symbols                                       |
| arm-none-linux-gnueabihf-cpp                                                                                    | The C Preprocessor                                                  |
| arm-none-linux-gnueabihf-dwp                                                                                    | The DWARF packaging utility                                         |
| arm-none-linux-gnueabihf-elfedit                                                                                | Update ELF header and program property of ELF files                 |
| arm-none-linux-gnueabihf-g++                                                                                    | GNU project C and C++ compiler                                      |
| <p>arm-none-linux-gnueabihf-gcc</p><p>arm-none-linux-gnueabihf-gcc-11.2.1</p>                                   | GNU project C compiler                                              |
| arm-none-linux-gnueabihf-gcc-ar                                                                                 | Create, modify, and extract from archives                           |
| arm-none-linux-gnueabihf-gcc-nm                                                                                 | List symbols from object files                                      |
| arm-none-linux-gnueabihf-gcc-ranlib                                                                             | Generate an index to an archive                                     |
| arm-none-linux-gnueabihf-gcov                                                                                   | Coverage testing tool                                               |
| arm-none-linux-gnueabihf-gcov-dump                                                                              | Offline gcda and gcno profile dump tool                             |
| arm-none-linux-gnueabihf-gcov-tool                                                                              | Offline gcda profile processing tool                                |
| arm-none-linux-gnueabihf-gdb                                                                                    | The GNU Debugger                                                    |
| arm-none-linux-gnueabihf-gdb-add-index                                                                          | Add index files to speed up GDB                                     |
| arm-none-linux-gnueabihf-gprof                                                                                  | Display call graph profile data                                     |
| <p>arm-none-linux-gnueabihf-ld</p><p>arm-none-linux-gnueabihf-ld.bfd</p><p>arm-none-linux-gnueabihf-ld.gold</p> | The GNU linker                                                      |
| arm-none-linux-gnueabihf-lto-dump                                                                               | Tool for dumping LTO object files                                   |
| arm-none-linux-gnueabihf-nm                                                                                     | List symbols from object files                                      |
| arm-none-linux-gnueabihf-objcopy                                                                                | Copy and translate object files                                     |
| arm-none-linux-gnueabihf-objdump                                                                                | Display information from object files                               |
| arm-none-linux-gnueabihf-ranlib                                                                                 | Generate an index to an archive                                     |
| arm-none-linux-gnueabihf-readelf                                                                                | Display information about ELF files                                 |
| arm-none-linux-gnueabihf-size                                                                                   | List section sizes and total size of binary files                   |
| arm-none-linux-gnueabihf-strings                                                                                | Print the sequences of printable characters in files                |
| arm-none-linux-gnueabihf-strip                                                                                  | Discard symbols and other data from object files                    |

### Compiler and Linker Settings

The following tables give an overview of recommended compiler and linker flags for application development on VOS3 platform.

#### CFLAGS

<table><thead><tr><th width="335"></th><th></th></tr></thead><tbody><tr><td>--sysroot $(SYSROOT_DIR)</td><td>Set the sysroot path to the root directory of your installed SDK</td></tr><tr><td>-D_VOS3</td><td>Flagging for platform-dependent code</td></tr><tr><td>-fstack-protector-strong</td><td>Enable extra checks for buffer overflows and and stack smashing</td></tr><tr><td>-fPIE</td><td>Enable position independent executable (**only use for executables**)</td></tr><tr><td>-fPIC</td><td>Enable position independent code (**only for shared/static libraries**)</td></tr><tr><td>-Wall</td><td>Enable all warnings (see <a href="https://manpages.org/gcc">manual of gcc</a> for details)</td></tr><tr><td>-Wextra</td><td>Enable extra warnings (see <a href="https://manpages.org/gcc">manual of gcc</a> for details)</td></tr><tr><td>-Wformat=2</td><td>Enable format check for functions like printf, scanf, ...</td></tr><tr><td>-Wformat-security</td><td>Enable warning about potentially malicious use of format functions</td></tr><tr><td>-Werror=format-security</td><td>Make format-security warnings an error</td></tr><tr><td>-Wtrampolines</td><td>Warn about trampolines generated for pointers to nested functions</td></tr><tr><td>-Werror=trampolines</td><td>Make trampoline warnings an error</td></tr><tr><td>-Wreturn-type</td><td>Warn about missing return types</td></tr><tr><td>-Werror=return-type</td><td>Make return type warnings an error</td></tr><tr><td>-Wno-psabi</td><td>Suppress GCC notes about ABI changes for parameter passing (informational only; not affected by -Wall/-Wextra)</td></tr></tbody></table>

#### LDFLAGS

<table><thead><tr><th width="312"></th><th></th></tr></thead><tbody><tr><td>--sysroot $(SYSROOT_DIR)</td><td>Set the sysroot path to the root directory of your installed SDK</td></tr><tr><td>-L$(SYSROOT_DIR)/usr/local/lib</td><td>Add this directory of your installed SDK to the linker search path</td></tr><tr><td>-fPIE -pie</td><td>Enable position independent executable (only use for executables)</td></tr><tr><td>-Wl,-rpath,'$$$$ORIGIN'</td><td>Set RPATH</td></tr><tr><td>-Wl,-z,relro,-z,now,-z,noexecstack</td><td><p>relro - Don't create an ELF "PT_GNU_RELRO" segment header in the object.</p><p>now - Resolve all symbols on startup or dlopen</p><p>noexecstac - Marks the object as requiring executable stack.</p></td></tr></tbody></table>

#### 32 bits vs 64 bit user applications

Even if hardware and kernel supports 64 bits, application and ADK (executables and libraries) remain 32 bit. The goal is to keep compatibility between devices and also preserve size and performance.

This is enforced by packman.

### Example: Hello World

The following part shows key parts of a sample project using ADK-GUI and SDI-API components. It's based on a Makefile project which shows compilation and generation of VOS3 load packages.

Full source package can be obtained from Verifone support.

<details>

<summary><strong>Makefile</strong></summary>

```makefile
# Set path to toolchain
TOOLCHAIN_DIR:=/opt/vos3/bin
# Set path to SDK
SYSROOT_DIR:=$(HOME)/sdk/vos3/sdk-26
# Set path to packaging tool
PACKMAN:=packman
# Specify compilers and linker
CC:=$(TOOLCHAIN_DIR)/arm-none-linux-gnueabihf-gcc --sysroot $(SYSROOT_DIR)
CXX:=$(TOOLCHAIN_DIR)/arm-none-linux-gnueabihf-g++ --sysroot $(SYSROOT_DIR)
LD:=$(TOOLCHAIN_DIR)/arm-none-linux-gnueabihf-g++ --sysroot $(SYSROOT_DIR)
# Set CFLAGS
CFLAGS= -D_VOS3 -fstack-protector-strong -Wall -Wextra -Wformat=2 -Wformat-security -Werror=format-security -Wtrampolines -Werror=trampolines -Wno-psabi
CFLAGS_DEBUG= $(CFLAGS) -g -ggdb
# Set additional CXXFLAGS
CXXFLAGS= -std=c++14
CXXFLAGS_DEBUG= $(CXXFLAGS) -g -ggdb
# Set linker flags
LDFLAGS= -Wl,-rpath,'$$$$ORIGIN' -Wl,-z,relro,-z,now,-z,noexecstack
# Specify link libraries
LIBS= -lvfiguiprt -lsdiapi -lvfiipc
# Set project sources
SOURCE_RELEASE=main.cpp
SOURCE_DEBUG=$(SOURCE_RELEASE)
# Fetch object files for dependencies - No need to edit
OBJ:=$(patsubst %,obj/1/%,$(subst ..,_,$(patsubst %.cpp,%.o,$(patsubst %.cxx,%.o,$(SOURCE_RELEASE:.c=.o)))))
OBJ2:=$(patsubst %,obj/2/%,$(subst ..,_,$(patsubst %.cpp,%.o,$(patsubst %.cxx,%.o,$(SOURCE_DEBUG:.c=.o)))))
DEP:=$(OBJ:%.o=%.d) $(OBJ2:%.o=%.d)
OBJDIR:=obj/1 obj/2
# release build target
vos3demo: $(OBJ)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
# debug build target
vos3demo-debug: CFLAGS:=$(CFLAGS_DEBUG)
vos3demo-debug: CXXFLAGS:=$(CXXFLAGS_DEBUG)
vos3demo-debug: $(OBJ2)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
# full distribution build
dist: dist-debug dist-release dist-remove
# release distribution build
dist-release: dist/dl.vos3_demo.tar
dist/dl.vos3_demo.tar: vos3demo
mkdir -p dist dist_tmp_rel/vos3demo/demo/
cp manifest.json dist_tmp_rel/vos3demo/
cp -r www dist_tmp_rel/vos3demo/demo/
cp vos3demo dist_tmp_rel/vos3demo/demo/
(cd dist_tmp_rel; $(PACKMAN) build -t vos3 -s dev -i vos3demo -f -d ../dist/dl.vos3_demo.tar)
rm -Rf dist_tmp_rel
# debug distribution build
dist-debug: dist/dl.vos3_demo-debug.tar
dist/dl.vos3_demo-debug.tar: vos3demo-debug
mkdir -p dist dist_tmp_dbg/vos3demo/demo/
cp manifest.json dist_tmp_dbg/vos3demo/
cp -r www dist_tmp_dbg/vos3demo/demo/
cp vos3demo-debug dist_tmp_dbg/vos3demo/demo/vos3demo
(cd dist_tmp_dbg; $(PACKMAN) build -t vos3 -s dev -i vos3demo -f -d ../dist/dl.vos3_demo-debug.tar)
rm -Rf dist_tmp_dbg
# remove package distribution build
dist-remove: dist/dl.vos3_demo-remove.tar
dist/dl.vos3_demo-remove.tar:
mkdir -p dist dist_tmp_rem
cp manifest-rem.json dist_tmp_rem/manifest.json
(cd dist_tmp_rem; $(PACKMAN) build -s dev -t vos3 -i . -f -d ../dist/dl.vos3_demo-remove.tar)
rm -Rf dist_tmp_rem
# clean target
clean:
rm -rf obj compile_commands.json vos3demo vos3demo-debug
# distribution clean target
dist-clean: clean
rm -rf dist
# phony targets
.PHONY: clean dist-clean dist-remove dist-debug dist-release dist
################################################################################
# HELPERS - No need to edit
################################################################################
define add_rule =
$(1)/%.o: %.c
@mkdir -p $$(@D)
$$(CC) $$(CFLAGS) -c -o $$@ $$< -MT $$@ -MMD -MP -MF $(1)/$$*.d
$(1)/%.o: %.cpp
@mkdir -p $$(@D)
$$(CXX) $$(CFLAGS) $$(CXXFLAGS) -c -o $$@ $$< -MT $$@ -MMD -MP -MF $(1)/$$*.d
$(1)/%.o: %.cxx
@mkdir -p $$(@D)
$$(CXX) $$(CFLAGS) $$(CXXFLAGS) -c -o $$@ $$< -MT $$@ -MMD -MP -MF $(1)/$$*.d
$(1)/_/%.o: ../%.c
@mkdir -p $$(@D)
$$(CC) $$(CFLAGS) -c -o $$@ $$< -MT $$@ -MMD -MP -MF $(1)/_/$$*.d
$(1)/_/%.o: ../%.cpp
@mkdir -p $$(@D)
$$(CXX) $$(CFLAGS) $$(CXXFLAGS) -c -o $$@ $$< -MT $$@ -MMD -MP -MF $(1)/_/$$*.d
$(1)/_/%.o: ../%.cxx
@mkdir -p $$(@D)
$$(CXX) $$(CFLAGS) $$(CXXFLAGS) -c -o $$@ $$< -MT $$@ -MMD -MP -MF $(1)/_/$$*.d
endef
$(foreach p,$(OBJDIR),$(eval $(call add_rule,$(p))))
-include $(DEP)
```

</details>

<details>

<summary><strong>main.cpp</strong></summary>

```cpp
#include <html/gui.h>
#include <html/jsobject.h>
#include <sdiapi/sdi.h>

int main(int argc, char **argv) {
    (void) argc; (void) argv;
    vfigui::stringmap values;
    values.insert(std::make_pair("header_title", "Hello VOS3 World"));
    vfisdi::SDIClient client;
    client.setProtocol(vfisdi::SDIClient::PROTOCOL_C);
    if(vfisdi::OK != client.connect("127.0.0.1")) {
        return 1;
    }
    
    int ret = -1;
    while(ret != 0) {
        switch(ret) {
            case 1: {// Get SDI Info
                std::vector<vfisdi::SDIClient::ComponentVersion> info;
                client.sysGetSDIVersion(info);
                std::string sn;
                client.sysGetSerialNumber(sn);
                std::string vv;
                client.sysGetPropertyString(vfisdi::SYS_PROP_VAULT_VERSION, vv);
                std::string os;
                client.sysGetPropertyString(vfisdi::SYS_PROP_OS_VERSION, os);
                vfihtml::JSObject obj;
                for(size_t i = 0; i < info.size(); i++)
                    obj[i] = info[i].name + " - " + info[i].version;
                obj[obj.size()] = "VOS3: " + os;
                obj[obj.size()] = "K81: " + vv;
                obj[obj.size()] = "S/N: " + sn;
                values.insert(std::make_pair("infos", obj.dump()));
                break;
            }
            default:
                break;
        }
        ret = vfigui::uiInvokeURL(values, "index.html");
        values.erase("infos");
    }
    client.close();
    return 0;
}
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verifone.com/adk-os-platform/readme/developing-applications/developing-application.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
