Re: VMA vs LMA?



Thanks for your response!

So, the program is always linked with the VMA addresses, and never
linked with LMA addresses? Or how are references to LMA/VMA sections
resolved?

When writing a program where one wants different LMA and VMA sections
the programmer himself/hersel has to make sure he/she writes the code
that copies the LMA section/data to its appropriate VMA address?


No, these are different situations. When an OS loads code from a file,
the OS does the copying. Usually the VMA and LMA are the same, so that
the OS loads the initialised data section directly into place. With a
ROM'ed program, where the program is run directly from the ROM rather
than being first copied into RAM (in which case you have the same
situation as an OS and a file), the code at the beginning of the program
copies the data across and also clears the bss - this is part of the
crt0 startup code.

Why does crt0 (C runtime 0) have code that copies data from LMA to
VMA? Is it there so the C programmer doesn't have to write his own
"LMA data to VMA data copy code"? If so, how would one make use of the
crt0 "LMA data to VMA data copy code"?


.



Relevant Pages

  • Re: VMA vs LMA?
    ... LMA/VMA are the same, because you are running entirely from RAM. ... the LMA and the VMA are the same - the program runs directly from the flash it resides in. ... The only exception is that the startup code also refers to the LMA of the data section, so that it can do the initial copy. ...
    (comp.arch.embedded)
  • Re: VMA vs LMA?
    ... What is the difference between VMA (Virtual Memory Address) and LMA ... or load memory address. ...
    (comp.arch.embedded)
  • VMA vs LMA?
    ... What is the difference between VMA (Virtual Memory Address) and LMA ... or load memory address. ...
    (comp.arch.embedded)
  • Re: VMA vs LMA?
    ... than being first copied into RAM (in which case you have the same ... The other place where it's common to see VMA!= LMA (and code that ... first few bytes set up the MMU and execution then passes to a new VMA. ...
    (comp.arch.embedded)