The following is a question from readers in the technical discussion group: Q: Program When downloading to nor, the loading address in ads is 0x30000000, which is the address of SDRAM. Is it automatically handled by the debugger? A: One address is the loading address, and the other is the running address.
You downloaded it to nor, which is the loading address. In ads, robase sets the running address.
The load address starts from 0. A: Yes. Q: Who copied it to ram?
ARM core? A: What do you mean by Replication?
Your Code No replication. No one will help you: the code in nor can be directly run. A: Yes.
Execute the command from 0 when the arm is powered on.
So run it directly. Q: What is the role of 0x30000000?
If I write it as 0... A: That is the run address, which means that the Code will run in the space based on this address in the future. Therefore, the run address and load address can be different.
Therefore, when the running address is different from the loading address, you can only use the relative jump to ask: Can I understand the code that does not exceed the nor capacity? The running address is of little significance. a: you do not have a deep understanding of the concept of running address and loading address.
Q:
A: We need to compile C and assembly into binary, right?
The compiler will give each instruction, variable, and function address when linking C code and assembly. Q: Yes, the address is fixed.
The base address of this address is the run address.
That is to say, when the code is running, it is all running in the running address space.
However, the memory in the embedded device usually needs to be initialized first and cannot be used without initialization, so the Code cannot run in it, the compiled binary file is written into Rom such as nor.
So we need to move the code from the nor to the SDRAM.
Ensure normal operation
So we can only set the run address of the Code to an address in the SDRAM and the address when writing the code. It is the load address. Q: Is the run address used as a parameter to the compiler? A: As long as you ensure that there is no absolute address jump in nor, it may run.
However, not all codes use relative redirection.
Therefore, this must also require your code to be moved to the SDRAM.
Q: Well, thank you. A: After the compiler needs to know the address, it will compile the address based on your running address.
You can set the running address to 0x30000000.
Right-click ads to disassemble it, and check its command address. Then you can get the correct answer: Set the running address to 0x0.
Next, let's make a comparison and you will understand it.
After understanding this, you will understand what PIC code is.
Check it yourself.