Hello,
Can anyone please help me to fix the issue, I have two files uncached.c
and gbl_data.c and both these files contain global variables meaning bss
data, Now my requirement is i want to place these two files at different
memory address i.e.
MEMORY
{
ram (rwx) : ORIGIN = 0, LENGTH = 0x14000000
uncachedram (rwx) : ORIGIN = 0x14000000, LENGTH = 0x10000000
dram (rwx) : ORIGIN = 0x15000000, LENGTH = 0xEAFFFFFF
}
i want uncached.o should start from "uncachedram" and gbl_data.o from
"dram"
I could place both .o file at same location i.e.
.bss :
{
*(uncached_flags.o)
*(.bss)
*(gbl_shared_data.o)
}>uncachedram
But while trying to put uncached.o @ "uncachedram" and gbl_data.o @
"dram"
I tried many options but none of them worked.
Monika T. wrote:> Can anyone please help me to fix the issue, ...
If you want to do this through the linker script, you'll need to get rid
of wildcards in your file names (otherwise the linker will pick up all
matching files for the default section).
Try like this:
dram (rwx) : ORIGIN = 0x15000000, LENGTH = 0xEAFFFFFF
6
}
7
8
SECTIONS
9
{
10
arbitrary_named_section_1:
11
{
12
file_for_normal_section.o (*);
13
file_for_other_bss_section.o (.text, .data)
14
} > ram
15
16
arbitrary_named_section_2:
17
{
18
file_for_other_bss_section.o (.bss)
19
} > uncachedram
20
}
This should put all data of all mentioned files into ram except the .bss
section of file_for_other_bss_section.o which will go into uncachedram.
Note that if you have other sections in your
file_for_other_bss_section.o file, you want to have in ram, you'll need
to add their names into the parenthesis.
Hello Markus,
Thanks for information , but by doing so the global variables (bss
section)of "uncached_flags.o"
rather than starting @address 0x14000000 i.e. uncachedram is taking
address of .bss section being generated from compiler
my uncached.c file has following contents:
volatile int gbl_slave_start_flag;
gbl_data.c has following contents:
unsigned int lock;
Now i want to place "gbl_slave_start_flag" (From uncached.c) at
0x14000000 i.e. @uncachedram
And "lock" (from gbl_data.c) at 0x15000000 i.e. @ dram
But by doing so the compiler generates its .bss section with some
address lets say 0xxx and places
both these variables at 0xxx and 0xxx+some offset
Even if i define .bss section in my linker script then also the above
mentioned variables go into the address of .bss section
I also tried one more thing i.e. i removed .bss from following:
arbitrary_named_section_2:
{
uncached.o (.bss)
} > uncachedram
Then also since ""gbl_slave_start_flag" is global unitialized data so
it lies in .bss section resulting in its address being taken from .bss
area not from uncachedram.
So my query is how can i place variables/.o's files which lies in bss
section at a fixed addresses.
i.e. two files which lie in bss section at two fixed memory locations.
Thanks for help.
Monika
Just checked. The file as shown above works for me:
Note that you'll need to compile and link your sources with -fno-common
to avoid special .bss treatment as gcc's common blocks.
Hello Markus,
To get rid of error if i define bss section then again i am getting the
same issue i.e. my gbl_slave pointing to 0x15000xxxx and gbl_data also
pointing to 0x15000xxxx where as my requirement was:
gbl_slave should point to 0x14000xxxx and gbl_data should point to
0x15000xxxx.
Regards,
Monika