了解嵌入式软件中的链接程序脚本"NOLOAD"部分 [英] Understanding linker script NOLOAD sections in embedded software

查看:99
本文介绍了了解嵌入式软件中的链接程序脚本"NOLOAD"部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 ld 的GNU文档, NOLOAD 部分的工作方式如下:

According to the GNU documentation for ld, a NOLOAD section works as following:

`(NOLOAD)'指令会将一个段标记为在运行时不被加载时间.链接器将正常处理该部分,但会对其进行标记这样程序加载器就不会将其加载到内存中.

The `(NOLOAD)' directive will mark a section to not be loaded at run time. The linker will process the section normally, but will mark it so that a program loader will not load it into memory.

现在,关于程序加载器,符合维基百科的要求:

Now, regarding to the program loader, accordign to wikipedia:

嵌入式系统通常没有装载程序,而是代码直接从ROM执行.为了加载操作系统本身,作为引导的一部分,使用了专门的引导加载程序.

Embedded systems typically do not have loaders, and instead, the code executes directly from ROM. In order to load the operating system itself, as part of booting, a specialized boot loader is used.

然后, NOLOAD 部分到底对固件/嵌入式软件有什么作用?

Then, what exactly a NOLOAD section does for FW / embedded software?

推荐答案

NOLOAD 部分定义了正确链接程序所必需的部分,但不得将其加载到内存中.例如,您可能需要将程序与位于ROM中的某些代码链接,因此您要告诉链接器将ROM中的代码标记为 NOLOAD .然后,将用于加载程序的工具(调试器,操作系统或其他工具)将不会加载此部分代码.

The NOLOAD section defines a section that is required to link the program properly but must not be loaded to memory. For example you may need to link your program with some code located in ROM, so you tell the linker to mark the code in ROM as NOLOAD. Then the tool that will load the program (a debugger, an OS or whatever) will not load this part of the code.

这篇关于了解嵌入式软件中的链接程序脚本"NOLOAD"部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆