Using a bit of conditional compilation to isolate the machine dependencies should enable you to get a lot of testing done on the host.
Eg
Code:#include <stdio.h> typedef struct FOO_tag{ int PER; int PDR; int PSR; } FOO; /* don't typedef pointer types *pointerFOO; */ #if defined TARGET #define INIT_ADR ((FOO*)0x12345678) FOO *getMyFoo ( void ) { FOO *result = INIT_ADR; return result; } #elif defined HOST FOO *getMyFoo ( void ) { static FOO test = { 1, 2, 3 /* useful data */ }; return &test; } #else #error neither HOST or TARGET specified #endif int main ( ) { FOO *p = getMyFoo(); printf("PER=%d\n", p->PER ); return 0; }
$ gcc -DHOST foo.c
$ ./a.out
PER=1



LinkBack URL
About LinkBacks


