开发者

Linker : how to place a block of data at a specific address boundary

开发者 https://www.devze.com 2023-04-12 23:57 出处:网络
This may be an easy question but I am a beginner with the linker file of GNU GCC (codesourcery arm-none-eabi ver 4.5.2).

This may be an easy question but I am a beginner with the linker file of GNU GCC (codesourcery arm-none-eabi ver 4.5.2).

I have to initialize the Mmu in a ARM7 processor and in datasheet, it is said that the Mmu page table must be located at a 16kbyte (2^14) boundary.

For now I have come with this solution, but I'm almost certain that this is not the more efficient one!

ENTRY(_start)

SECTIONS
{
 . = 0x0;
 .text : {_stext = .;
*startall.o (.text)
. = 0x4000;
*MmuSdram0.o (.text)
*(.text)
_etext = .;}
 .data : {_sdata = .;
*(.data) 
_edata = .;}
 .bss : {_sbss = .;
*(.bss) 
_ebss = .;}
}

startall.o is an assembly file containing processor initialisation.

Next line, I set the address to 0x4000 (boundary of 2^14).

MmuSdram0.o is containing the Mmu page table.

Then f开发者_StackOverflowollow the rest of the firmware.

Obviously, this solution give me a gap between the end of startall and 0x4000, which i a waste of memory space(I don't like waste ;-)

What I would do instead is to put the pagetable after the *(.text) but I don't know how to do something like :

*(.text) "except" MmuSdram0.o

And I prefer to let the linker place the page table at the next available 2^14 boundary instead of fixing the address myself. I checked in the linker documentation, found ALIGN command, but I'm not sure how to use it correctly or if this even the command that fit my need...

Thanks in advance!


hmm, place the __attribute__ (( aligned(16*1024) )) before the semicolon ';' of your mmu table declaration

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号