Last June, someone asked about how command line symbols defined for both the assembler and the C compiler could be referenced within a conditional (if) statement within a universal shared header file. A company rep said they'd forward this to the tech team for advice. Whatever happened? The issue is this: Symbols of identical name specified on the command line for the assembler and the C compiler end up being unique symbols. Those specified for the assembler are defined as per a "$set" directive and are visible only to the assembler. Those specified for the C compiler are defined as per a "#define" directive and are only visible when running the compiler. In other words, there is no way to define a symbol on the A51 assembler command line that will be visible to the C preprocessor within the assembler. Symbols defined this way are only visible to "$if" statements. PROBLEM: A universal header file containing an "#ifdef SYMBOL" conditional branch will work within C modules, but will not work within assembler modules because the assembler's C preprocessor WILL NOT recognize the referenced symbol and will thus test false. Example:
#ifdef SYMBOL #include <me.h> #endif
#define SYMBOL
Often I have to make several to separate out what the assembler can not handle. Hmm... what's wrong with just putting a big
#ifdef __C51__ /* ... */ #endif
The funny thing about your suggestion is that one of the things the assembler can not handle is #ifdef. Erik
Actually it does. I already use that one.
that must be in a revison later than when I gave up on it. Not necessarily later than the one I use (7.xx). Erik
I can believe that because now that I think about it, I recall it failing in the past. Hmmmm, seems some C51 constructs are creeping into A51 after all ;)
In our shared headers we extensively use both
#ifdef __C51__ ... stuff intended only for C51 compiler ... such as structure definitions #endif
#ifndef __C51__ ... stuff intended only for A51 Assembler ... such as assembler macros #endif