a question about linker and addresses

Ian Lance Taylor iant@google.com
Tue Nov 2 13:29:00 GMT 2010


ali hagigat <hagigatali@gmail.com> writes:

> How data section is loaded into ROM, while the program has not been
> started up? (Usually at first we start a program, then sections are
> loaded into the memory, isn't it?)

It is true that on an ordinary Unix or Windows system, the program is
loaded into memory when it is started.  However, an embedded system may
use ROM, and that ROM may contain a program.  Exactly how the program is
loaded into the ROM is not very relevant; a typical approach would be to
use a PROM burner.  What you have then is a system which is running a
program when it is powered up, and that program is loaded into ROM.
Since ROM is by definition read-only, it is desirable to have a way to
initialize the read-write data.  Using a different VMA and LMA for the
data sections is one way to do that.

Ian



More information about the Gcc-help mailing list