Can we use Preprocessor or (Something like that) in Linker scripts?
I am working with PIC32MZ2048EFH064, MPLABx 4.00, Harmony V2.01, XC32 V1.44.
I am trying to do like:
- I have to write certain data to EEPROM or Either in Boot Flash Area.
- If the #define USE_DATA_STORAGE is EEPROM then I need not to secure some memory portion in linker script for the data. I am storing that data to EEPROM then.
- But if my #define is USE_DATA STORAGE is BOOT_FLASH then I have to secure Boot flash memory's last page for this data, so that my compiler won't write anything on it. And I can use this area as my storage.
I have options like,
- I can write two scripts (One with secured area and other with not) and one will be selected when the preprocessor is BOOT_FLASH my first linker will be selected and other will be excluded.
- I can write preprocessor directive in linker script also. This I really don't know whether linker script do support preprocessors
- I really don't have any idea about how to implement the above options. Or If you have better option, always welcome.
Always carry latest and best tools, whether it is WAR or PROGRAMMING