If you are dealing with the Ram or the data section.
We have two addresses.
One is runtime addresses and we have load addresses.
We have already in the previous linker script.
We have already specified the runtime addresses for the data section.
If you see in the previous script we had.
rlt.lds.
We have specified the, uh, runtime addresses.
This is the runtime addresses.
This is a place where our data will be present in the Ram and LD.
The values are also properly assigned by the link.
Uh, sorry, I'm using different thing.
So say in.
And the values are also properly assigned like it is having a values of the Ram addresses, but we have
to specify the load address for the load address.
There is a keyword known as 80 in the linker script, so a load address is different from the runtime
address and can be specified using the 80 keyboard.
So if you see this one, this is the same.
And till here the same.
We have added one more section so sections can be created on the fly with the sections command uh.
Here e text is assigned the value of the location counter.
This means it is assigned whatever the end address of the text section, so it will contain the address
of the next free location in the flash right after the all the code.
So we are going to keep our, uh, data which we want to copy to the Ram in the after the text section.
And E text itself will not be allocated any memory.
It is just an entry in the symbol table.
Then we have uh data section.
Now we need to specify the load address.
So here we are specifying the load address of the data section by saying using at keyword.
And we are giving this address.
So my uh data sections load address is here.
And the runtime address is here.
So we are specifying both here.
Now let's uh.
Now we need to copy this data from flash to Ram.
So.
So we have performed one step, uh, which is uh, there were two steps, if you remember, there were
two steps.
Uh, one is the linker script has to be modified to specify the load address and the runtime address,
which we are doing using the at keyword.
We have specified the load address after the text section, and the runtime address is the address of
the Ram.
And then we have to have one more change where we need to copy this data section from the flash to the
Ram.
So we need to copy the data section from the load address to the runtime address.
Again this change is also in the linker script.
So to copy the data from the flash to Ram, we need the following information.
You need the place where the address of the data is present in the flash.
You need to know the address of data in Ram, and we need to know the size of the data section.
So if I know all these three information, I can use this logic where I load the addresses and then
I copy writing a simple loop so I can update this, uh, on the linker script I know the.
End of the text section and that next I will be pointing to the data section.
And I know the start of the data section and I know that is assigned.
I have assigned the load address to the 80, and I know the end of the data section.
I can calculate the size of the data set.