简述
keil MDK IDE目前在MCU开发中使用非常广泛,有些时候可能要做一些代码移植,或者更加灵活的处理memory的问题,就需要用到scatter file了,这里对scatter file的一些写法做些学习。
典型的scatter file结构
![这里写图片描述 [ArmCompiler6--armlink]Keil-MDK中scatter file语法_MDK](https://file.cfanz.cn/uploads/png/2022/09/08/5/TL2MZ3a7BL.png)
load region的描述
load_region_description ::=  load_region_name  (base_address  | ("+" offset)) [attribute_list] [max_size]
       "{"          execution_region_description+        "}"这里需要对attribute_list做下详细介绍:
Attr  | 说明  | 
ABSOLUTE  | 指定链接地址  | 
ALIGN alignment  | 为load region增加分配限制,从4到alignment  | 
NOCOMPRESS  | 默认RW数据压缩是启用的,该属性将指定load region中某些内容不能压缩  | 
OVERLAY  | 运行在同一地址有多个load region的重叠,但是ARM工具并不允许重叠,因此需要自己提供重叠管理  | 
PI  | 位置独立  | 
execution region的描述
execution_region_description ::=
exec_region_name (base_address | "+" offset) [attribute_list] [max_size | length]
"{" input_section_description* "}"
attribute_list和load region的类似
input section description
input_section_description ::=   module_select_pattern [ "(" input_section_selector ( "," input_section_selector )* ")" ]input_section_selector ::= "+" input_section_attr        | input_section_pattern
        | input_section_type        | input_symbol_pattern        | section_properties![这里写图片描述 [ArmCompiler6--armlink]Keil-MDK中scatter file语法_语法_02](https://file.cfanz.cn/uploads/png/2022/09/08/5/aQ76H65HNe.png)
描述项  | 说明  | 
Module name  | object filename, lib member name, lib filename  | 
Input section name  | section name, type or attributes(READ-ONLY, CODE)  | 
Symbol name  | 符号  | 
                










