This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Library functions running in RAM
- From: Janáček Jiří <jiri dot janacek at skoda dot cz>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 3 Feb 2014 13:57:16 +0000
- Subject: RE: Library functions running in RAM
- Authentication-results: sourceware.org; auth=none
-----Original Message-----
From: Janáček Jiří
Sent: Monday, February 03, 2014 1:06 PM
To: 'gcc-help@gcc.gnu.org'
Subject: Library functions running in RAM
Dear all,
I am trying to produce the linker description file to allow the execution of some functions from RAM of Cortex-R4. These functions are compiled in a library.lib.
How should the linker description look to simply attach just needed functions from given library into the RAM section?
I have tried to apply a dirty way by enumerating the needed objects.
By using ar.exe I got a list of objects within included within the library. I need just a few functions contained in some of objects.
Nevertheless I received an error message that the regions FLASH0 and RAM_CODE overflowed by some Bytes (even KB) although there is enough space defined for these regions.
SECTIONS
{
.text :
{
KEEP(*(.intvecs))
*(.text*)
*(EXCLUDE_FILE(a.obj b.obj))
*(.rodata*)
} > FLASH0
.ram_funcs :
{
ram_funcs_start = .;
a.obj (*(.text*))
b.obj (*(.text*))
} > RAM_CODE AT > FLASH0
ram_funcs_size = SIZEOF(.ram_funcs);
ram_funcs_load_start = LOADADDR(.ram_funcs);
etc.
Of course, the program will perform copying the RAM functions from ROM during start-up.
Environment:
ARM Cortex-R4
GCC 4.8 2013q4
Kind regards
JiriJ
--------------------------------------
Dear all,
I have applied a few changes and re-ordered the sections:
SECTIONS
{
.ram_funcs :
{
ram_funcs_start = .;
*a.obj (.text*)
*b.obj (.text*)
} > RAM_CODE AT > FLASH0
ram_funcs_size = SIZEOF(.ram_funcs);
ram_funcs_load_start = LOADADDR(.ram_funcs);
.text :
{
KEEP(*(.intvecs))
*(EXCLUDE_FILE(a.obj b.obj), .text)
*(.text*)
*(.rodata*)
} > FLASH0
etc.
But the linker complains there are undefined references to the functions just defined in the objects a.obj and b.obj..
These object files are located in the known/defined path - the same one where other object files produced by the compiler are located.
Thanks for your hints in advance,
JiriJ