On Sun, Jan 3, 2016 at 2:36 PM, Georg-Johann Lay <a...@gjlay.de> wrote: > Ralph Doncaster schrieb: > >> On Sun, Jan 3, 2016 at 1:22 PM, Georg-Johann Lay <a...@gjlay.de> wrote: >>> >>> Ralph Doncaster schrieb: >>>> >>>> avr-gcc 4.9.2 doesn't seem to know that the address space wraps, so >>>> that an rjmp in the last 2KB of the address space can reach code in >>>> the first 2KB. [...] > > Well, you are using RJMP with an address that's out of scope, hence the > linker/locator complains. The compiler would not generate code like > >>>> rjmp ResetVector [...] > Third approach is to link with --pmem-wrap-around= so that no explicit > offset and no explicit RJMP is needed in the code.
Thanks for the reference to the --pmem-wrap-around= option. I understand what's going on now; even though the compiler knows the MCU (-mmcu=), that does not get passed to the linker. Since the linker doesn't know the exact flash size of the part it is linking for, that has to be specified with the --pmem-wrap-around option. In this case, with a m328p, adding "-Wl,--relax -Wl,--pmem-wrap-around=32k" does the trick.