On 03.11.2016 08:58, Pitchumani Sivanupandi wrote:
Most of the AVR's 8k memorydevices have only rjmp instruction, not jmp. So, it
is important to wrap around jump destination to check if it can reach backwards.
Currently link specs passes --pmem-wrap-around=xxK when mrelax and
mpmem-wrap-around options are enabled. Attached patch changes the specs so that
option --pmem-wrap-around=8K is passed for 8k memory devices if
-mno-pmem-wrap-around is not enabled.
If OK, could someone commit please?
Note: Currently 8k devices are identified based on name prefix. We are working
on alternative method to incorporate flash memory size.
Currently, "at90usb8" this the only prefix that results in wrap_k = 8, so
without adding knowledge about flash sizes to the compiler, the change makes
not much sense... (but does not do harm either).
The right place for flash size info would be avr-mcus.def together with a new
command option to specify the flash size and draw conclusions from it. When I
asked Atmel about a mapping of Device to flash size, the support told me to
check the data sheets -- not really practical for ~300 devices in avr-mcus.def
:-) Atmel *must* have information about this...
The new option would render -mn-flash superfluous, but we should keep it for
backward compatibility.
Johann
Regards,
Pitchumani
gcc/ChangeLog
2016-11-03 Pitchumani Sivanupandi <pitchuman...@atmel.com>
* config/avr/gen-avr-mmcu-specs.c (print_mcu): Update link_pmem_wrap spec
string to add linker option --pmem-wrap-around=8k.
* config/avr/specs.h: Add link_pmem_wrap to linker specs (LINK_SPEC).
diff --git a/gcc/config/avr/specs.h b/gcc/config/avr/specs.h
index 52763cc..fbf0ce6 100644
--- a/gcc/config/avr/specs.h
+++ b/gcc/config/avr/specs.h
@@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see
"%(link_data_start) " \
"%(link_text_start) " \
"%(link_relax) " \
+ "%(link_pmem_wrap) " \
"%{shared:%eshared is not supported} "
#undef LIB_SPEC
Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from
LINK_RELAX_SPEC? And what happens if relaxation is off?
Johann