[fpc-devel] MIPS big-endian program starts but does nothing

Sergei Gorelkin sergei_gorelkin at mail.ru
Tue Sep 9 11:38:27 CEST 2014

09.09.2014 13:19, Sven Barth пишет:
> Am 09.09.2014 08:53 schrieb "Sergei Gorelkin" <sergei_gorelkin at mail.ru
> <mailto:sergei_gorelkin at mail.ru>>:
>  >
>  > 09.09.2014 9:53, Sven Barth пишет:
>  >
>  >> On 08.09.2014 22:54, Michael Ring wrote:
>  >>>
>  >>> This smells like a problem I had on pic32. In my case the pic32 chips do
>  >>> not have a floating point unit and the processor creates an illegal
>  >>> instruction (or something similar) exception.
>  >>>
>  >>> I solved this for me by patching out the call to the hardware
>  >>> coprocessor when softfpu is selected.
>  >>
>  >>
>  >> Which should be the correct approach for softfpu anyway. Afterall the premise of softfpu is that
>  >> there is no hardware FPU to use and thus corresponding CPU instructions are useless (or as it seems
>  >> in this case lead to nothing).
>  >>
>  >
>  > This patch is correct only if the goal is do disable floating-point completely. If the goal is to
> have floating-point calculations available using emulation, then the entire procedures SysInitFPU
> and SysResetFPU together with {$define FPC_SYSTEM_HAS_SYSRESETFPU} and {$define
> FPC_SYSTEM_HAS_SYSINITFPU} must be disabled. Doing so will cause softfpu-specific routines from
> generic.inc to be used.
> Well, according to Reinier's test at least the route seems to be correct. So we need to ensure that
> softfpu code for MIPS works correctly.
>  > I also wonder what is the correct way to generate code that calls softfpu:
>  > 1) -SfSOFTFPU
>  > 2) -CfSOFT
>  > 3) -Ce
>  > ?
> I only know -CfSOFT and that is what I use for m68k. -Ce likely only does the same as -CfSOFT, but I
> don't know what -SfSOFTFPU is supposed to do.
Well, for m68k you can omit -CfSOFT and nothing will change, because currently nothing else is 
supported there.
As for -Ce, the compiler code sometimes checks for it (cs_fp_emulation in 
current_settings.moduleswitches), sometimes for -CfSOFT (current_settings.fputype=fpu_soft), 
sometimes for both. That's why I wonder.
-SfSOFTFPU is for embedded targets where it enables "softfpu feature", for non-embedded targets it 
is assumed to be permanently present (?), but again it's unclear if this feature replaces hardware 
FPU (if present) or appends to it.


More information about the fpc-devel mailing list