怎样在编译器中把某些数组代码往指定地址编译?举例如下:
在IAR中可以这样子,先定义
__root const unsigned char startbmp[] @".ImageTest"={0xff,0x00,0xaa.........}
然后在IAR的编译选项的链接文件stm32f10x_flash.icf打开,修改如下红色所示
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08000000;//擦除和写flash都是按页来,大容量2K每页 程序本来从0x08000000开写 改后从0x08000800开写
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;//选择flash的起始地址
define symbol __ICFEDIT_region_ROM_end__ = 0x08040000;//选择flash的结束地址(STM32F103VCT6 256KB)
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;//内存的起始地址
define symbol __ICFEDIT_region_RAM_end__ = 0x2000C000;//内存的结束地址 (STM32F103VCT6 48KB)
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x400;
define symbol __ICFEDIT_size_heap__ = 0x200;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:0x0800F000 { readonly section .ImageTest };//开机图片地址0x0800F000
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };
如果我用的是KEIL,那怎样才能达到像上面这样的效果呢?因为在KEIL中我找不到链接文件stm32f10x_flash.icf,而且也不能
__root const unsigned char startbmp[] @".ImageTest"={0xff,0x00,0xaa.........}这样子定义
|