Discussion:
What is the difference between vma and lma?
(too old to reply)
Zheng Da
2006-08-01 12:54:09 UTC
Permalink
In the ld manual, there are their definitions
VMA, or virtual memory address. This is the address the section will
have when
the output file is run.
LMA, or load memory address. This is the address at which the section
will be
loaded.
But I cannot see the difference.
And the OVERLAY command in ld can make the section have the same vma
but different lma.
Why? I am quite confused.
Does anybody explain the difference to me?
Thank you.
Alexei A. Frounze
2006-08-01 13:51:56 UTC
Permalink
Post by Zheng Da
In the ld manual, there are their definitions
VMA, or virtual memory address. This is the address the section will
have when
the output file is run.
LMA, or load memory address. This is the address at which the section
will be
loaded.
But I cannot see the difference.
And the OVERLAY command in ld can make the section have the same vma
but different lma.
Why? I am quite confused.
Does anybody explain the difference to me?
Thank you.
Consider that your application is stored in a Flash and you don't want to
execute it from the flash because flash is slow or you need to change/patch
the application on the go. What do you do? You copy it to the RAM and
execute from there. In this simple example LMA would be the address in the
flash and VMA the address in the RAM. Having both enables you to copy the
application easily because that gives you the where from and where to
locations.
Also, in this particular case there must be a loader/copier that is also
stored in the flash and unlike the main application it is executed from the
flash upon reset. This loader does that copying of the main application from
the Flash to RAM. For this loader VMA must be equal to LMA making it
possible to execute it.

That's about it.

Alex
Zheng Da
2006-08-01 14:28:37 UTC
Permalink
Thank you for your explanation.
I think I know it now.

Alexei A. Frounze 写道:
Post by Alexei A. Frounze
Post by Zheng Da
In the ld manual, there are their definitions
VMA, or virtual memory address. This is the address the section will
have when
the output file is run.
LMA, or load memory address. This is the address at which the section
will be
loaded.
But I cannot see the difference.
And the OVERLAY command in ld can make the section have the same vma
but different lma.
Why? I am quite confused.
Does anybody explain the difference to me?
Thank you.
Consider that your application is stored in a Flash and you don't want to
execute it from the flash because flash is slow or you need to change/patch
the application on the go. What do you do? You copy it to the RAM and
execute from there. In this simple example LMA would be the address in the
flash and VMA the address in the RAM. Having both enables you to copy the
application easily because that gives you the where from and where to
locations.
Also, in this particular case there must be a loader/copier that is also
stored in the flash and unlike the main application it is executed from the
flash upon reset. This loader does that copying of the main application from
the Flash to RAM. For this loader VMA must be equal to LMA making it
possible to execute it.
That's about it.
Alex
Loading...