Discussion:
[avr-libc-dev] [bug #48473] FAQ: "How do I relocate code to a fixed address?" can be misleading
Tyg
2016-07-11 18:26:34 UTC
Permalink
URL:
<http://savannah.nongnu.org/bugs/?48473>

Summary: FAQ: "How do I relocate code to a fixed address?"
can be misleading
Project: AVR C Runtime Library
Submitted by: tyg
Submitted on: Mon 11 Jul 2016 06:26:31 PM GMT
Category: Documentation
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Documentation
Status: None
Percent Complete: 0%
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 1.8.0
Fixed Release: None

_______________________________________________________

Details:

The method described in http://www.nongnu.org/avr-libc/user-manual/FAQ.html >
"How do I relocate code to a fixed address?" does not work in every
situation.

A function can get inlined during optimization. In this case the code is not
run from the specified address as I would expect.

I recently had a problem writing the FLASH on XMEGAs because of this (as the
SPM instruction has to reside in the boot section of FLASH). It took me a
while to debug this. My solution was to use the following attribute:

__attribute__ ((noinline, section (".boot")))

I suggest putting a note about this case. I think it would be very useful for
others like me.



_______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 11 Jul 2016 06:26:31 PM GMT Name: inline_section_bug_sample.zip
Size: 1022B By: tyg

<http://savannah.nongnu.org/bugs/download.php?file_id=37813>

_______________________________________________________

Reply to this item at:

<http://savannah.nongnu.org/bugs/?48473>

_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
Georg-Johann Lay
2016-07-11 18:44:59 UTC
Permalink
Follow-up Comment #1, bug #48473 (project avr-libc):

If inlining is a problem, then the same applies to cloning. Hence the docs
should also recommend __noclone__ and __no_icf__ (provided gcc supports
these attributes).

_______________________________________________________

Reply to this item at:

<http://savannah.nongnu.org/bugs/?48473>

_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/

Loading...