我看到TI的一个文档:Basic Application Loading over the Serial Interface for the DaVinci TMS320DM644x,里面用了一个例程,uartapp。其链接脚本为:
ENTRY(boot)
SECTIONS {
. = 0x00008020;
.rodata : AT ( 0x0 )
{
*(.rodata*)
*(.rodata)
. = ALIGN(4);
}
.data : AT ( LOADADDR(.rodata) + SIZEOF(.rodata) )
{
*(.data)
. = ALIGN(4);
}
. -= 0x8000;
.text : AT ( LOADADDR(.data) + SIZEOF(.data) )
{
*(.text)
. = ALIGN(4);
}
.boot : AT ( LOADADDR(.text) + SIZEOF(.text) )
{
*(.boot)
. = ALIGN(4);
}
. += 0x8000;
.bss :
{
*(.bss) *(COMMON)
. = ALIGN(4);
}
__topstack = 0xC000 - 0x4;
. = 0x02000000;
.aemif :
{
*(.aemif)
}
. = 0x80000000;
.ddrram :
{
*(.ddrram)
}
}
然后还配了个图来说明内存排布:

Figure shows the object file sections in the following views:
(a) Binary Application File
(b) Physical Memory
(c) Logical Memory (showing separate data and instruction bus memory spaces)
我的问题是:
- 编译程序时,是不是链接脚本中的LMA决定了输出文件中各个section的排布?如果各个section的LMA不连续,结果会怎样?
- 程序运行时,对于 .rodata,其起始VMA= 0x00008020。我的理解是,指令需要.rodata中的数据时,会到 0x00008020开始的一段区域去找,但实际上.rodata这个section却是被加载到物理内存的0x0020开始的一段区域中的,这不是矛盾了吗?我的理解哪里有问题?