I want select configuration from command line. In A51 I cann't define __CONFIG__ as C macros. "config.h" include in C and ASM files. config.h
#ifndef _CONFIG_H #define _CONFIG_H #define CONFIG_DEBUG 0 #define CONFIG_TEST 1 #define CONFIG_RELEASE 2 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #if __CONFIGx__ == CONFIG_DEBUG #define DEBUG 1 #define xTECH_ROM 1 #define ENABLE_EPROM 1 #define LANG UKR #define _RESTAURANT_MODE 1 #define PRINT_LOGO_FROM_ROM 1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #elif __CONFIGx__ == CONFIG_TEST #define SIMULATOR 1 #define DEBUG 1 #define xTECH_ROM 1 #define ENABLE_EPROM 1 #define LANG UKR #define _RESTAURANT_MODE 1 #define INTERNAL_TEST 1 #define xPRINT_LOGO_FROM_ROM 1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #elif __CONFIGx__ == CONFIG_RELEASE #define xDEBUG 1 #define xTECH_ROM 1 #define ENABLE_EPROM 1 #define LANG UKR #define _RESTAURANT_MODE 1 #define xPRINT_LOGO_FROM_ROM 1 #endif //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #endif
I'm quite sure you can't do that directly. There's no access at all from the Ax51 command line to the C preprocessor built into it. You *can* define Ax51 macros, though, and those you can then use to trigger #define statements. In a nutshell:
$IF (A51_CONFIG_TEST) #define __CONFIGx__ CONFIG_TEST $ELIF (A51_CONFIG_DEBUG) #define __CONFIGX__ CONFIG_DEBUG $ENDIF
A51 offers since V7.06 the DEFINE command line directive (syntax is identical with the Cx51 Compiler). For AX51 this will come in the next revision.