ARMv7-A Bare Bones

From OSDev.wiki
Revision as of 15:22, 15 June 2015 by osdev>Cormacobrien (Created page with "{{Rating|1}}{{Kernel designs}} In this tutorial, we will write a basic ARM kernel and boot it. We target the ARM Versatile Express development board for the Cortex-A15. <b>Y...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Difficulty level

Beginner
Kernel Designs
Models
Other Concepts

In this tutorial, we will write a basic ARM kernel and boot it. We target the ARM Versatile Express development board for the Cortex-A15.

You should read Getting Started and Beginner Mistakes before starting this tutorial.

Rationale

  • Why ARMv7-A?

ARMv7 is likely the last purely 32-bit iteration of the ARM architecture, so processors based on it are likely to be supported the longest. The 'A' profile is targeted at complex computing devices like smartphones, and is therefore of the most interest to OS developers.

  • Why the Cortex-A15?

Largely because it's the most powerful ARMv7-A processor supported by QEMU, and it also has its own development board.

  • Why the Versatile Express?

This board was designed by ARM Holdings as a prototyping board, so it makes sense to target a relatively neutral platform built with the Cortex-A15 in mind.

Toolchain

We'll be using the GNU toolchain for this, so go read GCC Cross-Compiler if you haven't already. The target platform is arm-none-eabi. I recommend also compiling GDB for this architecture, as you can hook it up to QEMU and step through broken code.

Code

.global _start
_start:
    mov sp, =STACK_TOP
    bl start
    b .
#define UART0_BASE 0x1c090000
void start()
{
    *(volatile uint32_t *)(UART0_BASE) = 'A';
}

Resources