[fpc-pascal] access violations on new ARM hardware

Sven Barth pascaldragon at googlemail.com
Wed Jan 28 17:24:22 CET 2015


Am 28.01.2015 16:45 schrieb "Björn Schreiber" <news.bs at drigus.de>:
>
> Am 28.01.2015 um 11:21 schrieb Sven Barth:
>
>> As said by Marco: please try to reproduce it by copying parts of
>> SysUtils (e.g. GetLocaleStr) into an empty program (and using that code
>> of course ^^) to find an example code that shows the problem.
>
>
>   I narrowed it down to the following minimal program:
>
> --- Schnipp On ---
> program test;
>
> var
>   AString: String;
>
> function AFunction: String;
> var
>   S: WideString;
>
> begin
>   S := 'Test';
>   AFunction := S;
> end;
>
> begin
>   AString := AFunction;
> end.
> --- Schnipp Off ---
>
> Compiled with a fresh install of FPC 2.6.4 with the command line
>
>   fpc -Twince -Parm test.pas
>
> runs without any problem on the old hardware (Cortex-A8) but produces a
runtime error 216 on the new hardware (Cortex-A5).
>   This code follows SysUtils.GetLocalStr, called by
SysUtils.GetFormatSettings. The error doesn't occur if S is defined as
String instead WideString or if I do it without the function call.

Could be a bug in the conversion routines from WideString to AnsiString.
Since we are currently preparing release 3.0.0 it might be best to test
with that as well (cause string handling was changed in 2.7.1). It
shouldn't be hard to compile for WinCE either, just download the source
(e.g. by using SVN) and do the following:

First build a native 3.0.0 and install it:

make clean all install INSTALL_PREFIX=c:\wherever\you\want

For example I myself usually install to D:\fpc\3.0.0

make clean all CPU_TARGET=arm OS_TARGET=wince BINUTILSPREFIX=arm-wince-
CROSSBINDIR=c:\whereever\arm-wince-as\is

You can also pass additional option like CPU type and FPU type using
OPT="xyz" with the same parameters as for the compiler.

Afterwards you can install the newly compiled compiler and RTL:

make crossinstall CPU_TARGET=arm OS_TARGET=wince
INSTALL_PREFIX=c:\wherever\you\want

Now you merely need a fpc.cfg. For this you can copy your 2.6.4's fpc.cfg,
copy it to c:\wherever\you\want\bin\i386-win32 (or x86_64-win64 if you
built a 64-bit native compiler) and adjust its paths. Note: the path
c:\wherever\you\want is the one you specified for  INSTALL_PREFIX.

If you have any problems, feel free to ask.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150128/3b1b4701/attachment.html>


More information about the fpc-pascal mailing list