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 MY_ROM = READ_ONLY 0x4000 TO 0x4FFF; MY_RAM = READ_WRITE 0x2400 TO 0x2FFF; MY_STACK = READ_WRITE 0x2000 TO 0x23FF; END PLACEMENT DEFAULT_RAM INTO MY_RAM; DEFAULT_ROM INTO MY_ROM; SSTACK INTO MY_STACK; END INIT main