Issue
I have a huge DDR memory (2GB) with huge access time and tiny internal RAM (1MB) with tiny access time. At this moment I have whole .bss section in DDR. The .bss section contains one often used variable from external library. How can I move it from slow DDR to fast RAM? There is no way to fit whole .bss in RAM and also I can't modify external library.
Disassembly of section .bss:
8000008c <some_variable>
.bss (NOLOAD) : {
. = ALIGN(4);
__bss_start = .;
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
} > DDR
I tried someting like that, but its not work.
.bssFAST (NOLOAD) : {
. = ALIGN(4);
file.o:some_variable(.bss)
. = ALIGN(4);
} > RAM
Solution
I tried someting like that, but its not work.
That couldn't work: the linker doesn't work at the variable level, it works on sections.
If foo.o
s .bss
section is not too large, you may be able to move that entire section into .bssFAST
.
If you can't do that, your only other choice is to binary-patch foo.o
such that:
- It has a new
.bssFAST
section (objcopy --add-section
should work) and - Change
some_variable
so it's in that new section (this should be relatively easy -- updating.st_shndx
should do it).
Answered By - Employed Russian Answer Checked By - Timothy Miller (WPSolving Admin)