Porting Guide

This page gives a high-level overview of the porting process to use Open NFC with new software or hardware environment. Note that each Open NFC Edition includes also a Porting Guide document that contains more detailed information on what needs to be done in the specific environment.

Quick access: overview , supporting new software environment , supporting new hardware

 

Overview

Typically, you will need porting Open NFC if you are creating a new device with NFC feature, for example a smartphone.

The first step consists of knowing properly your target device: what operating system is running on the device, what is the stack depth, what memory allocator is available, what synchronization objects are available, what is the timer resolution, and so on.

You also need to know which NFC hardware you will be using. Open NFC is mainly developed by Inside Secure, and as such it works best with Inside Secure’s NFC hardware (MicroRead / SecuRead), although the stack is really designed to be hardware-independent and can be used with any NFC hardware.

As described in the General Principles page, the stack is split in two major parts: the hardware-independent core, and the NFC Hardware-specific layer.

Porting the hardware-independent core is usually straight-forward: you need to provide a few features from the operating system (memory operations, debug traces, synchronization routines, …), decide a few important options for compilation of the stack, and voilà. Check the section “Supporting new software environment” below for more information.

Porting the hardware-specific layer (called NFC HAL module) is more work, since it depends on the hardware itself and on how the hardware is connected to the device. If you are working with NFC hardware already supported by Open NFC, you will find useful porting tips in the included porting guides, check the NFC Hardware sidebar menu for more information. If you are planning to use unsupported hardware, you will need to write your own NFC HAL module (then, feel free to contribute it back to us). Please refer to the hardware section below for more information.

Back to top

 

Supporting new software environment

Porting the Open NFC core stack is described in great detail in the following document included in the Open NFC Core Edition (under /core/porting):

In summary, the porting steps consist in:

  1. Deciding on the target architecture of the stack (monolithic, client-server, or user-kernel) and other configuration parameters, and creating the appropriate porting_config.h file.
  2. Providing a few functions from the runtime library for the memory operations, synchronization, debug, … described in porting_os.h.
  3. A couple of other files may need to be tweaked also: porting_types.h, porting_inline.h, …

It is always a good idea to start from the Open NFC Edition that is closest to your target environment. For example, the Android Edition of Open NFC includes a Java library on top of the Open NFC native API that implements the standard Android NFC API.

The Hardware-specific module (NFC HAL module) may also need some configuration and/or runtime functions to be run on the new software environment. This is dependent on the NFC HAL module itself. You should refer to the NFC HAL module documentation for more information on porting this module to your new environment. For reference, see for example this document (included in NFC HAL for MicroRead Edition):

The procedure will most probably vary from one NFC HAL module to another.

Back to top

 

Supporting new hardware

The Open NFC core stack uses an internal API (the NFC HAL API) and a dedicated protocol (the NFC HAL Protocol) to communicate with the hardware-specific layer (NFC HAL module).

The role of this NFC HAL module is to convert the NFC HAL Protocol message to the specific NFC chipset “language”, as well as managing all the environment of the NFC chipset (communication channel, interruptions, etc.)

Creating a new NFC HAL module is a complex work that requires a good knowledge of both the Open NFC stack and the NFC chipset.

You can find more detailed information in the following documents included in the Open NFC Core Edition (under /core/porting):

If you are planning to create a new NFC HAL module, we encourage you to contact us so that we can support and organize your effort. Please check the Development page for more information.

Back to top

 

Except as noted otherwise, this content is licensed under the terms of the Apache 2.0 License. For details and restrictions, see the Content License.
Open NFC is a registered trademark of Inside Secure, All logos and graphics are copyrighted.