我用GNU工具链 + JLink开发STM32,把代码编译、链接到片内SRAM,然后用GDB加载到SRAM,在GDB下运行却不能进入中断服务程序。在SRAM中跑时,除了不能进入中断外,其它一切正常。同一份程序,编译、链接到片内FLASH,用JFlash下载到FLAH,脱机跑却一切正常,不知道这是什么原因?下面分别是我的链接到SRAM和FLASH的链接脚本
链接到SRAM的链接脚本:
MEMORY
{
FLASH(rwx) : ORIGIN = 0x08000000, LENGTH = 64K
SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
SECTIONS
{
.text : AT (0x08000000)
{
KEEP(*(.vectors_sec))
*(.text)
*(.rodata)
. = ALIGN(4);
_etext = .;
} > SRAM
.data : AT (_etext)
{
_sdata = .;
*(.data)
. = ALIGN(4);
_edata = .;
} > SRAM
.bss (NOLOAD) :
{
_sbss = .;
*(.bss)
*(COMMON)
. = ALIGN(4);
_ebss = .;
} > SRAM
_st_top = 0x20000000 + 20K;
}
链接到FLASH的链接脚本:
MEMORY
{
FLASH(rwx) : ORIGIN = 0x8000000, LENGTH = 64K
SRAM(rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
SECTIONS
{
.text : AT (0x8000000)
{
KEEP(*(.vectors_sec))
*(.text)
*(.rodata)
. = ALIGN(4);
_etext = .;
} > FLASH
.data : AT (_etext)
{
_sdata = .;
*(.data)
. = ALIGN(4);
_edata = .;
} > SRAM
.bss (NOLOAD) :
{
_sbss = .;
*(.bss)
*(COMMON)
. = ALIGN(4);
_ebss = .;
} > SRAM
_st_top = 0x20000000 + 20K;
} |