This is the mail archive of the
mailing list for the GCC project.
Re: avr-gcc doesn't know address space wraps?
- From: Ralph Doncaster <ralphdoncaster at gmail dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>, gcc at gcc dot gnu dot org
- Date: Sun, 3 Jan 2016 15:44:41 -0400
- Subject: Re: avr-gcc doesn't know address space wraps?
- Authentication-results: sourceware.org; auth=none
- References: <CAAmKpLHuPwWcMgA_XMAQbaB+jFx6q3cWk7nDJ3OiZXkHPmxcdw at mail dot gmail dot com> <568958CC dot 9000404 at gjlay dot de> <CAAmKpLExcBtXgOhqi7S3VJ1tVtpOWpUFZQYFNnmVAN2riX0KYg at mail dot gmail dot com> <56896A40 dot 6060707 at gjlay dot de>
On Sun, Jan 3, 2016 at 2:36 PM, Georg-Johann Lay <email@example.com> wrote:
> Ralph Doncaster schrieb:
>> On Sun, Jan 3, 2016 at 1:22 PM, Georg-Johann Lay <firstname.lastname@example.org> 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