我们正在使用基于 Beaglebone 黑色的定制板。我编辑了一个链接器脚本文件来添加内存部分以在那里记录一些信息:
. = ALIGN(4);
.logging :
{
_log_begin = .;
_log_end = . + 0x2000;
}
Run Code Online (Sandbox Code Playgroud)
我在C文件中定义了数组如下:
char log_arr[0x2000] __attribute__ ((section(".logging")));
Run Code Online (Sandbox Code Playgroud)
现在,如果我打印log_arraddress ,它会输出0x8ffa2774,但是当我检查u-boot.map文件时,我看到的log_arr是 address 0x8084b774。
u-boot 是否使用 MMU?据我所知,它在程序集编写的启动代码中已关闭。当我尝试_log_begin通过将其定义为在代码中使用时extern,u-boot 代码编译中断并抛出错误:
make 1 : * [checkarmreloc] 错误 1
当我搜索这个错误时,我得到了一些补丁,上面写着“确保 u-boot 只使用相对重定位”。这是什么意思?
u-boot 是否使用 MMU?
不。
来自U-Boot 2014-07的README文件:
U-Boot runs in system state and uses physical addresses, i.e. the
MMU is not used either for address mapping nor for memory protection.
Run Code Online (Sandbox Code Playgroud)
链接器映射中的地址值与运行时值相比的差异可能是由于 U-Boot 重新定位自身(内存更高,更接近顶部)。
再次来自 U-Boot 2014-07 的 README 文件:
After booting and sizing and initializing DRAM, the code relocates itself
to the upper end of DRAM.
Run Code Online (Sandbox Code Playgroud)
...它说“确保 u-boot 只使用相对重定位”。这是什么意思?
您的代码可以尝试使用绝对(不可重定位)内存位置,或者允许 C 分配和重定位数组(即删除节说明符)。
| 归档时间: |
|
| 查看次数: |
1904 次 |
| 最近记录: |