This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Are DEFINEs in the C51 active in .h header files?

I'm trying to configure some software that has different start addresses based on how the FLASH gets updated. If FLASH is updated via a UART then the code should start at 0 otherwise it should start at 24K.
I thought the following would work - where FLASH_VIA_UART is defined in the C51 preprocessor symbols menu.

#ifdef FLASH_VIA_UART
#define RUNTIME_CODE_START_ADDRESS (RUNTIME_CODE_START_AT_0H)
#else
#define RUNTIME_CODE_START_ADDRESS (RUNTIME_CODE_START_AT_24kH)
#endif


However, this doesn't work. Instead I have to hardcode it by commenting out everything but the 2nd line. Then the software works fine.

The RUNTIME_CODE_START_ADDRESS define could be used in other defines and macros so I suspect that there is a scope problem or something. Note that this code is in a .h file which is then used in multiple files.

0