Tyg
2016-07-11 18:26:34 UTC
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/
<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/