EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

M68k Floating Point Problems With libgcc

Started by b_Schmidtke 5 years ago1 replylatest reply 5 years ago68 views

I am trying to build a temperature control application for a M68000 CPU using the m68k-elf

GNU tool chain. The application builds but will not run due to problems with the library routines

in libgcc.a. Case in point, the function __ltdf2 once linked in is as follows:

000166b4 <__ltdf2>:
   166b4:    4e56 0000          linkw %fp,#0
   166b8:    4878 0001          pea 1 <ADD>
   166bc:    2f2e 0014          movel %fp@(20),%sp@-
   166c0:    2f2e 0010          movel %fp@(16),%sp@-
   166c4:    2f2e 000c          movel %fp@(12),%sp@-
   166c8:    2f2e 0008          movel %fp@(8),%sp@-
   166cc:    61ff               bsrs 166cd <__ltdf2+0x19>
   166ce:    ffff               .short 0xffff
   166d0:    fdb8               .short 0xfdb8
   166d2:    4e5e               unlk %fp
   166d4:    4e75               rts
 

The branch at 0x166cc is incorrect. This function as it exists in the library is as follows:

00000000 <__ltdf2>:
   0:   4e56 0000       linkw %fp,#0
   4:   4878 0001       pea 1 <__ltdf2+0x1>
   8:   2f2e 0014       movel %fp@(20),%sp@-
   c:   2f2e 0010       movel %fp@(16),%sp@-
  10:   2f2e 000c       movel %fp@(12),%sp@-
  14:   2f2e 0008       movel %fp@(8),%sp@-
  18:   61ff 0000 0000  bsrl 1a <__ltdf2+0x1a>
  1e:   4e5e            unlk %fp
  20:   4e75            rts

The branch in question looks more realistic, but I suspect it is supposed to be filled in with a branch

to someplace but I don't know where.

Has anyone used the floating point functions in libgcc.a with any success?

[ - ]
Reply by b_SchmidtkeFebruary 27, 2019

Problem solved. The gcc tool chain for the m68k needs to be configured with the --with-cpu=68000 option. This will build libgcc.a with the correct function calls.

The 2024 Embedded Online Conference