This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: avr-gcc doesn't know address space wraps?


On Sun, Jan 3, 2016 at 2:36 PM, Georg-Johann Lay <avr@gjlay.de> wrote:
> Ralph Doncaster schrieb:
>
>> On Sun, Jan 3, 2016 at 1:22 PM, Georg-Johann Lay <avr@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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]