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.
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.
"FLASH_VIA_UART is defined in the C51 preprocessor symbols menu."
This should work, so you must be doing it wrong!
You need to provide more detail of how you are defining it "in the C51 preprocessor symbols menu"
"this code is in a .h file which is then used in multiple files"
Maybe you are just defining the symbol for one file (or group of files)? You would need the definition to apply to the whole project - or, at least, to all source filse that use this header...