<br />ADS下的分散加载文件应用实例<br />load_region_name start_address | "+"offset [attributes] [max_size]<br />{<br /> execution_region_name start_address | "+"offset [attributes][max_size]<br /> {<br /> module_select_pattern ["("("+" input_section_attr | input_section_pattern)<br /> (][","] "+" input_section_attr | "," input_section_pattern)) * ")"]<br /> }<br />}<br />load_region: 加载区,用来保存永久性数据(程序和只读变量)的区域;<br />execution_region: 执行区,程序执行时,从加载区域将数据复制到相应执行区后才能被正确执行;<br />load_region_name: 加载区域名,用于“Linker”区别不同的加载区域,最多31个字符;<br />start_address: 起始地址,指示区域的首地址;<br />+offset: 前一个加载区域尾地址+offset 做为当前的起始地址,且“offset”应为“0”或“4”的倍数;<br />attributes: 区域属性,可设置如下属性:<br /> PI 与地址无关方式存放;<br /> RELOC 重新部署,保留定位信息,以便重新定位该段到新的执行区;<br /> OVERLAY 覆盖,允许多个可执行区域在同一个地址,ADS不支持;<br /> ABSOLUTE 绝对地址(默认);<br />max_size: 该区域的大小;<br />execution_region_name:执行区域名;<br />start_address: 该执行区的首地址,必须字对齐;<br />+offset: 前一个执行区域尾地址+offset 做为当前的起始地址,且“offset”应为“0”或“4”的倍数;attributes: 区域属性,可设置如下属性:<br /> PI 与地址无关,该区域的代码可任意移动后执行;<br /> OVERLAY 覆盖;<br /> ABSOLUTE 绝对地址(默认);<br /> FIXED 固定地址;<br /> UNINIT 不用初始化该区域的ZI段;<br />module_select_pattern: 目标文件滤波器,支持通配符“*”和“?”;<br /> *.o匹配所有目标,* (或“.ANY”)匹配所有目标文件和库。<br />input_section_attr: 每个input_section_attr必须跟随在“+”后;且大小写不敏感;<br /> RO-CODE 或 CODE<br /> RO-DATA 或 CONST<br /> RO或TEXT, selects both RO-CODE and RO-DATA<br /> RW-DATA<br /> RW-CODE<br /> RW 或 DATA, selects both RW-CODE and RW-DATA<br /> ZI 或 BSS<br /> ENTRY, that is a section containing an ENTRY point.<br /> FIRST,用于指定存放在一个执行区域的第一个或最后一个区域;<br /> LAST,同上;<br />input_section_pattern: 段名;<br />汇编中指定段:<br /> AREA vectors, CODE, READONLY<br />C中指定段:<br />#pragma arm section [sort_type][[=]"name"]] [,sort_type="name"]*<br />sort_type: code、rwdata、rodata、zidata<br /> 如果“sort_type”指定了但没有指定“name”,那么之前的修改的段名将被恢复成默认值。<br />#pragma arm section // 恢复所有段名为默认设置。<br />应用:<br /> #pragma arm section rwdata = "SRAM",zidata = "SRAM"<br /> static OS_STK SecondTaskStk[256]; // “rwdata”“zidata”将定位在“sram”段中。<br /> #pragma arm section // 恢复默认设置<br />分散加载文件中定义如下:<br /> Exec_Sram 0x80000000 0x40000<br /> {<br /> * (sram)<br /> }<br />“PI” 属性使用示例:<br />LR_1 0x010000 PI ; The first load region is at 0x010000.<br />{<br /> ER_RO +0 ; The PI attribute is inherited from parent.<br /> ; The default execution address is 0x010000, but the code can be moved.<br /> {<br /> *(+RO) ; All the RO sections go here.<br /> }<br /> ER_RW +0 ABSOLUTE ; PI attribute is overridden by ABSOLUTE.<br /> {<br /> *(+RW) ; The RW sections are placed next. They cannot be moved.<br /> }<br /> ER_ZI +0 ; ER_ZI region placed after ER_RW region.<br /> {<br /> *(+ZI) ; All the ZI sections are placed consecutively here.<br /> }<br />}<br />LR_1 0x010000 ; The first load region is at 0x010000.<br />{<br /> ER_RO +0 ; Default ABSOLUTE attribute is inherited from parent. The execution address<br /> ; is 0x010000. The code and ro data cannot be moved.<br /> {<br /> *(+RO) ; All the RO sections go here.<br /> }<br /> ER_RW 0x018000 PI ; PI attribute overrides ABSOLUTE<br /> {<br /> *(+RW) ; The RW sections are placed at 0x018000 and they can be moved.<br /> }<br /> ER_ZI +0 ; ER_ZI region placed after ER_RW region.<br /> {<br /> *(+ZI) ; All the ZI sections are placed consecutively here.<br /> }<br />}<br />
|