avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] New FAQ entry?


From: E. Weddington
Subject: [avr-libc-dev] New FAQ entry?
Date: Mon, 16 Dec 2002 10:45:02 -0700

Hello all,

I have another suggestion for a FAQ entry (since I'm getting a little 
tired of answering it :-))

----------------------------------------------------------------
Q. How do I relocate code to a fixed address?
A. First, you must put your code into a new named section. This is 
done with a section attribute:

__attribute__ ((section (".bootloader")))

In this example, .bootloader is the name of the new section. Place 
this attribute after the prototype of any function to place the 
function in the new section.

void boot(void) __attribute__ ((section (".bootloader")));

To relocate the section to a fixed address set the linker flag
--section-start. You can pass the --section-start linker flag to the 
linker through the -Wl GCC flag list:

-Wl,--section-start=.bootloader=0x1E000

The name after section-start is the name of the section to be 
relocated. The number after the section name is the beginning address 
of the named section.
----------------------------------------------------------------

Feel free to edit or mangle as you see fit.

Thanks,
Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]