We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Common C51 & A51 headers are very useful. However, there seems to be no way to write code that is conditional upon command line defines that works for both the compiler and the assembler. For example, if I define the symbol _DEBUG on the command line, I can write -
$if _DEBUG Size set 100 ; ... $else Size set 50 ; ... $endif
#ifdef _DEBUG #define size 100 // ... #else #define size 50 // ... #endif
#ifdef __A51__ $if _DEBUG #define _DEBUG $endif #endif #ifdef _DEBUG // ... #endif
I just tried the following and it worked as expected: DEFS.H
#define v1 100 #define v2 200
#include "defs.h" cseg at 0x1000 mov A, #v1 mov R0,#v2 end
LOC OBJ LINE SOURCE 1 ;#include "defs.h" +1 2 +1 3 +1 4 5 6 ---- 7 cseg at 0x1000 1000 7464 8 mov A, #100 1002 78C8 9 mov R0,#200 10 end
Yes, but try defining v1 and v2 at the command line, rather than in a header file.
Ahhhh. The SET symbols are not the same as the DEFINE macros. I'll forward this to engineering and see if they have a solution. Jon
Thanks, bill