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

Michael Ring mail at michael-ring.org
Mon Sep 8 22:54:54 CEST 2014


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.

You could try this patch:

svn diff rtl/mips/mips.inc
Index: rtl/mips/mips.inc
===================================================================
--- rtl/mips/mips.inc    (revision 28626)
+++ rtl/mips/mips.inc    (working copy)
@@ -54,11 +54,12 @@
    fpu_rounding_minus_inf = 3;

    fpu_all_bits = fpu_enable_mask or fpu_flags_mask or fpu_cause_mask 
or fpu_rounding_mask;
-
  {$define FPC_SYSTEM_HAS_SYSINITFPU}
  procedure SysInitFPU;
    begin
+{$ifndef FPC_HAS_FEATURE_SOFTFPU}
      set_fsr(get_fsr and (not fpu_all_bits) or (default_fpu_enable or 
fpu_rounding_nearest));
+{$ENDIF FPC_HAS_FEATURE_SOFTFPU}
    end;


@@ -75,7 +76,6 @@
        SysInitFPU;
    end;

-
  {$ifndef INTERNAL_BACKTRACE}
  {$define FPC_SYSTEM_HAS_GET_FRAME}
  function get_frame:pointer;assembler;nostackframe;

Am 08.09.14 um 22:29 schrieb Sven Barth:
> On 08.09.2014 20:25, Reinier Olislagers wrote:
>> (gdb) bt
>> #0  GET_FSR () at C:/development/fpctrunk/rtl/mips/mips.inc:21
>> #1  0x00401b5c in SYSINITFPU () at
>> C:/development/fpctrunk/rtl/mips/mips.inc:61
>> #2  0x00401bd0 in FPC_CPUINIT ()
>>      at C:/development/fpctrunk/rtl/mips/mips.inc:75
>> #3  0x00429bb8 in fpc_initializeunits ()
>>      at C:/development/fpctrunk/rtl/inc/system.inc:872
>> #4  0x0040019c in main () at hellomips.lpr:16
>
> Is this stacktrace always the same? Did you wait a bit until you used 
> Ctrl+C?
>
> Someone with more MIPS knowledge than me will need to look at this, 
> though :)
>
> Regards,
> Sven
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list