Re: [fpc-devel] [fpc-announce] FPC 3.2.0 released!

2020-07-04 Thread Ryan Joseph via fpc-devel


> On Jul 4, 2020, at 8:10 PM, Marco van de Voort  
> wrote:
> 
> But the syntax will be CARD(variable), and there are some minor 
> things wrong with it: (anyone?)

I'm waiting on my patch for implicit function specialization to be reviewed 
since I did a redesign (as per Svens request). If there are any other code 
reviewers available I can finally get it cleaned up and submitted. specialize 
CARD(variable) is really verbose in ObjFPC mode so it would be nice to 
get this cleaned up.

https://bugs.freepascal.org/view.php?id=35261

Regards,
Ryan Joseph

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Linking not working anymore on latest trunk for target arm-freertos (plus fix)

2020-07-04 Thread Florian Klämpfl

Am 04.07.20 um 09:33 schrieb Michael Ring via fpc-devel:
Hi, Linking on arm-freertos target did not work after the merge of some 
of Christo's fixes for esp32-freertos.


Here's the fix for the issue (also attached as diff), Florian, can you 
please check & apply this patch?


Thanks, I applied it with a modification.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] [fpc-announce] FPC 3.2.0 released!

2020-07-04 Thread Marco van de Voort


Op 2020-07-03 om 19:18 schreef Keith Bowes via fpc-devel:

 Another thing was the Card function, which
I thought would be easy to do, as surely the code keeps track of how
many elements there are in a set, but if it does, I couldn't find it.


(Just a bit of fun, doesn't really answer your question, since obviously 
you'd need it in a ISO compatible mode. Also note that 3.2.0 branched 
over an year ago)


But 3.2.0 supports generic functions, and 3.0.0 already supported popcnt 
(https://www.freepascal.org/docs-html/rtl/system/popcnt.html).


But the syntax will be CARD(variable), and there are some minor 
things wrong with it: (anyone?)


- needs set type to be defined as type to reuse.

- what to do with a small registerable set, need const ref, but const 
[ref] is not yet supported in delphi mode?)


- and alignment requirements for the pointer walking.

- assumes unused bits in the last byte are 0. If that is unsure one 
could use the result of the AND 7 to make an and mask to mask out the 
unnecessary bits.



{$mode delphi}
{$pointermath on}

Function CARD(const a: T): Integer;
Var bits,dwords,rest,i : Integer;
    p: pbyte;
begin
  result:=0;
  p:=@a;
  bits:=(high(t)+1) ;
  dwords:=bits div 32;
  rest:=(bits mod 32); // bytes
  if (rest and 7)>0 then // round rest bits (and 7) up to whole byte (8)
    rest:=rest+8;
  rest:=rest shr 3; // bits -> bytes.
  for i:=0 to dwords-1 do
    begin
  result:=result +popcnt({unaligned?} pdword(p)^);
  inc(pdword(p));
    end;
  for i:=0 to rest-1 do
    begin
  result:=result +popcnt({unaligned?} pbyte(p)^);
  inc(p);
    end;
end;

Type TSettype = set of 0..80;

Var t : TSettype;
    i : Integer;
Begin
  t:=[];
  for i:=0 to 5 do
    Include(t,i*13);
  Writeln(CARD(t));
End.

I'll probably get back into it eventually, but I might have to redo what
I've already done, because conflicts in the Makefiles are pretty much a
certainty.  Personally, I'm nut sure why the Makefiles are included in
SVN; they should be generated `fpcmake -r` before compilation (or being
packed into a source tarball) to avoid this kind of thing.


But that would cause a bootstrap requirement on fpcmake, instead just 
the compiler. Note that recently, the generation date has been removed 
from the generate file to reduce conflicts.



Anyway, it'll be nice if we can get some more ISO 10206 features.  Some
have been popping up here and there over the years (string slices, the
** operator, WriteStr/ReadStr, etc), but a lot of useful features are
missing and seemingly have no equivalent in Borland's proprietary
dialect.


And of course schemata are the proverbial elephant in the room.


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Linking not working anymore on latest trunk for target arm-freertos (plus fix)

2020-07-04 Thread Michael Ring via fpc-devel
Hi, Linking on arm-freertos target did not work after the merge of some 
of Christo's fixes for esp32-freertos.


Here's the fix for the issue (also attached as diff), Florian, can you 
please check & apply this patch?



Thank you,

Michael


diff --git a/compiler/systems/t_freertos.pas 
b/compiler/systems/t_freertos.pas

index e8f5f8507d..742c71d4c5 100644
--- a/compiler/systems/t_freertos.pas
+++ b/compiler/systems/t_freertos.pas
@@ -82,9 +82,9 @@ begin
  '-L $IDF_PATH/components/esp_rom/esp32/ld '+
  '-T esp32.rom.ld -T esp32.rom.libgcc.ld -T 
esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T 
esp32.rom.newlib-funcs.ld '+

  '-L . -T esp32_out.ld -T esp32.project.ld '+
- '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld'
- else
-   ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC 
$GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';

+ '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld';
+{$else}
+ ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC 
$GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';

 {$endif xtensa}
    end;
 end;
@@ -1160,7 +1160,8 @@ begin
 success:=DoExec(binstr,cmdstr,true,false);
 end;

- 
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));

+  if IDF_PATH <> '' then
+ 
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));

FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));

   GCSectionsStr:='--gc-sections';

diff --git a/compiler/systems/t_freertos.pas b/compiler/systems/t_freertos.pas
index e8f5f8507d..742c71d4c5 100644
--- a/compiler/systems/t_freertos.pas
+++ b/compiler/systems/t_freertos.pas
@@ -82,9 +82,9 @@ begin
  '-L $IDF_PATH/components/esp_rom/esp32/ld '+
  '-T esp32.rom.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld 
-T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld '+
  '-L . -T esp32_out.ld -T esp32.project.ld '+
- '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld'
- else
-   ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS 
$STRIP $MAP -L. -o $EXE -T $RES';
+ '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld';
+{$else}
+ ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS 
$STRIP $MAP -L. -o $EXE -T $RES';
 {$endif xtensa}
end;
 end;
@@ -1160,7 +1160,8 @@ begin
 success:=DoExec(binstr,cmdstr,true,false);
 end;

-  
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  if IDF_PATH <> '' then
+
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
   
FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));

   GCSectionsStr:='--gc-sections';
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Linking not working anymore on latest trunk for target arm-freertos (plus fix)

2020-07-04 Thread Michael Ring via fpc-devel
Hi, Linking on arm-freertos target did not work after the merge of some 
of Christo's fixes for esp32-freertos.


Here's the fix for the issue (also attached as diff), Florian, can you 
please check & apply this patch?



Thank you,

Michael


diff --git a/compiler/systems/t_freertos.pas 
b/compiler/systems/t_freertos.pas

index e8f5f8507d..742c71d4c5 100644
--- a/compiler/systems/t_freertos.pas
+++ b/compiler/systems/t_freertos.pas
@@ -82,9 +82,9 @@ begin
  '-L $IDF_PATH/components/esp_rom/esp32/ld '+
  '-T esp32.rom.ld -T esp32.rom.libgcc.ld -T 
esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T 
esp32.rom.newlib-funcs.ld '+

  '-L . -T esp32_out.ld -T esp32.project.ld '+
- '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld'
- else
-   ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC 
$GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';

+ '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld';
+{$else}
+ ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC 
$GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';

 {$endif xtensa}
    end;
 end;
@@ -1160,7 +1160,8 @@ begin
 success:=DoExec(binstr,cmdstr,true,false);
 end;

- 
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));

+  if IDF_PATH <> '' then
+ 
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));

FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));

   GCSectionsStr:='--gc-sections';



diff --git a/compiler/systems/t_freertos.pas b/compiler/systems/t_freertos.pas
index e8f5f8507d..742c71d4c5 100644
--- a/compiler/systems/t_freertos.pas
+++ b/compiler/systems/t_freertos.pas
@@ -82,9 +82,9 @@ begin
  '-L $IDF_PATH/components/esp_rom/esp32/ld '+
  '-T esp32.rom.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld 
-T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld '+
  '-L . -T esp32_out.ld -T esp32.project.ld '+
- '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld'
- else
-   ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS 
$STRIP $MAP -L. -o $EXE -T $RES';
+ '-L $IDF_PATH/components/esp32/ld -T esp32.peripherals.ld';
+{$else}
+ ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS 
$STRIP $MAP -L. -o $EXE -T $RES';
 {$endif xtensa}
end;
 end;
@@ -1160,7 +1160,8 @@ begin
 success:=DoExec(binstr,cmdstr,true,false);
 end;

-  
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
+  if IDF_PATH <> '' then
+
Replace(Info.ExeCmd[1],'$'+IDF_PATH,maybequoted(GetEnvironmentVariable(IDF_PATH)));
   
FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));

   GCSectionsStr:='--gc-sections';
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] [fpc-announce] FPC 3.2.0 released!

2020-07-04 Thread Keith Bowes via fpc-devel
Je 2020-06-20 je 12:03:58 (+0200) Marco van de Voort skribis:
> 
> Finally, the Free Pascal 3.2.0 release is available from our servers and
> from sourceforge.
> 

I've been playing around a little with it.  So far, so good.  It
compiles as fast as ever and the generated binaries are much smaller
than with 3.0.4.  It's little wonder why Pascal is my go-to language
when writing something (unfortunately, I have to use primarily C and
Python when sending patches for existing projects).

I was really hoping that ISO 10206 support would be able to make it into
3.2, but there were significant roadblocks.  For one, for the Bind
function to be correctly implemented, I'm pretty sure file I/O would
have to be rewritten to allow Bind to know whether a file could be
successfully opened or not.  Another thing was the Card function, which
I thought would be easy to do, as surely the code keeps track of how
many elements there are in a set, but if it does, I couldn't find it.
It just occurred to me right now that a possible hack could be to create
such a function in the extpas unit using a for..in loop, but that would
perform very badly compared to compiler code.

I'll probably get back into it eventually, but I might have to redo what
I've already done, because conflicts in the Makefiles are pretty much a
certainty.  Personally, I'm nut sure why the Makefiles are included in
SVN; they should be generated `fpcmake -r` before compilation (or being
packed into a source tarball) to avoid this kind of thing.

Anyway, it'll be nice if we can get some more ISO 10206 features.  Some
have been popping up here and there over the years (string slices, the
** operator, WriteStr/ReadStr, etc), but a lot of useful features are
missing and seemingly have no equivalent in Borland's proprietary
dialect.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel