Building sample FMs in emulation mode on Windows

This chapter provides instructions on how to compile the sample FM projects in the Windows environment.

The process consists of the following steps:

1.Copy the samples and emulation source folders.

2.Set the environment variables.

3.Compile the binaries.

Copy the samples and emulation source folders

Microsoft recommends against creating and editing files in the Program Files folder. To avoid running into issues with the UAC, copy the samples folder and the emul folder to a separate folder. These will be referred to as the %SRC% and %EMUL% folders respectively.

Set the environment variables

1.Open a Visual Studio Command Prompt to load the Visual studio compiler.

2. Run the fmsdkvars.bat file found in the FM-SDK installation folder to set the %FMDIR% and %CPROVDIR% environment variables.

%FMDIR%\bin\fmsdkvars.bat

3.Set the %OUTDIR% environment variable. This is the folder where the emulation libraries will be created.

set OUTDIR=c:\fmdemo

4. Set the %FM_BIN% environment variable. This is the name of the FM emulation library.

set FM_BIN=fm-restrict

Compile the binaries

1.Navigate to the sample folder's FM directory (e.g. %SRC%\restrict\fm) and run nmake -f nt.mak

cd %SRC%\restrict\fm

nmake -f nt.mak

2. Navigate to the sample folder's host directory (e.g. %SRC%\restrict\host) and run nmake -f nt.mak

cd %SRC%\restrict\host

nmake -f nt.mak

3. Navigate to the %EMUL% folder and run nmake -f nt.mak

cd %EMUL%

nmake -f nt.mak

4. Navigate to the %OUTDIR% folder:

cd %OUTDIR%

5. In there, you should have the following files:

%FM_BIN%.dll

%CLIENT_BIN%.exe

cryptoki.dll

ethsm.dll

6.Run the executable to test the FM.