Hello,
Within your .asm file(s), you could export the names of specific assembly sub-routines required to be externally accessible to other files, either .asm or .c, using the XDEF assembler directive. For example,
XDEF routine1, routine2
For any simple global variables defined within a .c file, that need to be imported for use by the assembly code, use the XREF directive. For example,
XREF gvar1, gvar2
Probably not a good idea to import a structure or a multi-dimensional array.
To provide the equates within the .asm file, for the specific device you are using, you will probably also need the line -
INCLUDE "derivative.inc"
or the .inc file that is incorporated by the project wizard.
Then within a .c or .h file, you will need prototypes for the assembly routines. For example -
extern void *routine1(void);
When it came to using the sub-routines within a C function, I have previously use inline assembly,
__asm JSR routine1;
but presumably other methods are feasible.
This was previously applied to HCS08 coding, but I assume that the HCS12 will have similar assembler directives.
Regards,
Mac
Message Edited by bigmac on
2008-06-18 12:28 AM