• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

How to build for 040 FPU with Codewarrior Pro 4

lobust

6502
According to the CW documentation, selecting 68881 for floating point should generate fpu instructions on a 68040.

There are two codepaths you can follow to compile for fpu, either by using Metrowerks' math.h or by using Apple's fp.h (a comment in math.h says that using fp.h is not recommended as it is mac 68k target exclusive). In either case, using one of these headers and enabling 68881 should generate fpu instructions for relevent math functions.

No matter what I try, I am getting bus errors as soon as any fp math function is encountered, and I can't figure out why.

Can anyone point me in the right direction?
 
Figured it out, kind of. At least I got a test project to build...

First, you have to replace MathLib68K in your project with one built with 68881 enabled, but there is no build target for that so you have to make one first.

Then, if using SIUOX console, you also have to replace the MSL C and MSL C++ libraries in your project with 68881 builds, there are build targets for these two, but no prebuilt binaries.
 
Did you use Gestalt to make sure 68881 instructions will work?

Did you link with the _F_ variant of MSL? See "Library Naming Conventions" in "Target Mac OS.pdf"?

Did you try debugging the code, stepping through assembly instructions until it crashes? Where does it actually crash?

doubles for 68881 codegen are 12 bytes if 8 byte doubles is disabled.
 
Did you use Gestalt to make sure 68881 instructions will work?

Did you link with the _F_ variant of MSL? See "Library Naming Conventions" in "Target Mac OS.pdf"?

Did you try debugging the code, stepping through assembly instructions until it crashes? Where does it actually crash?

doubles for 68881 codegen are 12 bytes if 8 byte doubles is disabled.

Thanks for the reply!

My test project is a SIOUX project with a couple of basic trig functions using cout to display the results.

No to gestalt, just assumed as it's running on a full 040 and the CW documentation said that it should...

Yes to the _F_ variants, not when I first posted, but I figured that out before my second post. There is no build target that I can find for an _F_ variant of MathLib68K, not sure why that is, but it works with the one I made.

Yes, I ran it with the debugger, but I have no idea what I'm doing with 68k debugging. It was crashing on MOVE.L instructions in all cases though.

I am using double_t, which should resolve to double double using either fp.h or math.h...
 
Back
Top