How to compile for H/PC 2.0 using eVC++
Mike Welch, Dallas
---------------------------------------
After weeding through several broken links, I managed to find the
proper SDK on Microsoft's site. The SDK file is called mplatsdk.exe.
The documentation says it's for Visual Studio v5/6 and "other
compilers", but doesn't say what other compilers it supports. I won't
post the URL here since it may be moved in the future, but at this
time at least you can easily find it by searching the downloads area
of microsoft.com for it. If that fails, try Google. Currently you
can find it via both. This contains the files you need to compile and
link, in addition to the samples and the OLD emulator that I'm fairly
certain is NOT compatible with eVC v3.x. I did run the emulator
stand-alone, however, and it ran fine, so you can probably still test
with it, just not through eVC++.
There may be an easier way to do this, but this is what worked for me.
I now have my YachtCE app compiling across 9 different OS/hardware/CPU
combinations, including a H/PC 2.0 Jornada 660. YachtCE may work on
other older machines too, such as the HP 360LX...anybody got one
they'd be willing to try it on? :)
Things you'll need to know
--------------------------
Disclaimer: I am not responsible for anything (ask my mother!).
Seriously, no liability, do at your own risk!
For reference, the directory structure was different in the 2.0 days.
If "root" is where you tell the SDK to install, you will be interested
in these paths resulting from the installation:
Includes: <root>\wce\include\HPC
Libraries: <root>\wce\lib\wce200\HPC\<device>
Add to path: <root>\wce\bin (and all below)
Note that the include directory is the same for all CPUs, but not the
libraries path. <device> above, in other words, would be wcemips for
MIPS.
Steps to get this to work
=========================
First of all, download the SDK and, after you make sure eVC isn't
running, install it. Then follow the remaining steps below.
Registry Hack
-------------
This will add a new platform to eVC. It's ugly. Make sure there are
no small children around. You wouldn't want them to see this. ;-)
I recommend at least backing up your registry, creating a new system
restore point, or doing a full backup (preferred) before you start.
. Exit EVC if it's up.
. Run RegEdit
. Search for "H/PC Pro 2.11" in the registry. It'll be under "Windows
CE Tools". If you don't find it, you didn't install it with eVC.
Here are some other platforms you can search for, listed exactly as
found in my registry:
. Palm-size PC 2.11
. POCKET PC 2003
. Smartphone 2002
. Pocket PC 2002
. or, if you're so inclined:
HKLM\SOFTWARE\Microsoft\
Windows CE Tools\
Platform Manager\
{F384D888-F9AA-11D1-BB9E-00A0C9C9CCEE}
. Create a new GUID under the path above, or just use the one I
created: {8FBDDEC5-E014-4528-BC2F-B4A3E9247F0F}
. Export the "H/PC Pro 2.11" entry (including all children) to a
RegEdit v4 (non-Unicode) file.
. If you don't have H/PC Pro 2.11 installed, you'll have to base
your new eVC platform on what is in there. Hint: A .NET entry won't
work :)
. On my box, the GUID for H/PC Pro 2.11 is
{74239C21-1DCA-11D2-9747-00A0240918F0}
. Using a plain text editor, go edit your exported *.reg file and
search/replace the H/PC Pro's GUID with the new GUID you added
. Go back into RegEdit.
. Import your edited *.reg file. You should now see lots of stuff
under the new entry you created earlier.
. Change the value of the (default) entry to "H/PC 2.0" [without the
quotes].
. Browse the keys within your new platform and change all entries that
refer to CE version 2.1.1 to 2.0.0 and you're done with the hack!
Change Settings in EVC
----------------------
You now need to change the paths for the new platform so it points to
the right include, lib, etc. paths.
. When you go back into EVC you should now see your HPC 2.0 entry in
the "Active Configuration" drop-down.
. A new entry will also show under Tools/Platform Manager
Configuration
. Go to Tools/Options, Directories Tab, and change your path
information to where you installed the H/PC 2.0 SDK. I didn't delete
anything, only added new paths, so in case something eVC expects isn't
defined, it'll fall back on the original settings.
. Ignore the settings for the ARM processor listed. The HPC 2.0 SDK
does not have libraries for ARM.
. Move your new entries to the TOP of the dialog using the up/down
arrow icons for each path you add for each group (executable, include,
etc).
That's it! After doing this I was able to compile and link for the
new platform! Well...after a few tweaks to my code (see below).
ISSUES - SH3
------------
In my single test (compiling YachtCE), I found that there were two
unresolved externals (meaning they're defined in the includes, just
not implemented).
. wcstol, which I was able to replace with _wtoi (which IS defined)
because I didn't really need the base conversion element.
. memset, which I wrote a replacement for (see below).
ISSUES - MIPS
-------------
. I got the same "error LNK2001: unresolved external symbol memset"
that I got on the SH3, so I plugged my replacement in.
. Then I got "error C2169: 'memset' : intrinsic function, cannot be
defined". Go figure...
. The fix for this was to rename all references to memset to Zmemset
for MIPS. Ugly.
With the additional changes listed above, I tested YachtCE.exe on the
Jornada 660 (SH3) HPC 2.0 and it worked fine. I don't have a HPC 2.0
MIPS machine to test it on, but I'm fairly confident it'll be fine.
ISUES - OTHER
-------------
. My app was using Tahoma and Courier New fonts which didn't exist on
the 660, so I changed them to Arial and Courier respectively.
// Replacement for memset that isn't defined in HPC 2.0 bin files.
// This could be dangerous if I have a bug...double check it
// Compiled fine in my .C app, not sure about C++
void *memset(void *dest, int c, size_t count)
{
unsigned int i;
char *p;
p = (char *) dest;
for (i = 0; i < count; i++)
p[i] = c;
return dest;
}
<EOF>