* compilation for i386-wince was fixed.

* some warnings and DirectoryExists were fixed in sysutils

git-svn-id: trunk@1336 -
This commit is contained in:
yury 2005-10-08 14:09:00 +00:00
parent 9a1052e1be
commit 48b75a0608
7 changed files with 38 additions and 28 deletions

View File

@ -1,6 +1,6 @@
/* /*
Startup code for WinCE port of Free Pascal Startup code for WinCE port of Free Pascal
Written by Yury Sidorov 2005 Written by Yury Sidorov, 2005.
*/ */
.section .text .section .text
@ -27,6 +27,7 @@ do_start:
ldr r1, _PISCONSOLE ldr r1, _PISCONSOLE
strb r0,[r1] strb r0,[r1]
bl _FPC_EXE_Entry bl _FPC_EXE_Entry
mov r0,#0
.globl asm_exit .globl asm_exit
asm_exit: asm_exit:

View File

@ -6,8 +6,8 @@
_mainCRTStartup: _mainCRTStartup:
movb $1,U_SYSTEM_ISCONSOLE movb $1,U_SYSTEM_ISCONSOLE
call _FPC_EXE_Entry call _FPC_EXE_Entry
.globl _WinMainCRTStartup .globl __WinMainCRTStartup
_WinMainCRTStartup: __WinMainCRTStartup:
movb $0,U_SYSTEM_ISCONSOLE movb $0,U_SYSTEM_ISCONSOLE
call _FPC_EXE_Entry call _FPC_EXE_Entry

View File

@ -1,12 +1,16 @@
WinCE port WinCE port
========== ==========
The WinCE port is quite complete and usable. The port was started and maintained by Yury Sidorov. Oliver (Oro06) ported WinCE API headers. WinCE port is quite complete and usable. The port was started and maintained by Yury Sidorov. Oliver (Oro06) ported WinCE API headers.
Status Status
------ ------
* The 2.1.x compiler has compiler support WinCE. * The 2.1.x compiler has compiler support WinCE.
* ARM and i386 (old WinCE emulator) CPUs are supported. * ARM and i386 (old WinCE emulator) CPUs are supported.
* The following platforms are supported:
* Pocket PC 2002 WinCE version: 3.0
* Pocket PC 2003 WinCE version: 4.20
* Pocket PC 2003 Second Edition WinCE version: 4.21
* Base units are complete. * Base units are complete.
* Windows unit is almost complete. Delphi compatible declarations is not ready. * Windows unit is almost complete. Delphi compatible declarations is not ready.
@ -15,13 +19,14 @@ Building
* You need cross binutils for arm-wince, get them fromftp://ftp.freepascal.org/pub/fpc/contrib/cross/arm-wince-binutils.zip for Win32. * You need cross binutils for arm-wince, get them fromftp://ftp.freepascal.org/pub/fpc/contrib/cross/arm-wince-binutils.zip for Win32.
* Extract them to some dir in the path on your machine. * Extract them to some dir in the path on your machine.
* Get the 2.1 source repository from SVN: http://www.freepascal.org/develop.html#svn * Get the 2.1 source repository from SVN: http://www.freepascal.org/develop.html#svn
* Go to fpc/compiler and execute make cycle CPU_TARGET=arm OS_TARGET=wince * Go to fpc/compiler and execute:
make cycle CPU_TARGET=arm OS_TARGET=wince CROSSBINDIR=<path_to_cross_binutils>
You should end with the units compiled to fpc/rtl/units/arm-wince and a ppccrossarm.exe in fpc/compiler. Copy them to locations fitting your fpc installation. You should end with the units compiled to fpc/rtl/units/arm-wince and a ppccrossarm.exe in fpc/compiler. Copy them to locations fitting your fpc installation.
WinCE port notes WinCE port notes
---------------- ----------------
* chdir always produces an error (WinCE does not support setting of current directory). * chdir procedure always produces an error (WinCE does not support setting of current directory).
* All file/dir paths must be absolute (started with \). * All file/dir paths must be absolute (started with \).
* WinCE is unicode OS. All string parameters to API calls must be PWideChar. * WinCE is unicode OS. All string parameters to API calls must be PWideChar.
* WinCE does not have support for environment strings. * WinCE does not have support for environment strings.

View File

@ -97,6 +97,8 @@ function CreateFile(lpFileName:pchar; dwDesiredAccess:DWORD; dwShareMode:DWORD;
function CreateDirectory(name : pointer;sec : pointer) : longbool; stdcall; function CreateDirectory(name : pointer;sec : pointer) : longbool; stdcall;
function RemoveDirectory(name:pointer):longbool; stdcall; function RemoveDirectory(name:pointer):longbool; stdcall;
{$ifdef CPUARM}
{ the external directive isn't really necessary here because it is overriden by external (FK) } { the external directive isn't really necessary here because it is overriden by external (FK) }
function addd(d1,d2 : double) : double; compilerproc; function addd(d1,d2 : double) : double; compilerproc;
@ -177,6 +179,7 @@ function adds(s1,s2 : single) : single; compilerproc;
function subs(s1,s2 : single) : single; compilerproc; function subs(s1,s2 : single) : single; compilerproc;
function muls(s1,s2 : single) : single; compilerproc; function muls(s1,s2 : single) : single; compilerproc;
function divs(s1,s2 : single) : single; compilerproc; function divs(s1,s2 : single) : single; compilerproc;
{$endif CPUARM}
implementation implementation
@ -209,24 +212,26 @@ begin
CompareByte := memcmp(@buf1, @buf2, len); CompareByte := memcmp(@buf1, @buf2, len);
end; end;
{$ifdef CPUARM}
{$define FPC_SYSTEM_HAS_INT} {$define FPC_SYSTEM_HAS_INT}
function fpc_int_real(d: double): double;compilerproc; function fpc_int_real(d: ValReal): ValReal;compilerproc;
begin begin
fpc_int_real := i64tod(trunc(d)); fpc_int_real := i64tod(trunc(d));
end; end;
{$define FPC_SYSTEM_HAS_TRUNC} {$define FPC_SYSTEM_HAS_TRUNC}
function fpc_trunc_real(d : double) : int64;compilerproc; function fpc_trunc_real(d : ValReal) : int64;compilerproc;
external 'coredll' name '__dtoi64'; external 'coredll' name '__dtoi64';
{$define FPC_SYSTEM_HAS_ABS} {$define FPC_SYSTEM_HAS_ABS}
function fpc_abs_real(d : double) : double;compilerproc; function fpc_abs_real(d : ValReal) : ValReal;compilerproc;
external 'coredll' name 'fabs'; external 'coredll' name 'fabs';
{$define FPC_SYSTEM_HAS_SQRT} {$define FPC_SYSTEM_HAS_SQRT}
function fpc_sqrt_real(d : double) : double;compilerproc; function fpc_sqrt_real(d : ValReal) : ValReal;compilerproc;
external 'coredll' name 'sqrt'; external 'coredll' name 'sqrt';
function adds(s1,s2 : single) : single; function adds(s1,s2 : single) : single;
begin begin
adds := addd(s1, s2); adds := addd(s1, s2);
@ -247,6 +252,8 @@ begin
divs := divd(s1, s2); divs := divd(s1, s2);
end; end;
{$endif CPUARM}
{*****************************************************************************} {*****************************************************************************}
{ include system independent routines } { include system independent routines }

View File

@ -58,7 +58,7 @@ implementation
{ Include platform independent implementation part } { Include platform independent implementation part }
{$i sysutils.inc} {$i sysutils.inc}
procedure PWideCharToString(const str: PWideChar; var Result: string; strlen: longint = -1); procedure PWideCharToString(const str: PWideChar; out Result: string; strlen: longint = -1);
var var
len: longint; len: longint;
begin begin
@ -93,7 +93,7 @@ var
s : widestring; s : widestring;
size : dword; size : dword;
rc : dword; rc : dword;
p,buf : pwidechar; buf : pwidechar;
begin begin
s := ExpandFileName (filename); s := ExpandFileName (filename);
@ -214,13 +214,13 @@ begin
end; end;
Function DosToWinTime (DTime:longint;Var Wtime : TFileTime):longbool; Function DosToWinTime (DTime:longint; out Wtime : TFileTime):longbool;
begin begin
DosToWinTime:=False; //!!! fixme DosToWinTime:=False; //!!! fixme
end; end;
Function WinToDosTime (Const Wtime : TFileTime;var DTime:longint):longbool; Function WinToDosTime (Const Wtime : TFileTime; out DTime:longint):longbool;
begin begin
WinToDosTime:=False; //!!! fixme WinToDosTime:=False; //!!! fixme
end; end;
@ -263,19 +263,16 @@ end;
Function DirectoryExists (Const Directory : String) : Boolean; Function DirectoryExists (Const Directory : String) : Boolean;
var var
Handle: THandle; Attr:Dword;
FindData: TWin32FindData;
fn: PWideChar; fn: PWideChar;
begin begin
fn:=StringToPWideChar(Directory); fn:=StringToPWideChar(Directory);
Result:=False; Attr:=GetFileAttributes(fn);
Handle := FindFirstFile(PWideChar(widestring(Directory)), FindData);
FreeMem(fn); FreeMem(fn);
If (Handle <> INVALID_HANDLE_VALUE) then if Attr <> $ffffffff then
begin Result:= (Attr and FILE_ATTRIBUTE_DIRECTORY) > 0
Result:=((FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY); else
Windows.FindClose(Handle); Result:=False;
end;
end; end;

View File

@ -5535,7 +5535,7 @@ Const
#endif #endif
*) *)
{$ifdef _X86_} //+winnt {$ifdef i386} //+winnt
{ x86 } { x86 }
{ The doc refered me to winnt.h, so I had to look... } { The doc refered me to winnt.h, so I had to look... }
@ -5556,7 +5556,7 @@ Const
{ our own invention } { our own invention }
FLAG_TRACE_BIT = $100; FLAG_TRACE_BIT = $100;
CONTEXT_DEBUGGER = CONTEXT_FULL or CONTEXT_FLOATING_POINT; CONTEXT_DEBUGGER = CONTEXT_FULL or CONTEXT_FLOATING_POINT;
{$endif _X86_} {$endif i386}
{$ifdef _MIPS_} //+winnt all block added {$ifdef _MIPS_} //+winnt all block added
// //

View File

@ -1118,7 +1118,7 @@
TCONSOLESCREENBUFFERINFO = CONSOLE_SCREEN_BUFFER_INFO; TCONSOLESCREENBUFFERINFO = CONSOLE_SCREEN_BUFFER_INFO;
PCONSOLESCREENBUFFERINFO = ^CONSOLE_SCREEN_BUFFER_INFO; PCONSOLESCREENBUFFERINFO = ^CONSOLE_SCREEN_BUFFER_INFO;
{$ifdef _X86_} //+winnt {$ifdef i386} //+winnt
type type
FLOATING_SAVE_AREA = record //~winnt FLOATING_SAVE_AREA = record //~winnt
ControlWord : DWORD; ControlWord : DWORD;
@ -1194,7 +1194,7 @@
TLDTENTRY = LDT_ENTRY; TLDTENTRY = LDT_ENTRY;
PLDTENTRY = ^LDT_ENTRY; PLDTENTRY = ^LDT_ENTRY;
{$endif _X86_} //+winnt {$endif i386} //+winnt
{$ifdef _MIPS_} //+winnt all block added {$ifdef _MIPS_} //+winnt all block added
// //