--- In lpc2000@yahoogroups.com, "sig5534" <sig5534@h...> wrote:
>
> In the IAR compiler there was an attribute to declare a function to
> get it mapped into RAM. How is this handled in GCC? Is there some
> equiv attribute?
>
> Thanks, Chris.
Chris,
One method is to compile as normal in gcc then use objcopy to rename
the .text segment to .data.
gcc ... file.c
objcopy --rename-section .text=.data file.o
Make sure your startup file inits the data section and away you go.
The other method is to add the file to the .data section in your
linker script, eg.
.data : AT (_etext)
{
__data_start = .;
*file.o (.text*)
*(.data .data.*)
*(.gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
} >DATA
. = ALIGN(4);
This can sometimes fail if you have a *(.text*) in your text section.
You may sometimes need to use -mlong-calls gcc option or #pragma
long_calls depending the device memory.
It could probably be done with __attribute__ ((section (".."))) - not
tried this method.
Hope this helps
sjoMessage
Re: How to declare RAM functions in GCC
2005-01-14 by ntfreak2000
Attachments
- No local attachments were found for this message.