Re: [fpc-pascal] Embedded ARM7 and long strings

2013-08-21 Thread Carsten Bager
 Am 24.07.2013 09:07, schrieb Carsten Bager:
  The {$LONGSTRINGS OFF} directive is given at the beginning of the program, 
  and that 
  eliminates any problems with long strings using the 2.05 compiler. That 
  does not seem to 
  work with the new compiler.
  
  Is there a way around this problem?
 
 I applied a fix in r25283 which should help you.

I have tested it, and it works. :-)
I will go on with my attempt to get the compiler compiling to  Arm7 embedded.
Carsten
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Embedded ARM7 and long strings

2013-08-18 Thread Florian Klämpfl
Am 24.07.2013 09:07, schrieb Carsten Bager:
 The {$LONGSTRINGS OFF} directive is given at the beginning of the program, 
 and that 
 eliminates any problems with long strings using the 2.05 compiler. That 
 does not seem to 
 work with the new compiler.
 
 Is there a way around this problem?

I applied a fix in r25283 which should help you.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Embedded ARM7 and long strings

2013-07-25 Thread Flávio Etrusco
On Wed, Jul 24, 2013 at 4:07 AM, Carsten Bager cars...@beas.dk wrote:
 (...)

 The {$LONGSTRINGS OFF} directive is given at the beginning of the program, 
 and that
 eliminates any problems with long strings using the 2.05 compiler. That 
 does not seem to
 work with the new compiler.

 Is there a way around this problem?

 Carsten

Did you try {$H-}? Sure, AFAIR it was just a shorthand {$LONGSTRING},
but there's no mention of the latter in the manual:
http://www.freepascal.org/docs-html/ref/refsu11.html

Best regards,
Flávio
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Embedded ARM7 and long strings

2013-07-25 Thread Carsten Bager
  The {$LONGSTRINGS OFF} directive is given at the beginning of the program, 
  and that
  eliminates any problems with long strings using the 2.05 compiler. That 
  does not seem to
  work with the new compiler.
 
  Is there a way around this problem?
 
  Carsten

 Did you try {$H-}? Sure, AFAIR it was just a shorthand {$LONGSTRING},

I tried but it did not change anything.
Carsten


 Best regards,
 Flávio


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Embedded ARM7 and long strings

2013-07-24 Thread Carsten Bager
I am using the FPC compiler to compile embedded ARM7 code (LPC21xx / LPC23xx).
For this purpose, I use the 2.05 compiler, and it is working without problems 
at all.
However, because we are using the 2.62 compiler on other platforms, I have 
compiled a new
system unit for the ARM7 platform with the 2.62 compiler. I then ran into this 
problem.

The old compiler uses fpc_chararray_to_shortstr to comvert from an array of 
char to a
shortstring. That works OK.

The 2.62 compiler wants to use fpc_chararray_to_ansistr to the same job, and 
that is a
problem because my ARM7 system unit do not support ansistrings (and should not).

The {$LONGSTRINGS OFF} directive is given at the beginning of the program, and 
that
eliminates any problems with long strings using the 2.05 compiler. That does 
not seem to
work with the new compiler.

Is there a way around this problem?

Carsten



FPC 2.05
# [38] Val(pChar16(LineDataOfset)^,NameDataOfset,p);
sub r5,r11,#568
ldr r0,.L57
ldr r4,[r0]
mov r3,#1
mov r2,#15
mov r1,r4
sub r0,r11,#824
bl  fpc_chararray_to_shortstr
sub r1,r11,#824
mov r0,#4
mov r2,r5
bl  fpc_val_sint_shortstr
ldr r1,.L68
str r0,[r1]
ldr r0,.L71
sub r3,r11,#568
mov r2,#2
.L72:
ldrbr1,[r3], #1
subsr2,r2,#1
strbr1,[r0], #1
bne .L72

FPC 2.62
# [38] Val(pChar16(LineDataOfset)^,NameDataOfset,p);
sub r0,r11,#628
bl  FPC_ANSISTR_DECR_REF
mov r0,#0
str r0,[r11, #-628]
ldr r0,.Lj13
ldr r1,[r0]
sub r0,r11,#628
mov r3,#1
mov r2,#15
bl  fpc_chararray_to_ansistr
ldr r1,[r11, #-628]
sub r2,r11,#116
mov r0,#4
bl  fpc_val_sint_ansistr
ldr r1,.Lj70
str r0,[r1]
ldrbr0,[r11, #-116]
ldr r1,.Lj73
strbr0,[r1]
ldrbr0,[r11, #-115]
strbr0,[r1, #1]
.stabn 68,0,39,_$LINEINFO$_Ll9 -




unit lineinfo;
{$LONGSTRINGS OFF}
{$Assertions off}
{$RANGECHECKS OFF}
{$OVERFLOWCHECKS OFF}
{$S- STACK CHECKING OFF}


interface

procedure GetLineInfo(addr:pointer; var 
FuncStringListPointer,SrcStringListPointer:pChar;
var line:longWord);


implementation
uses
  LineInfoTyp;

var
  data_beg_src:byte; external name '__data_beg_src__';
  data_beg:byte; external name '__data_beg__';
  data_end:byte; external name '__data_end__';
  LineDataOfset,EndLineDataOfset,NameDataOfset:Longint; {Skal være 
longint}
  p:integer;

Type
  Char16=array[0..15] of char;
  pChar16=^Char16;
  pArm7LineInfo=^Arm7LineInfo_typ;

procedure GetLineInfo(addr:pointer; var 
FuncStringListPointer,SrcStringListPointer:pChar;
var line:longWord);
Begin
  LineDataOfset:=(Longint(@data_end)-Longint(@data_beg))+Longint(@data_beg_src);
  if (byte(LineDataOfset) and $0F)0 then
LineDataOfset:=(LineDataOfset and $FFF0) +$10;
  if pChar16(LineDataOfset)^ = cLineDataOfsetString then
  begin
LineDataOfset:=LineDataOfset+16;
Val(pChar16(LineDataOfset)^,NameDataOfset,p);
if p=0 then
begin
  LineDataOfset:=LineDataOfset+16;
  NameDataOfset:=NameDataOfset+LineDataOfset;
  EndLineDataOfset:=NameDataOfset;
  if pChar16(NameDataOfset)^ = cNameDataOfsetString then
  begin
NameDataOfset:=NameDataOfset+32;
while LineDataOfsetEndLineDataOfset do
begin
  if pArm7LineInfo(LineDataOfset)^.addrlongword(addr) then
  begin
LineDataOfset:=LineDataOfset-16;
line:=pArm7LineInfo(LineDataOfset)^.line;

longint(FuncStringListPointer):=longint(pArm7LineInfo(LineDataOfset)^.FuncStringListPointer
)+NameDataOfset;

longint(SrcStringListPointer):=longint(pArm7LineInfo(LineDataOfset)^.SrcStringListPointer)+
NameDataOfset;
exit;
  end;
  LineDataOfset:=LineDataOfset+16;
end;
  end else runerror(48);{Error finding Str. Ofset}
end else runerror(49);  {Error in val of str. Of.}
  end else runerror(50);{Error finding Data Ofset}
End;

end.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal