Linkers, Loaders & Executables
What is the role of a linker script used in embedded development?
- ATo tell the linker at which addresses, in flash or RAM, to place each section
- BTo describe steps for running program tests automatically
- CTo define coding rules and report violations
Show answer and explanation
Answer: A. To tell the linker at which addresses, in flash or RAM, to place each section
On a PC the OS loader chooses addresses, but on a microcontroller the addresses at power-on are used as they are. A linker script gives the start addresses and sizes of flash and RAM and specifies placement, such as .text and constants in flash and .data, .bss and the stack in RAM. Items that must sit at fixed addresses, such as the interrupt vector table, are also placed here.
- A. Correct. It controls the memory layout in detail.
- B. That is a separate mechanism from test automation.
- C. That is the role of tools such as static analyzers.