我在gnu arm embedded 4.9 2014q4:
的链接描述文件中定义了以下部分MEMORY
{
SRAM_L (rwx) : ORIGIN = 0x00000000, LENGTH = 32K
SRAM_U (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
}
SECTIONS
{
. = ORIGIN(SRAM_L);
.isr_vector :
{
KEEP(*(.isr_vector))
} >SRAM_L
.text :
{
. = ALIGN (4);
*(.text);
} >SRAM_L
vectors.S包含以下代码:
/* vectors.s */
.section .isr_vector
.thumb
.word _start_of_stack /* stack top address */
.word _reset /* 1 Reset */
.word hang /* 2 NMI */
.word hang /* 3 HardFault */
...
.thumb_func
.global _reset
_reset:
mov r0, #0
ldr r1, [r0]
mov sp, r1
bl low_level_init
b hang
.thumb_func
hang: b .
当程序链接时,它会在地图文件中显示.text和.vector部分重叠:
.isr_vector 0x00000000 0x146
*(.isr_vector)
.isr_vector 0x00000000 0x146 ./src/vectors.o
0x00000138 _reset
.text 0x00000000 0x6cc
0x00000000 . = ALIGN (0x4)
*(.text)
.text 0x00000000 0x134
我是否错过了.text的位置?
答案 0 :(得分:2)
我在http://hertaville.com/2012/06/29/the-startup-file/
找到了一些信息看起来我的载体中缺少以下内容。我相信这表明链接器的类型(.data)和大小正确吗? (如果我在这里错了,请纠正我)
/* vectors.s */
.syntax unified
.cpu cortex-m4
.fpu softvfp
.thumb
.global g_pfnVectors
.global _reset
.global hang
/*******************************************************************************
*
* The minimal vector table for a Cortex M4. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _start_of_stack /* stack top address */