문제

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 follow 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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top