Running an ARM program
Here, we’ve put together all the information you need to run and debug a program on Raspberry Pi. We’re going to take the string copying example from Chapter 11 and go through it in more detail to provide a template for program development. This program takes an ASCII string and reverses it. In this case, the string is "Hello!!!".
We have made it eight characters long so that it fits into two consecutive words (8 * 8 bits = 64 bits = 2 words).
We have located the source string, string1
, in the body of the program, in the .text
section, because it is only read from and never written to.
The destination, str2
, that will receive the reversed string is in read/write memory in the .data
section. Consequently, we have to use the technique of indirect pointers – that is, the .text portion has a pointer at adr_str2
that contains the address of the actual string, str2
.
The program contains several labels that are not accessed by...