The easiest thing is to use an existing device model from RVDS installation as a base and modify it from there. For example, let assume you want to use the timer model as a base. You should be able to locate file
timer.c and folder timer.b in RVARMulator\ExtensionKit\1.4.1\win-32-pentium\armulator in your RVDS installation folder. Make copy of each into mytimer.c and mytimer.b, respectively. You should be able to locate the Makefile within the mytimer.b folder. In the Makefile, rename all 'timer' occurrences into 'mytimer' and 'Timer' into 'MyTimer' in the Makefile. You could choose any other names you like for 'mytimer' and 'MyTimer', of course.The best way to compile the device model is to use the "Visual Studio 2005 Command Prompt" from the Start menu > All Programs > Visual C++ 2005 Express Edition > Visual Studio Tools. This custom command prompt sets up the appropriate environment variables to effectively use MSVC++ Express from the command line. If you prefer to configure your own environment variables, make sure you add <install>
\VC\INCLUDE into INCLUDE, <install>\VC\LIB and <install>\Common7\IDE;<install>\VC\BIN into Path, where <install> is where you have installed MSVC Express. In particular, if you forgot to include <install>\Common7\IDE;, you would get this when you issue nmake:
cl /c /Za /I..\.. /I..\..\..\armulif /I..\..\..\rdi
/I..\..\..\clx /D_CONSOLE /D_MBCS /DNLS /nologo
/W3 /GX /GR /WX -DRDI_VERSION=151 -DARM10MODEL
/O2 /G6 /MD /DNDEBUG
/DARM_RELEASE="\"RVARMulatorISS1.4.1\""
/DBUILD_NUMBER=290 /Iderived /Fomytimer.obj
..\..\mytimer.c
NMAKE : fatal error U1077: '...\cl.EXE' : return
code '0xc0000135'
And if you explicitly issue the linking command above you would get an "
mspdb80.dll not found" error. So make sure <install>\Common7\IDE in your Path environment variable.Once you have got the environment variables out of the way, when you issue
nmake you would still get a small error as shown below:
..\..\..\armulif\perip_sordi.h(184) : error C2220:
warning treated as error - no 'object' file
generated
..\..\..\armulif\perip_sordi.h(184) : warning C4996:
'sprintf': This function or variable may be unsafe.
Consider using sprintf_s instead. To disable
deprecation, use _CRT_SECURE_NO_WARNINGS. See
online help for details.
D:\msvcx\VC\INCLUDE\stdio.h(345) : see declaration
of 'sprintf'
NMAKE : fatal error U1077: '...\cl.EXE' : return
code '0x2'
ARM has chosen to treat every warning as error with option
/WX. Nobel, yes, but it is not future-proof. Apparently, with the latest Visual C++ sprintf and other buffer clobbering functions that do not specify the buffer length would generate a warning. Removing the option from the Makefile would do the trick.