7、从STM32F401RE项目中,选中thumb_crt0.s,按右键,选择Exclude from Build,然后在项目中再添加$(StudioDir)/samples/SEGGER_THUMB_Startup.s文件。
8、现在我们从Embedded Studio的菜单上选择 Build->Rebuild STM32F401RE进行构建。
9、构建完成后,提示Flash重复定义:
-------------------------------------------------------------------------
1> D:/Users/jiang/Documents/SEGGER Embedded Studio for ARM Projects/STM32F401RE/SEGGER_Flash.icf:48:21: error: region 'FLASH' is already defined Build failed
-------------------------------------------------------------------------
10、查看文件SEGGER_Flash.icf,发现这个语句 define region FLASH = FLASH1;
11、再查看项目目录中STM32F401RE_MemoryMap.xml文件,发现其中:
-------------------------------------------------------------------------
<!DOCTYPE Board_Memory_Definition_File>
<root name="STM32F401RE">
<MemorySegment name="FLASH" start="0x08000000" size="0x00080000" access="ReadOnly" />
<MemorySegment name="RAM" start="0x20000000" size="0x00018000" access="Read/Write" />
</root>
-------------------------------------------------------------------------
对比Embedded Studio 5.32a中新建的同类项目,发现其引用的中Memory Segments中的定义是FLASH1 RX 0x80000000 0x00040000; RAM1 RWX 0x20000000 0x00010000
因此,我们就将STM32F401RE_MemoryMap.xml文件的FLASH和RAM改成了FLASH1和RAM1:
-------------------------------------------------------------------------
<!DOCTYPE Board_Memory_Definition_File>
<root name="STM32F401RE">
<MemorySegment name="FLASH1" start="0x08000000" size="0x00080000" access="ReadOnly" />
<MemorySegment name="RAM1" start="0x20000000" size="0x00018000" access="Read/Write" />
</root>
-------------------------------------------------------------------------
12、重新编译通过,下载,调试也都正常。