Recent

Author Topic: WinCE tutorials and compiling problems  (Read 12279 times)

CCRDude

  • Hero Member
  • *****
  • Posts: 525
WinCE tutorials and compiling problems
« on: June 08, 2006, 06:18:26 pm »
I decided to play around with developing for Win CE; knowing the hazzle in Palm and Symbian development, I thought it would be nice to have good old Lazarus deal with it ;)

First thing I noticed though was that the tutorial was helpful in small parts, but since it seems targeted at stand-alone FPC, it was quite difficult to implement for Lazarus (it also contained wrong paths even for simple FPC and all that). So I've been protocolling my steps in our local Wiki to have a tutorial especially for Lazarus, and I was partly successful so far. I've got a few topics though I could use help on (I'm absolutely new to the Pocket PC OS, the device is a Compaq iPAQ H3870 running Pocket PC 2002, just after a hard reset):

* (updated) Installed PocketCmd, which didn't run until I installed PocketConsole as well (maybe should be mentioned in the wiki tutorial?). Then I started the test.exe both from command line and the file manager - the console/file manager just complete hangs, I have to do a reset to get them to react again (killing the task does not work).

Now I guess I could skip command line apps and go to a GUI app right away, but while Lazarus is all set up, when compiling a form with an edit and a button (widgetset, os, processor and compiler correctly set), I receive a (edit: both with Lazarus and a simple ppcrossarm projectname.lpr)

Code: [Select]
C:\apps\Lazarus\lcl\units\arm-wince\LCLStrConsts.o: file not recognized: File format not recognized

I did compile the LCL according to the tutorial:
Code: [Select]
C:
cd \Apps\Lazarus
make lcl LCL_PLATFORM=wince PP=ppcrossarm.exe CPU_TARGET=arm OS_TARGET=wince

And the IDE doesn't complain about any missing files etc.. I also created the fpc.cfg a bit more complex than the tutorial:
Code: [Select]
-Twince
 -FuC:\Apps\Lazarus\pp\units\arm-wince
 -FuC:\Apps\Lazarus\pp\units\arm-wince\*
 -FuC:\Apps\Lazarus\pp\units\arm-wince\rtl
 -XParm-wince-
 -FDC:\Apps\arm
 -FDC:\Apps\Lazarus\pp\bin\arm-wince

because I decided to mirror the structure of i386-win32 instead of just putting all files into the same folder like in the tutorial.

So, my questions:
* Does that stuff above run on a Pocket PC 2002 device at all?
* How do I get it to run if it does?
* Where's the problem in Lazarus with the file format?

CCRDude

  • Hero Member
  • *****
  • Posts: 525
RE: WinCE tutorials and compiling problems
« Reply #1 on: June 09, 2006, 02:01:07 pm »
Update:
I got PocketCmd to work as well as some other apps, so the device seems to work (see above edit).

I checked the compiled test.exe, and inside the .data segment, it displays FPC 2.1.1 [2006/06/08] for arm - WinCE, so it's at least the correct compiler (.rdata and .pdata segments also wouldn't appear in ppc386 compile).
The import table shows usage of coredll.dll instead of the Win32 dlls, so I assume the correct libraries have been linked.

Still can't get either the simple command line thing (hangs) to run on the device nor Lazarus to compile  :(

tony72

  • New Member
  • *
  • Posts: 13
RE: WinCE tutorials and compiling problems
« Reply #2 on: June 10, 2006, 04:33:43 pm »
I don't know what the problem is, but I can tell you that test.exe hangs exactly the same way on my ipaq 3850 running Windows Mobile 2003, so whatever the problem is, it's not a Pocket PC 2002 issue. I'm pretty the stuff should run perfectly well on PPC 2002.

I'm going to set up the wince stuff from scratch again, and try to see if I did something wrong last time around :(.

Anonymous

  • Guest
RE: WinCE tutorials and compiling problems
« Reply #3 on: June 10, 2006, 06:45:13 pm »
Thanks for the answer! Knowing that test.exe won't necessarily work already helps a lot ;)
Meanwhile I installed the emulator on another machine (main machine is 64 bit, there the emulator won't sync with ActiveSync since the network driver for the emulator is 32 bit only), and actually got it to compile!

I posted my way of getting Lazarus to do WinCE in my Wiki user page (primarily because I also had it formatted in Wiki style for our internal Wiki and didn't want to adjust to the forum first *g*). It seems that either because this other machine is 32 bit (but Win32 Lazarus also compiles on Win64), or because I made paths all lowercase this time, it now works. Well, works means that there now is a 15 MB executable that's showing to be a WinCE app in its PE headers; I've neither got the device nor the emulator here to test, but will do so asap tomorrow ;)

CCRDude

  • Hero Member
  • *****
  • Posts: 525
RE: WinCE tutorials and compiling problems
« Reply #4 on: June 11, 2006, 10:32:12 am »
Well, GUI application works quite fine on emulator and device, that's great!
I'll probably write a Win-Lazarus mini-app for automating all the installation steps right now, to be able to repeat it quickly with new versions ;)

My questions:
1. How can I get a "normal" window; "normal" meaning auto alignment to maximal window size and window title in the common place?
2. Is there a workaround for the exit-only-after-another-click bug?
3. How do I reduce the file size (can I also use smart-linking? GUI option for that won't help)?
4. FindFirst/FindNext won't work with the Windows folder or some files in there, is there maybe another special attribute that would be needed to be included in faAnyFile on WinCE?

And a few other things I noticed using WinCE:
* Rotating the display, alignments (alTop, alClient) etc. won't be used
* WindowState = wsMaximized does minimize the window to title only
* While normally the Windows menu is at the top, a Lazarus app will move the Windows menu to the bottom with its own header on top.
* MessageDlg is not modal, and in the background
* TCustomForm.ShowModal does not draw correctly; buttons of new form get overlayed over old form, only when focusing a button the whole form appears.
* TLabel.Font.Size = 0 is different from other font sizes; had to manually adjust them to 9.

tony72

  • New Member
  • *
  • Posts: 13
WinCE tutorials and compiling problems
« Reply #5 on: June 11, 2006, 04:12:44 pm »
Thanks for posting your installation wiki, I just followed that to get a working setup for compiling GUI pocket pc apps, very helpful.

I'd like to know the answers to your q1 & 4 myself. As to the two-clicks-to-exit bug, calling close in the forms OnClose gets around that. And as for reducing the exe size, arm-wince-strip takes "hello word" from 16MB to 2MB. Or did you mean reduce the size beyond what strip does? 2MB is still quite large for hello world :).

CCRDude

  • Hero Member
  • *****
  • Posts: 525
WinCE tutorials and compiling problems
« Reply #6 on: June 11, 2006, 06:07:51 pm »
1. I think that the whole window management needs still a lot of work, the more I played around with it, the more problems with multiple windows etc. I found ;) I need at least a simple Yes/No dialog box; well, maybe I'll look into the CE APIs and call it directly...
(update: the MessageBox function works fine if really fed with PWideChar (typecasted from WideString, not AnsiString!), so this'll do for my sub windows)

2. I added a formMain.Close to my OnClose event, but that didn't change anything (update: my fault... I also had a thread still not freed, not that workaround works around :) ).

3. Well, I was thinking about all that smartlinking stuff since a look into the file showed a bunch of debug data that wouldn't be necessary, but I didn't think about the strip command - thanks a lot for the tip, that's sufficient for me for now :)

4. MSDN: file attributes: it seems WinCE has quite a lot more attributes than Win32. Based on that I would guess that the files not shown are ROM files with attribute FILE_ATTRIBUTE_INROM, which is not part of faAnyFile. I'm going to play around some with those attributes tomorrow.

5 (new). What works fine in the emulator just shows very very shortly on the actual device - I just see the main form buttons, then it automatically closed itself again.

 

TinyPortal © 2005-2018