A C source code file ( mixc.c) has the main() function which calls the AddVar() function. See the following listing. (Compile it with the -Cc compiler option when using the HIWARE Object File Format.)
static int Error = 0; const unsigned char CData = 12; #include "mixasm.h" void main(void) { AddVar(10); if (ASMData != CData + 10){ Error = 1; } else { Error = 0; } for(;;); // wait forever }
The application must be correctly linked.
For these C and *.asm files, a possible linker parameter file is shown in the following listing.
LINK mixasm.abs NAMES mixc.o mixasm.o END SECTIONS RAM = READ_WRITE 0x001000 TO 0x001FFF; /* EEPROM */ EEPROM = READ_ONLY 0x100000 TO 0x100FFF; /* non -paged FLASHs */ ROM = READ_ONLY 0xFF0000 TO 0xFFFDFF; END PLACEMENT SSTACK,DEFAULT_RAM INTO RAM; DEFAULT_ROM INTO ROM; END INIT main