5

I just started the Baking Pi tutorials and the first lesson is already very confusing.

The very first thing we do is

ldr r0,=0x20200000

The author explains that 0x20200000 is the address of the GPIO controller. Not to just want to blindly believe this, I decided to cross-check the BCM2835 ARM Peripherals guide. Here, the first GPIO register is listed as 0x7E200000 (page 90).

I go back to the tutorial, where in a footnote, the author identifies this difference, and says

the manual uses a different addressing system. An address listed as 0x7E200000 would be 0x20200000 in our OS.

So my question therefore is: What is an "addressing system" and how do these two different numbers reconcile under their respective systems?

Edit: Shortly after posting this, I read in the manual that:

Physical addresses range from 0x20000000 to 0x20FFFFFF for peripherals. The bus addresses for peripherals are set up to map onto the peripheral bus address range starting at 0x7E000000. Thus a peripheral advertised here at bus address 0x7Ennnnnn is available at physical address 0x20nnnnnn.

I guess it's easy to Google the difference now that I know the terms. But now my question becomes:

What's the purpose of having a separate bus addresses? I understand most of the benefits of having virtual memory in user land, but why virtualize the memory from the device's point of view?

1
  • If no one else does you should be able to post an answer of your own after 24 hours.
    – goldilocks
    Dec 23, 2015 at 11:03

1 Answer 1

1

These are just different abstraction layers. This happens in most modern CPUs. The hardware addresses are abstracted by a layer of logical addresses, then further a specific process may have its own page tables mapping the addresses to yet another space. This helps with running multiple programs at the same time, among other things. At the physical layer, there may be mappings for various reasons, generally to put things in more logical places and avoid conflicts or add consistency between variations of a platform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.