[fpc-devel] Enabling hardware floating point processor for cortex-m4f on embedded and freertos

Michael Ring mail at michael-ring.org
Sat Feb 20 10:35:33 CET 2021


I have created an issue with this patch for ermbedded target, for 
unknown reason the 'end;' at the end of the patch for 
rtl/embedded/arm/cortexm4f_start.inc is missing, likely when I 
copy/pasted I lost that line. Sorry for this....

Will there in the future be a way to provide pull-requests via github 
(or does this already work??) I guess that would reduce the likelyhood 
of such a stupid error..

And then I also found another small mishap in 
rtl/freertos/arm/cortexm4f_start.inc, there a 'not' was left over after 
you changed the logic for fpu detection.

When Investigating I saw that lm4f120 is built as armv7m but is actually 
armv7em (plus it uses m4f include). Not sure if it is woth fixing a 
seven years old file, so I left things as they are.

Michael


diff --git a/rtl/embedded/arm/cortexm4f_start.inc 
b/rtl/embedded/arm/cortexm4f_start.inc
index dc2928c70a..62017d9834 100644
--- a/rtl/embedded/arm/cortexm4f_start.inc
+++ b/rtl/embedded/arm/cortexm4f_start.inc
@@ -74,3 +74,4 @@ asm
  .Ltext_start:
    .long _text_start
  {$endif REMAP_VECTTAB}
+end;
diff --git a/rtl/freertos/arm/cortexm4f_start.inc 
b/rtl/freertos/arm/cortexm4f_start.inc
index 756aeb994a..62017d9834 100644
--- a/rtl/freertos/arm/cortexm4f_start.inc
+++ b/rtl/freertos/arm/cortexm4f_start.inc
@@ -64,7 +64,7 @@ asm
    .long _data
  .L_edata:
    .long _edata
-{$if not defined(FPUARM_HAS_VFP_EXTENSION)}
+{$if defined(FPUARM_HAS_VFP_EXTENSION)}
  .Lcpacr:
    .long 0xE000ED88
  {$endif defined(FPUARM_HAS_VFP_EXTENSION)}

Am 19.02.21 um 22:13 schrieb Michael Ring via fpc-devel:
> You are the best, thank you!
>
> Michael
>
> Am 19.02.21 um 22:11 schrieb Florian Klämpfl via fpc-devel:
>> Am 19.02.21 um 21:55 schrieb Michael Ring via fpc-devel:
>>> When rtl for arm-embedded/arm-freertos is build with hardfloat the 
>>> fpu should also automagically get enabled, by default it is off 
>>> which causes a crash when floats are used.
>>>
>>> This small patch fixes that problem in cortexm4f_start.inc
>>>
>>> can you please apply this patch to trunk?
>>
>> Thanks, I applied it in a modified form so the presence of an vfp 
>> unit is checked, this should be more future and fool proof :)
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


More information about the fpc-devel mailing list