Summary
In this chapter, we have introduced a real computer, the Raspberry Pi. Instead of designing our own computer instruction sets, we’ve looked at the ARM microprocessor that is at the heart of the Raspberry Pi and most smartphones.
We introduced the basics of the Raspberry Pi and showed how to write an ARM assembly language program that can run on it. This requires an understanding of the ARM assembler and the use of the linker. We demonstrated how you can then run your ARM program instruction-by-instruction using the gdb debugger.
One important feature of Raspberry Pi’s architecture we have encountered is the way in which data in memory is modified. You cannot use a str (store) instruction to modify data in memory. You must do it indirectly via a pointer to the address of the memory you wish to change. The following short program demonstrates this vital point. A data item in memory is read directly using an ldr
but modified in memory using a pointer to a pointer...