Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-08

arm-wince step1

20 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Oro06

Hi,

the good new is the following prog RUN on arm-wince-pda :

var T: text;
begin
  assign(T,'\toto.pas');
  rewrite(T);
  close(T);
end.

-> create the empty file as expected, with no error :)

the bad news is with writeln, every time i try to use it to write in the file or even
in the std output (console) a simple 'hello world' same error at same place. tried with inline const, string variable and widestring varaible , here latest dump
with widestring variable :

1109c: e1a01004 mov r1, r4
110a0: e3a00000 mov r0, #0 ; 0x0 110a4: eb007733 bl 2ed78 <FPC_WRITE_TEXT_WIDESTR> 110a8: eb0052d0 bl 25bf0 <FPC_IOCHECK> 110ac: e1a00004 mov r0, r4
<- here (according to objdump) runtime error 103 (103 mean ' The semaphore cannot be set again' )
110b0: eb00751b bl 2e524 <FPC_WRITELN_END> 110b4: eb0052cd bl 25bf0 <FPC_IOCHECK>

Any suggestion ?
i'll have a look insinde FPC_WRITE_TEXT_WIDESTR

Regards

Reply by email

Florian Klaempfl
to Oro06
Oro06 wrote 33 lines
Hi, the good new is the following prog RUN on arm-wince-pda : var T: text; begin assign(T,'\toto.pas'); rewrite(T); close(T); end. -> create the empty file as expected, with no error :) the bad news is with writeln, every time i try to use it to write in the file or even in the std output (console) a simple 'hello world' same error at same place. tried with inline const, string variable and widestring varaible , here latest dump with widestring variable : 1109c: e1a01004 mov r1, r4 110a0: e3a00000 mov r0, #0 ; 0x0 110a4: eb007733 bl 2ed78 <FPC_WRITE_TEXT_WIDESTR> 110a8: eb0052d0 bl 25bf0 <FPC_IOCHECK> 110ac: e1a00004 mov r0, r4 <- here (according to objdump) runtime error 103 (103 mean ' The semaphore cannot be set again' ) 110b0: eb00751b bl 2e524 <FPC_WRITELN_END> 110b4: eb0052cd bl 25bf0 <FPC_IOCHECK> Any suggestion ? i'll have a look insinde FPC_WRITE_TEXT_WIDESTR

Probably some bug in the error handling. FPC_IOCHECK checks the result of the write so that error location is quite logical. Unfortunatly none of the core developers has a wince pda so we can't test or make patches.

Reply by email

Yury Sidorov
to Oro06: the good new is the following prog RUN on arm-wince-pda : var T: text; begin…

Hi,

Writeln to console does not work currently. Writeln to file works (at least it worked for me).

Yury Sidorov.

Earlier message 43 lines
----- Original Message ----- From: "Oro06" To: Sent: Monday, August 08, 2005 5:39 PM Subject: [fpc-devel] arm-wince step1 Hi, the good new is the following prog RUN on arm-wince-pda : var T: text; begin assign(T,'\toto.pas'); rewrite(T); close(T); end. -> create the empty file as expected, with no error :) the bad news is with writeln, every time i try to use it to write in the file or even in the std output (console) a simple 'hello world' same error at same place. tried with inline const, string variable and widestring varaible , here latest dump with widestring variable : 1109c: e1a01004 mov r1, r4 110a0: e3a00000 mov r0, #0 ; 0x0 110a4: eb007733 bl 2ed78 <FPC_WRITE_TEXT_WIDESTR> 110a8: eb0052d0 bl 25bf0 <FPC_IOCHECK> 110ac: e1a00004 mov r0, r4 <- here (according to objdump) runtime error 103 (103 mean ' The semaphore cannot be set again' ) 110b0: eb00751b bl 2e524 <FPC_WRITELN_END> 110b4: eb0052cd bl 25bf0 <FPC_IOCHECK> Any suggestion ? i'll have a look insinde FPC_WRITE_TEXT_WIDESTR Regards

Reply by email

Oro06
to Florian Klaempfl: Probably some bug in the error handling. FPC_IOCHECK checks the result of the write so…
Florian Klaempfl wrote
Probably some bug in the error handling. FPC_IOCHECK checks the result of the write so that error location is quite logical.

i just tried the same prog targetting i386-wince4.2 (emulator) compiling give this warning :
cannot find entry symbol __WinMainCRTStartup; defaulting to 00401000

writln(ing) in text file run without error message but writeln to std console give the same error.

emu

Show quoted text 6 lines
Unfortunatly none of the core developers has a wince pda so we can't test or make patches.

i386-wince emulator can be obtained by many ways (legal), the simpliest is to download just the free standalone emulator package here :
http://www.microsoft.com/downloads/details.aspx?FamilyID=a120e012-ca31-4be9-a3bf-b9bf4f64ce72&DisplayLang=en then you can have a shared directory with the host pc ...

i've a question concerning rtl tree :
what is the goal of win dir (common with win32 an winCE ?) regards

Reply by email

Oro06
to Yury Sidorov

Great !

1°) i had a look to the writeln pb ie text to std output give a runtime error 103.
so i tried the same code with evc-> the result: nothing appear in fact cmd.exe is not installad by default on pda's ie not text console, no CON: device
but this can be installed with external tools (ms provide one with PowerToys,but there are others on the net)
After that cmd.exe is installed, running the previous simpliest printf progs, show the expected text
in a text window, existing of console.dll in \windows dir have been detected and stdout only difference is that a new console is opened every time, even if hello.exe is run from a console !

looking at the assembler of generated exe, we can see that during startup there is a call to '_cinit' just before the winmain. this _cinit then call 2 times '_initterm'
both _cinit and _initterm are located in crt0dat.c (and wince version sources are provided with vs2005beta2)

inside crt0dat.c there is an external pointer list declaration (this is used by initterm) :
[...]
extern _CRTALLOC(".CRT$XIA") _PIFV __xi_a[];
extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[]; /* C initializers */ [...]
it is declared here but filled ? in an other part and i can't find where.

Any idea on that is welcomed :)

2°)Yuri, concerning the .h migration, if you already planned to start something, in wich order ?
(not enough ressources to do the same thing twice !)

3°) i'ld like to use sqllite (on pda), any feed back on that ?

regards

Yury Sidorov wrote 15 lines
Hi, The latest info about WinCE port can be found here: http://www.freepascal.org/wiki/index.php/WinCE_port Yury Sidorov. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Florian Klaempfl
to Oro06
Oro06 wrote 15 lines
Great ! 1°) i had a look to the writeln pb ie text to std output give a runtime error 103. so i tried the same code with evc-> the result: nothing appear in fact cmd.exe is not installad by default on pda's ie not text console, no CON: device but this can be installed with external tools (ms provide one with PowerToys,but there are others on the net) After that cmd.exe is installed, running the previous simpliest printf progs, show the expected text in a text window, existing of console.dll in \windows dir have been detected and stdout configured at runtime. the only difference is that a new console is opened every time, even if hello.exe is run from a console !

Maybe this could be added to the wiki?

Show quoted text 14 lines
looking at the assembler of generated exe, we can see that during startup there is a call to '_cinit' just before the winmain. this _cinit then call 2 times '_initterm' both _cinit and _initterm are located in crt0dat.c (and wince version sources are provided with vs2005beta2) inside crt0dat.c there is an external pointer list declaration (this is used by initterm) : [...] extern _CRTALLOC(".CRT$XIA") _PIFV __xi_a[]; extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[]; /* C initializers */ [...] it is declared here but filled ? in an other part and i can't find where.

Maybe by the startup code?

Show quoted text 5 lines
Any idea on that is welcomed :) 3°) i'ld like to use sqllite (on pda), any feed back on that ?

The WinCE port is a few weeks old so you are working with really bleeding edge code :)

But I see no point why it shouldn't work if the rtl gets more complete i.e. windows, classes and sysutils unit.

Show quoted text 26 lines
regards Yury Sidorov a écrit : > Hi, > > The latest info about WinCE port can be found here: > http://www.freepascal.org/wiki/index.php/WinCE_port > Yury Sidorov. > > > _______________________________________________ > fpc-devel maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-devel > > > > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Yury Sidorov
to Oro06: Great ! 1°) i had a look to the writeln pb ie text to std output give a runtime error…

1. I got FPC to work with WinCE console. Expect a rtl sources update soon.

2. Since H2PAS dont eat MS headers the easiest way to port is to use win32 Windows unit and remove all functions which are missing in WinCE. The following list of WinCE functions can be used as reference: http://www.rainer-keuchel.de/wince/dllexports/ipaq-coredll.txt First of all there are almost no functions with A suffix and they must be removed.
Also some functions exists as wrappers (SetEvent,ResetEvent). Some of them already implemented in system.pp

You can start this task. Currently nobody do it. If you will start it, please write about that at wiki and specify your contacts.

3. I think sqllite is dependent from Windows,SysUtils,Classes,etc. We need to port them first.

Yury Sidorov.

Earlier message 64 lines
----- Original Message ----- From: "Oro06" To: "FPC developers' list" Sent: Friday, August 12, 2005 6:12 PM Subject: Re: [fpc-devel] WinCE port docs at wiki Great ! 1°) i had a look to the writeln pb ie text to std output give a runtime error 103. so i tried the same code with evc-> the result: nothing appear in fact cmd.exe is not installad by default on pda's ie not text console, no CON: device but this can be installed with external tools (ms provide one with PowerToys,but there are others on the net) After that cmd.exe is installed, running the previous simpliest printf progs, show the expected text in a text window, existing of console.dll in \windows dir have been detected and stdout only difference is that a new console is opened every time, even if hello.exe is run from a console ! looking at the assembler of generated exe, we can see that during startup there is a call to '_cinit' just before the winmain. this _cinit then call 2 times '_initterm' both _cinit and _initterm are located in crt0dat.c (and wince version sources are provided with vs2005beta2) inside crt0dat.c there is an external pointer list declaration (this is used by initterm) : [...] extern _CRTALLOC(".CRT$XIA") _PIFV __xi_a[]; extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[]; /* C initializers */ [...] it is declared here but filled ? in an other part and i can't find where. Any idea on that is welcomed :) 2°)Yuri, concerning the .h migration, if you already planned to start something, in wich order ? (not enough ressources to do the same thing twice !) 3°) i'ld like to use sqllite (on pda), any feed back on that ? regards Yury Sidorov a écrit : >Hi, > >The latest info about WinCE port can be found here: >http://www.freepascal.org/wiki/index.php/WinCE_port >Yury Sidorov. > > >_______________________________________________ >fpc-devel maillist - >http://lists.freepascal.org/mailman/listinfo/fpc-devel > > >

Reply by email

Florian Klaempfl
to Yury Sidorov
Yury Sidorov wrote 11 lines
2. Since H2PAS dont eat MS headers the easiest way to port is to use win32 Windows unit and remove all functions which are missing in WinCE. The following list of WinCE functions can be used as reference: http://www.rainer-keuchel.de/wince/dllexports/ipaq-coredll.txt First of all there are almost no functions with A suffix and they must be removed. Also some functions exists as wrappers (SetEvent,ResetEvent). Some of them already implemented in system.pp You can start this task. Currently nobody do it. If you will start it, please write about that at wiki and specify your contacts.

IMO an important question is if wince and win32 should share the windows unit or not. Does MS have common headers?

Reply by email

Yury Sidorov
to Florian Klaempfl

From: "Florian Klaempfl"

Show quoted text 16 lines
Yury Sidorov wrote: > 2. Since H2PAS dont eat MS headers the easiest way to port is to use > win32 Windows unit and remove all functions which are missing in WinCE. > The following list of WinCE functions can be used as reference: > http://www.rainer-keuchel.de/wince/dllexports/ipaq-coredll.txt > First of all there are almost no functions with A suffix and they must > be removed. > Also some functions exists as wrappers (SetEvent,ResetEvent). Some of > them already implemented in system.pp > > You can start this task. Currently nobody do it. If you will start it, > please write about that at wiki and specify your contacts. IMO an important question is if wince and win32 should share the windows unit or not. Does MS have common headers?

The Windows unit must not be shared between win32 and wince.
1. There are separate MS headers for WinCE.
2. win32 Windows unit is generated from GNU Windows headers and it will break any modifications were made in Windows unit to support wince.

Reply by email

Florian Klaempfl
to Yury Sidorov
Yury Sidorov wrote 23 lines
From: "Florian Klaempfl" > Yury Sidorov wrote: > >> 2. Since H2PAS dont eat MS headers the easiest way to port is to use >> win32 Windows unit and remove all functions which are missing in WinCE. >> The following list of WinCE functions can be used as reference: >> http://www.rainer-keuchel.de/wince/dllexports/ipaq-coredll.txt >> First of all there are almost no functions with A suffix and they must >> be removed. >> Also some functions exists as wrappers (SetEvent,ResetEvent). Some of >> them already implemented in system.pp >> >> You can start this task. Currently nobody do it. If you will start it, >> please write about that at wiki and specify your contacts. > > > IMO an important question is if wince and win32 should share the windows > unit or not. Does MS have common headers? The Windows unit must not be shared between win32 and wince. 1. There are separate MS headers for WinCE.

Ok. I'll check the MS headers to see how h2pas behaves (I was the person one who commited the h2pas ;().

2. win32 Windows unit is generated from GNU Windows headers and it will break any modifications were made in Windows unit to support wince.

I know ;)

Reply by email

Oro06
to Yury Sidorov: 1. I got FPC to work with WinCE console. Expect a rtl sources update soon. 2. Since H2PAS…
Yury Sidorov wrote
2. Since H2PAS dont eat MS headers the easiest way to port is to use win32 Windows unit and remove all functions which are missing in WinCE. The following list of WinCE functions can be used as reference:

define like this are droped
#define CALLBACK PASCAL
// it seems that PASCAL is already present in all low level ms sdks ! :)

Show quoted text 9 lines
http://www.rainer-keuchel.de/wince/dllexports/ipaq-coredll.txt First of all there are almost no functions with A suffix and they must be removed. Also some functions exists as wrappers (SetEvent,ResetEvent). Some of them already implemented in system.pp You can start this task. Currently nobody do it. If you will start it, please write about that at wiki and specify your contacts.

i'll do that. ( rainer site is a little bit old (wince2.11,3) since there has been wince4.0, 4.1 and now most of systems are 4.2 ) i started with 4.2 headers, i used h2pas for types and consts and do the rest by hand, you're righ it's long task
compared arm and i386 dirs, are the same !

3. I think sqllite is dependent from Windows,SysUtils,Classes,etc. We need to port them first. Yury Sidorov.

ifdef WINCE is used in .inc files but see no definition, to add in system.pp ?

Reply by email

Luiz Américo
to Yury Sidorov: 1. I got FPC to work with WinCE console. Expect a rtl sources update soon. 2. Since H2PAS…
Yury Sidorov wrote
3. I think sqllite is dependent from Windows,SysUtils,Classes,etc. We need to port them first.

No. Vanilla sqlite has no dependencies, is just a translation of the sqlite header, so if sqlite already works in wince with c compilers it should work with fpc too.

The unit that uses sysutils, classes, db is the one with the TDataSet descendant (TSqliteDataset).

Luiz

Reply by email

Yury Sidorov
to Oro06: define like this are droped #define CALLBACK PASCAL // it seems that PASCAL is already…

From: "Oro06"

Show quoted text 5 lines
i'll do that. ( rainer site is a little bit old (wince2.11,3) since there has been wince4.0, 4.1 and now most of systems are 4.2 ) i started with 4.2 headers, i used h2pas for types and consts and do the rest by hand, you're righ it's long task compared arm and i386 dirs, are the same !

Yes, rainer site is a little old, but there are not much difference in core API. Most API functions are available starting from WinCE 1.0 :)

ifdef WINCE is used in .inc files but see no definition, to add in system.pp ?

WINCE is defined by compiler when WinCE target is specified.

Yury Sidorov.

Reply by email

Oro06
to Yury Sidorov

1°)actual (wince 4.2) windows.h need at :
windef.h, types.h, winbase.h, wingdi.h, winuser.h, winreg.h, shellapi.h, ole2.h, imm.h, tchar.h, excpt.h, strsafe.h

actual window.pp (from fpc 2.1.X) look at :
base.inc, errors.inc, defines.inc, struct.inc, messages.inc, ascfun.inc, unifun.inc, unidef.inc, ascdef.inc, func.inc, redef.inc

considering that :
- many blocks are common, just organized differently (many wince declarations i just seek in existing win32 code was already there but in the wrong dir !)
- windows.pp organisation is clearer
- it will be easier to maintain having in the same file, same kind of code (even for different targets but wince is also 32bits, it's very close to win32)
- there will also the win64 port question

i propose :
a- move existing win32 files windows.pp + base.inc+errors.inc, defines.inc, struct.inc, messages.inc, ascfun.inc, unifun.inc, unidef.inc, ascdef.inc, func.inc, redef.inc
to rtl\win dir
b-add the following defines in every .inc file

in the interface defined block and also in the implementation block

put here all common blocks
{$ifdef WIN32}
at first, put here all existing code, then copy/paste to the common
block according to wince headers
{$endif} //WIN32
{$ifdef WINCE}
put here all wince only code
{$endif} //WINCE

Any comment ?

2°) a type ULONG_PTR is defined in rtl\win\sysosh.inc with right define depending on 64 or 32 bits
i saw this type only for wince plateform
could it be replaced by PULONG
and ULONG definition added there ?
there are heavily used by windows
but defined with cardinal type.

regards

Reply by email

Yury Sidorov
to Oro06

1) The main problem is that Windows unit for win32 is generated automatically from GNU headers. Manual modifcations to it will make it frozen and make automatic generaton impossible.
I know that WinCE API is very close to Win32 and it is possible to create shared Windows unit for Win32, Win64, WinCE by using ifdefs. But what about automatic generation?

2) Any needed type definitions can be made directly in Windows unit.

Yury Sidorov.

Earlier message 56 lines
----- Original Message ----- From: "Oro06" To: "FPC developers' list" Sent: Saturday, August 13, 2005 5:58 PM Subject: Re: [fpc-devel] WinCE port windows.h 1°)actual (wince 4.2) windows.h need at : windef.h, types.h, winbase.h, wingdi.h, winuser.h, winreg.h, shellapi.h, ole2.h, imm.h, tchar.h, excpt.h, strsafe.h actual window.pp (from fpc 2.1.X) look at : base.inc, errors.inc, defines.inc, struct.inc, messages.inc, ascfun.inc, unifun.inc, unidef.inc, ascdef.inc, func.inc, redef.inc considering that : - many blocks are common, just organized differently (many wince declarations i just seek in existing win32 code was already there but in the wrong dir !) - windows.pp organisation is clearer - it will be easier to maintain having in the same file, same kind of code (even for different targets but wince is also 32bits, it's very close to win32) - there will also the win64 port question i propose : a- move existing win32 files windows.pp + base.inc+errors.inc, defines.inc, struct.inc, messages.inc, ascfun.inc, unifun.inc, unidef.inc, ascdef.inc, func.inc, redef.inc to rtl\win dir b-add the following defines in every .inc file in the interface defined block and also in the implementation block put here all common blocks {$ifdef WIN32} at first, put here all existing code, then copy/paste to the common block according to wince headers {$endif} //WIN32 {$ifdef WINCE} put here all wince only code {$endif} //WINCE Any comment ? 2°) a type ULONG_PTR is defined in rtl\win\sysosh.inc with right define depending on 64 or 32 bits i saw this type only for wince plateform could it be replaced by PULONG and ULONG definition added there ? there are heavily used by windows but defined with cardinal type. regards

Reply by email

Florian Klaempfl
to Oro06: 1°)actual (wince 4.2) windows.h need at : windef.h, types.h, winbase.h, wingdi.h,…
Oro06 wrote 37 lines
1°)actual (wince 4.2) windows.h need at : windef.h, types.h, winbase.h, wingdi.h, winuser.h, winreg.h, shellapi.h, ole2.h, imm.h, tchar.h, excpt.h, strsafe.h actual window.pp (from fpc 2.1.X) look at : base.inc, errors.inc, defines.inc, struct.inc, messages.inc, ascfun.inc, unifun.inc, unidef.inc, ascdef.inc, func.inc, redef.inc considering that : - many blocks are common, just organized differently (many wince declarations i just seek in existing win32 code was already there but in the wrong dir !) - windows.pp organisation is clearer - it will be easier to maintain having in the same file, same kind of code (even for different targets but wince is also 32bits, it's very close to win32) - there will also the win64 port question i propose : a- move existing win32 files windows.pp + base.inc+errors.inc, defines.inc, struct.inc, messages.inc, ascfun.inc, unifun.inc, unidef.inc, ascdef.inc, func.inc, redef.inc to rtl\win dir b-add the following defines in every .inc file in the interface defined block and also in the implementation block put here all common blocks {$ifdef WIN32} at first, put here all existing code, then copy/paste to the common block according to wince headers {$endif} //WIN32 {$ifdef WINCE} put here all wince only code {$endif} //WINCE Any comment ?

As Yury said, MS doesn't share the headers either so I think it's better to keep them completely independend.

Reply by email

Florian Klaempfl
to Oro06: i just tried the same prog targetting i386-wince4.2 (emulator) compiling give this…
Oro06 wrote 23 lines
Florian Klaempfl a écrit : >Probably some bug in the error handling. FPC_IOCHECK checks the result of the >write so that error location is quite logical. > i just tried the same prog targetting i386-wince4.2 (emulator) compiling give this warning : cannot find entry symbol __WinMainCRTStartup; defaulting to 00401000 writln(ing) in text file run without error message but writeln to std console give the same error. emu >Unfortunatly none of the core >developers has a wince pda so we can't test or make patches. > > > > i386-wince emulator can be obtained by many ways (legal),

Well, I consider an i386-wince emulator as rather useless for porting a compiler and base rtl to arm-wince ;)

Show quoted text 7 lines
the simpliest is to download just the free standalone emulator package here : http://www.microsoft.com/downloads/details.aspx?FamilyID=a120e012-ca31-4be9-a3bf-b9bf4f64ce72&DisplayLang=en then you can have a shared directory with the host pc ... i've a question concerning rtl tree : what is the goal of win dir (common with win32 an winCE ?)

We try to put here as much as possible common stuff between all windows (wince, win32 and win64). Of course, it's always a tradeoff between ifdefs and splitting.

Reply by email

Yury Sidorov
to Florian Klaempfl

From: "Florian Klaempfl"

> i386-wince emulator can be obtained by many ways (legal), Well, I consider an i386-wince emulator as rather useless for porting a compiler and base rtl to arm-wince ;)

New WinCE emulator which emulates ARM CPU can be downloaded from MS site. It is beta currently, but I use it and did not encounter any problems. Here is a link:
http://msdn.microsoft.com/mobility/windowsmobile/downloads/emulatorpreview/default.aspx

Yury Sidorov.

Reply by email

Yury Sidorov
to Yury Sidorov

Hello,

I built GDB 6.4 for arm-wince target.

GDB can be used to debug your WinCE applications remotely via ActiveSync. Download GDB 6.4 for Win32 host and arm-wince target here: ftp://ftp.freepascal.org/pub/fpc/contrib/cross/gdb-6.4-win32-arm-wince.zip

Pass --tui parameter to GDB to enable TUI interface which makes debugging more comfortable.

For some unknown reason this GDB can not determine your console window height and always uses 25 lines in TUI mode. You can put your console height to LINES environment variable before starting GDB to workaround this issue.

For example:

set LINES=50
gdb --tui

To learn how to use GDB read a documentation here: http://www.gnu.org/software/gdb/documentation

Yury Sidorov.

Reply by email