Waiting for someone to answer, I solved the problem. There are several problems with this problem, and I thought about explaining my findings to those who might make the same mistake.
First of all, any options that must be passed to the linker must be specified with -Xlinker or with -Wl. Therefore, both 2 and 3 will not work in the above case. Corrected 2 and 3 will be as follows:
Right already
gcc $(OBJS) -l$(Lib1) -l$(Lib2) -nostdlib -lgcc -L$(library_path) -g -msmall-mode -mconst-switch-tables -mas-mode -mno-initc -Wl,--start-group,--end-group,-T,$(PATH_TO_Linker.ld),--gc-sections -Xlinker --defsym=SYMBOL_RAM_START=$(VALUE_TO_OVERRIDE) -o$(OUTPUT).elf
gcc $(OBJS) -l$(Lib1) -l$(Lib2) -Xlinker --defsym=SYMBOL_RAM_START=$(VALUE_TO_OVERRIDE) -nostdlib -lgcc -L$(library_path) -g -msmall-mode -mconst-switch-tables -mas-mode -mno-initc -Wl,--start-group,--end-group,-T,$(PATH_TO_Linker.ld),--gc-sections -o$(OUTPUT).elf
Now for the case of options 1 and 2 above, --defsym appears after the script linker and SYMBOL_RAM_START has already been defined by the linker script. He cancels it. But an overridden value will not be used, since sections are already defined as the script builder has already been used.
In case of option 3 above, SYMBOL_RAM_START was defined before the linker script was read by the linker. Therefore, when the script linker is parsed, the value specified in the script overrides it.
Decision:
For this to work, the script linker must conditionally initialize the SYMBOL_RAM_START symbol, something like below:
SYMBOL_RAM_START = DEFINED ( SYMBOL_RAM_START )? SYMBOL_RAM_START : DEFAULT_VALUE;
Given the script in the linker above, when SYMBOL_RAM_START was defined before the script linker was enabled (as shown in option 3 above), it really worked. But in the end I had to fix the linker script.
This solution does not actually override the character, but provides a way in which the character can be defined so that it can be redefined.
Aravind
source share