CF68KLib Frequently Asked Questions

Please note that CF68KLib is an older tool which is no longer supported. See here for our current range.

What is CF68KLib?

CF68KLib is a 680x0 emulation library which enables you to run 680x0 binaries either unmodified, or very slightly modified, on a ColdFire processor (Version 3 cores onwards). It achieves this by catching exceptions caused by unimplemented 680x0 instructions, performing the equivalent operation, and adjusting the stacked program counter to continue at the next instruction.

Do I have to buy a license to use CF68KLib?

No. CF68KLib is being made available absolutely free of charge as the result of an agreement between MicroAPL and Freescale Semiconductor (now NXP).

Are there any restrictions on what I can do with CF68KLib?

Use of CF68KLib is subject to a license agreement, and you should read this before downloading it. As you will see, there are no restrictions on normal use of the library, and you can freely incorporate it in your applications and products.

Can I run an RTOS under CF68KLib?

Yes, provided you use the Supervisor Mode form of CF68KLib. In this form, the library takes over all ColdFire exceptions, and simulates a complete virtual 680x0 machine. As a result, your RTOS will behave as though it were running on a real 680x0 processor. Obviously, you will need to ensure that I/O and interrupts are handled correctly for the target hardware (just as you would if you were migrating to a different 680x0 board).

In what form is CF68KLib distributed?

CF68KLib exists in a number of different variants, depending on which 680x0 processor it is emulating and on whether you want to run user-mode code only, or supervisor-level code as well. You can also selectively omit certain sets of instructions if you know these are not used in your code. For convenience in handling all of these variants, CF68KLib is distributed by means of an executable program generator, which automatically builds the version of the library which you specify. The output from this program generator comprises two ColdFire assembly-language source code files; these are the emulation library itself (which you normally won't need to modify), and a front-end, which you can customize as required. You can then assemble and link these files with your own application as required.

What ColdFire toolsets are supported?

The output from the CF68KLib program generator is assembly language source, ready to be assembled by the Diab Data, Gnu, or Microtec Research ColdFire (or 68K) assemblers.

Can CF68KLib be used on any ColdFire processor?

No, it runs only on Version 3 and later ColdFire cores (for example, a 5307). The reason for this is that the earlier cores do not decode the full instruction set space, and so do not necessarily generate an exception for 680x0 instructions or addressing modes missing in the ColdFire instruction set. This means that CF68KLib cannot be used on a 5204 or 5206 processor.

Will my code require any modifications to run under CF68KLib?

A lot of code can be run without any changes, since CF68KLib includes handlers to emulate all missing 680x0, CPU32 and CPU32+ instructions. However, there are a few special cases where an instruction behaves slightly differently under ColdFire and which the emulation library cannot automatically correct. The most important of these are:

  • MULU and MULS instructions executed on ColdFire do not set the overflow flag. Because these are legal ColdFire instructions, with the same opcodes as the 680x0 equivalents, no exception is generated and the CF68KLib handler will therefore not be called. If the original code depends on multiply setting the overflow flag, it will need to be patched or modified to run correctly.
  • Certain variants of the divide instructions DIVS.L and DIVU.L behave differently under ColdFire.
  • MOVE.B <ea>,-(A7) and MOVE.B (A7)+,<ea> change the stack pointer by one byte on ColdFire instead of 2 bytes as on the 680x0.
  • An instruction such as MOVE.L (A7)+,(A0,D0.W) is not legal in ColdFire because word-length displacements are not supported. Although the ColdFire processor will take an exception for this instruction, it does so only after incrementing the stack pointer, and so the exception stack frame overwrites the data to be restored. As a result, it is impossible for CF68KLib to reproduce the correct behavior.

Is there any 680x0 code which cannot be run under CF68KLib?

Assuming that any external services (such as I/O) are available or simulated in the target ColdFire environment, almost any 680x0 code can be run under CF68KLib. However, a few programming tricks which are legal but deprecated on the 68000 family will prevent successful operation under the library. These include writing below the user stack pointer, which is possible on a 680x0 because interrupts switch to a different stack, and using the top 8 bits of 68000/68010 address registers to hold status flags.

Does CF68KLib implement floating-point instructions?


What is the performance like?

There is quite a significant overhead incurred when the ColdFire processor encounters an unimplemented instruction which has to be handled by CF68KLib. As a result, the effective performance which you will see will depend very much on whether your application triggers lots of exceptions within performance-critical loops. For best performance of production code, we recommend either recompiling for ColdFire (if the code was written in C or another high-level language), or translating using PortAsm/68K for ColdFire (if the code was written in assembly language).

What about support?

Initial first-level support by e-mail is free. If you have queries regarding the use of CF68KLib, or if you are having problems getting started, send us an e-mail at  coldfire @  and we will try to help you. This free support service is limited to simple problems which we can answer without needing to understand the details of your code. Please be patient if we do not reply immediately to queries under this free service - we obviously have to give priority to customers who have subscribed to our full support contract.

If you are using CF68KLib for a large-scale porting project, you should consider taking out a support contract. This will give you a 1 year membership of MicroAPL's e-mail based Support Service. We aim to answer queries in 24 hours, and our customers tell us that the standard of our technical support is excellent. We also offer on-site support where our consultants can be on hand to assist your porting needs.