在移植STM32的时候 虽然统一系列几乎可以通用,但是有时为了得到某款芯片具体功能,需要更换启动配置文件,这里以自己STM32F103ZET6换STM32F103VGT6为例,在做项目时发现内存不够用时:
报了如等等下错误:
.......
..\OBJ\MALLOC.axf: Error: L6406E: No space in execution regions with .ANY selector matching gui_charline.o(i._Log2VisBuffered).
..\OBJ\MALLOC.axf: Error: L6406E: No space in execution regions with .ANY selector matching guicc_888_index2color.o(i.LCD_Index2Color_888).
..\OBJ\MALLOC.axf: Error: L6406E: No space in execution regions with .ANY selector matching guicc_8888.o(i._Color2Index_8888).
..\OBJ\MALLOC.axf: Error: L6406E: No space in execution regions with .ANY selector matching guicc_8888_index2color.o(i.LCD_Index2Color_8888).
..\OBJ\MALLOC.axf: Error: L6406E: No space in execution regions with .ANY selector matching iusefp.o(.text).
..\OBJ\MALLOC.axf: Error: L6407E: Sections of aggregate size 0x1977c bytes could not fit into .ANY selector(s).
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 0 warning and 706 error messages.
"..\OBJ\MALLOC.axf" - 706 Error(s), 0 Warning(s).
Target not created.
在网上找到解决办法可以参照这个
链接:https://blog.csdn.net/gengyiping18/article/details/52640806
后来核对项目芯片发现VGT6这款芯片内存够用,只不过用的是ZET6
代码移植的,需要改配置文件。
可以说共四步:
1)核查自己使用芯片对于的启动文件,找到芯片对于的启动文件,
关于型号与启动文件对映选择关系可以参照这个。
链接:https://blog.csdn.net/u012166958/article/details/80495901
2)找到启动文件,替换在工程下core(以MDK为例)文件夹下的启动文件(个人将startup_stm32f10x_hd.s更换startup_stm32f10x_xl.s),再Options of Target下(也就是俗称的魔法棒),选择和相同的芯片型号。
3)在Options for Target >C/C++>Define将STM32F10X_HD,USE_STDPERIPH_DRIVER改成STM32F10X_XL,USE_STDPERIPH_DRIVER 这里要和core下的启动文件一致
4)最后在Options for Target >Utilitiles>Settings下添加相匹配的FLASH
完成以上4步在编译就可以了 这样就完成了换启动文件。