Recently I started playing with bare-metal programming, and thus I need to know how to write Linker Scripts. I tried learning it by grabing an example linker script, and looking up every command in it. This approach however has at lest 3 problems:
I cannot resist the great fear that I would “miss” something by not reading the entire document. For instance, the concept of VMA/LMA is introduced in the first subsection, and there is no way I can learn it without reading the whole section from the beginning. Maybe I should read the first few subsections before looking keywords up, but how many introductory subsections do I need to read? Even if I have understood the function of every single command, I might still have no idea (or even worse, wrong idea) about how do they interact with each other and form an orchestra. I must have missed something, but it’s not clear to me how to assign VMA/LMA to a section with MEMORY. Sometimes keywords are hard to look up, like >region and AT>region at the end of a SECTION, because the symbol > is ubiquitous. It turns out that the former is described in 22.214.171.124 (that’s many levels of nesting), and the latter is… yet to be found.
The safest way is probably to read the whole section/document from cover to cover, but that would be tedious. Plus most commands are rarely used, so they are probably not worth learning in detail anyway.