我正在使用带有 STM32F10x_StdPeriph 库的 STM32F103ZG。我开始使用 Keil ARM-MDK 开发该项目,但现在转移到了 GCC。到目前为止,切换过程非常顺利。我使用FLASH的最后一页作为配置页来存储产品的具体参数。这个页面显然位于 bank 2。在某些情况下,这些配置参数需要在运行时更新,但是现在我已经转移到 GCC,当我尝试写入时,第二个 memory bank 进入忙碌状态然后它一直很忙,直到我重新启动电源。擦除工作正常,但写入失败。我确实解锁了所有 FLASH 并确保所有时钟都已初始化以访问 FLASH。几个论坛上的其他一些帖子表明我的链接器文件存在问题,但我使用的所有示例都没有区别。
如果有人能告诉我我做错了什么,我将不胜感激。
谢谢,
H
_Min_Heap_Size = 0x800; /* required amount of heap */
_Min_Stack_Size = 0x800; /* required amount of stack */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x10000
FLASH_CFG (rx) : ORIGIN = 0x080FF800, LENGTH = 0x80
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x18000
}
SECTIONS
{
.text :
{
_stext = .; /* Provide the name for the start of this section */
CREATE_OBJECT_SYMBOLS
KEEP(*(.vectors))
*(.text)
*(.text.*)
. = ALIGN(4); /* Align the start of the rodata part */
*(.rodata)
*(.rodata.*)
*(.glue_7)
*(.glue_7t)
. = ALIGN(4); /* Align the end of the section */
} > FLASH
_etext = .; /* Provide the name for the end of this section */
.data : AT (_etext)
{
. = ALIGN(4); /* Align the start of the section */
_sdata = .; /* Provide the name for the start of this section */
*(.data)
*(.data.*)
. = ALIGN(4); /* Align the start of the fastrun part */
*(.fastrun)
*(.fastrun.*)
. = ALIGN(4); /* Align the end of the section */
} > RAM
_edata = .; /* Provide the name for the end of this section */
.bss :
{
. = ALIGN(4); /* Align the start of the section */
_sbss = .; /* Provide the name for the start of this section */
*(.bss)
*(.bss.*)
. = ALIGN(4); /* Align the end of the section */
} > RAM
_ebss = .; /* Provide the name for the end of this section */
._user_heap_stack :
{
. = ALIGN(4);
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(4);
} >RAM
_estack = ORIGIN(RAM) + LENGTH(RAM);
.static_cfg :
{
. = ALIGN(4);
*(.static_cfg)
*(.static_cfg.*)
. = ALIGN(4);
} > FLASH_CFG
_estatic_cfg = .;
_end = .;
PROVIDE (end = .);
}