Load$$ execution region symbols

本文详细介绍了链接器为每个执行区域生成的Load$$符号,包括这些符号的描述及它们在初始化前后所对应的地址信息。同时,文章还强调了这些符号在不同情况下的应用限制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

6.3.3 Load$$ execution region symbols

The linker generates Load$$ symbols for every execution region present in the image.

Note

Load$$region_name symbols apply only to execution regions. Load$$LR$$load_region_name symbols apply only to load regions.
The following table shows the symbols that the linker generates for every Load$$ execution region present in the image. All the symbols refer to load addresses after the C library is initialized.

Table 6-2 Load$$ execution region symbols

SymbolDescription
Load$$region_name$$BaseLoad address of the region.
Load$$region_name$$LengthRegion length in bytes.
Load$$region_name$$LimitAddress of the byte beyond the end of the execution region.
Load$$region_name$$RO$$BaseAddress of the RO output section in this execution region.
Load$$region_name$$RO$$LengthLength of the RO output section in bytes.
Load$$region_name$$RO$$LimitAddress of the byte beyond the end of the RO output section in the execution region.
Load$$region_name$$RW$$BaseAddress of the RW output section in this execution region.
Load$$region_name$$RW$$LengthLength of the RW output section in bytes.
Load$$region_name$$RW$$LimitAddress of the byte beyond the end of the RW output section in the execution region.
Load$$region_name$$XO$$BaseAddress of the XO output section in this execution region.
Load$$region_name$$XO$$LengthLength of the XO output section in bytes.
Load$$region_name$$XO$$LimitAddress of the byte beyond the end of the XO output section in the execution region.
Load$$region_name$$ZI$$BaseLoad address of the ZI output section in this execution region.
Load$$region_name$$ZI$$Length
Load length of the ZI output section in bytes.
The Load Length of ZI is zero unless region_name has the ZEROPADscatter-loading keyword set. If ZEROPAD is set then:
Load Length = Image$$region_name$$ZI$$Length
Load$$region_name$$ZI$$LimitLoad address of the byte beyond the end of the ZI output section in the execution region.
All symbols in this table refer to load addresses before the C library is initialized. Be aware of the following:
  • The symbols are absolute because section-relative symbols can only have execution addresses.
  • The symbols take into account RW compression.
  • References to linker-defined symbols from RW compressed execution regions must be to symbols that are resolvable before RW compression is applied.
  • If the linker detects a relocation from an RW-compressed region to a linker-defined symbol that depends on RW compression, then the linker disables compression for that region.
  • Any zero-initialized data that is written to the file is taken into account by the Limit and Length values. Zero-initialized data is written into the file when the ZEROPAD scatter-loading keyword is used

 

    原文: http://www.keil.com/support/man/docs/armlink/armlink_pge1362065953229.htm

转载于:https://www.cnblogs.com/hwl1023/p/5242804.html

### 解决执行区域重叠问题的方法 当遇到 `Execution region ER_RO` 和 `ER_RW` 的重叠错误时,这通常是由于链接器脚本或散列文件(scatter file)中定义的内存布局不合理造成的。以下是详细的解决方案: #### 1. 修改 Scatter File 配置 Scatter 文件用于定义程序各部分如何分配到目标设备的不同存储区。如果发现两个执行区域存在地址范围冲突,则需要调整这些区域的位置。 - **重新安排执行区域** 将只读数据 (`ER_RO`) 移动到其他不与可写入数据 (`ER_RW`) 发生冲突的地址空间。例如,在 scatter 文件中可以这样设置: ```plaintext Load Region ROM (0x00000000-0xFFFFFFFF) { ExecutableRegion_ER_RO +0 : { *.o (RO) ; /* 只读段 */ } ExecutableRegion_ER_RW +0x100 : { *.o (RW, ZI); /* 可读写段 */ } } ``` - **注意事项**: 上述代码片段展示了如何通过偏移量来避免覆盖[^1]。确保每个区域都有足够的独立地址区间而不互相干扰。 #### 2. 使用 Keil IDE 中的图形化工具调整 除了手动编辑 scatter 文件外,还可以利用 Keil MDK 提供的记忆体分布对话框来进行可视化操作: - 打开项目属性窗口并导航至 Linker 设置页签。 - 勾选 'Use Memory Layout from Target Dialog' 复选框[^2]。 - 调整各个分区的具体起始位置以及长度参数直到不再有交集为止。 #### 3. 减少特定区域占用的空间需求 有时也可能是因为某些区域内存消耗过多而导致无法合理安置所有模块。此时应该考虑优化代码或者减少不必要的全局变量初始化等方式降低对应类型的资源请求量[^3][^4]: - 审查源码寻找潜在浪费的地方; - 替换效率较低算法为更节省空间版本; - 如果可能的话拆分大数组成多个较小单位以便灵活调度它们之间的相对顺序关系从而避开碰撞风险。 以上方法能够有效处理由不当设定引发的 execution regions overlapping errors 并恢复正常的构建流程。 ```c // 示例:简化结构以节约 RAM 空间 struct ExampleStruct { uint8_t flag; } __attribute__((packed)); // GCC/Clang 属性;对于 IAR 或 KEIL 用户需查阅相应文档实现相同效果 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值