I have updated, uh, the linker script accordingly.
So we have now added the required, uh, labels or which addresses for the start of the data section
and the start of the Ram section and end of the Ram section, and the calculation of the size of the
Ram, and also the specifying the load address of the data section, which is present, the uh code.
And then the uh, this thing also updated with the startup code.
So during startup I will copy everything which is present in the data section, which is at the load
address, R0 is the load address, and to the R1 which is the start of the Ram section at this point
of this particular size.
So this code is a startup code and this is the specifying the load address.
These are the two modifications which are needed.
Now let's uh compile this one.
So um none Abi assembler some add dot s, some add dot o and ld d.
So I need to just change the script.
So I have some linker.lds and I'll give a different name.
Some add elf some add.
Oh, now I have the listing.
I'm nearby and I can see some dot.
Alf, this will only display you the runtime matrices and it is also displaying you whatever the linker
is adding it.
Uh, start of the data section is present in this particular location.
54.
And then the Ram location is starting.
Location is this and end location is this.
This is the size of the data.
Okay.
Now.
We need to again create our.
Uh, flash.
Flash memory and read the input file I can do.
First, I need to do an obj copy.
Uh, I need to convert this into the binary file format.
So I'll do some add, uh, dot elf and then some add dot bin.
Now I will use dd input file.
Some add dot bin output file is flash dot bin and snow trunk.
Now I have my content copied which is 96 bytes.
Now I can use chemo and I can provide this one and.
Let's see the info registers.
And I'll just click this one.
And if you see the code output is one E, so 30 plus ten is uh, we're storing the result in.
Finally we are storing the result in.
R0 resistor and r0 not r0 thing.
String result in.
So add r4, r2, and r3 and we are storing the result here in the result.
So I need to see using uh zip command xp info resistors.
And so.
Now I can use XP.
I can say A00.
Uh, three zeros four zero.
Right.
And I can see the what is the value of the result is stored A08.
So result is eight.
It is 28.
So 16 to the 32 plus 840.
So the result is 40 right.
It is also present in R4 register and we are storing it R4 as well as we're storing this in the result
which is in the Ram.
So Ram this location we are storing the value.
So because we have allocated space for uh the result.
So.
So now we have in this example we have copied uh using this particular startup code.
We have copied the data section from the flash to the Ram.
And then we also have stored the result in the Ram, uh, in the result.
And we have verified using uh, the actual locations I can use exp for.
I also write all those.
I can do it here.
So now we now we are able to use both Ram and uh, flash.
And uh, we were able to understand the functionalities of linker uh, what all functionalities linker
performs.
It performs symbol resolution relocation, relocation.
It does uh in relocation it performs section placement and section merging.
And then you have something known as load address and runtime address if I want to use the Ram.
And uh, in a real system where you have an Sdram, you cannot directly access like how we are doing
here, because this is a very simple system.
Uh, you are able to directly use and write the values, but in a real system you will be having a memory
controller.
So that has to be initialized before performing a memory access with our code is working here because
it does not need a memory controller to this particular machine does not need the memory controller
to be initialized.