Link here

Tips and tricks

Tips and tricks that are useful when compiling code using the Mosaic C compiler

The Control-C cross-compiler was written by Fabius Software Systems and customized by Mosaic Industries to facilitate programming Mosaic embedded controllers in C. To program in C, use the IDE (Integrated Development Environment) based on the TextPad editor to create your source code program files. Clicking in the Terminal window and sending the download file to the 68HC11 microcontroller via the RS-232 serial link completes the process: you can then type main from your terminal to execute your program. This page summarizes tips about using function pointers.


Function pointers

When using function pointers with the Fabius C compiler, the caller and callee must be on the same memory page; i.e. they must reside in the same .C source file. When compiling using the standard Make command, the entire project is a single .C file, so this rule is not violated. If your project is large in size and requires Multi-Page Make, you must obey this rule. When compiling with Multi-Page Make, every line in your code that executes a function pointer will give this warning, even if function pointers are being used correctly:

Function_Pointer.C(39): Warning: Indirect 16-bit function call called from 'ExecuteFunctionPointer' !

To allow the calling of functions that reside in different .C files, you can create a function that calls your destination function. Your call function must reside in the same .C file, while the destination function can be in any file. This way the Fabius C compiler can detect that your call function and destination function are on different memory pages at compile time.

See also →  Mosaic IDE

This page is about: Tips and Tricks, Useful when Compiling Code Using Mosaic C Compiler, Using Function Pointers in Multi-page C Program – Tips and tricks that are useful when compiling code using the Mosaic C compiler, including using function pointers in a multi-page C program.