I have a huge DDR memory (2GB) with long access times and a small internal RAM (1MB) with short access times. At the moment, DDR has the entire .bss section. The .bss section contains one variable that is frequently used from external libraries. How can I move from low speed DDR to high speed RAM? There is no way to fit the entire .bss in RAM, nor can I modify external libraries.
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 something like that, but it doesn't work.
.bssFAST (NOLOAD) : {
. = ALIGN(4);
file.o:some_variable(.bss)
. = ALIGN(4);
} > RAM
I tried something like that, but it doesn't work.
It didn't work. The linker doesn't work at the variable level, it works at the section .
If the section is not too large , you may be able to move the entire section to .foo.o
.bss
.bssFAST
If that is not possible, the only other option is foo.o
to apply a binary patch such as:
- There is a new
.bssFAST
section (objcopy --add-section
should work), - Change it to be included in that new section
some_variable
(this should be relatively easy-.st_shndx
it needs to be updated).