Understanding linker script NOLOAD sections in embedded software

耗尽温柔 提交于 2021-01-28 20:01:01

问题


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

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:

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.

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


回答1:


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.



来源:https://stackoverflow.com/questions/57181652/understanding-linker-script-noload-sections-in-embedded-software

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!