ARMv7-A Bare Bones: Difference between revisions

Jump to navigation Jump to search
no edit summary
[unchecked revision][unchecked revision]
(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...")
 
No edit summary
Line 26:
 
We'll be using the GNU toolchain for this, so go read [[GCC Cross-Compiler]] if you
haven't already. The target platform is <code>arm-none-eabi</code>. IYou recommendwill alsoneed at
least <code>as</code>, <code>gcc</code>, and <code>ld</code>, but I suggest also
compiling GDB for this architecture, as you can hook it up to QEMU and step through
having <code>gdb</code>, <code>objcopy</code>, and <code>objdump</code>.
broken code.
 
== Code ==
 
_start.arm:
 
<pre>
Line 37 ⟶ 39:
mov sp, =STACK_TOP
bl start
1:
b .1b
.size _start, . - _start
</pre>
 
start.c:
 
<syntaxhighlight lang="c">
Line 47 ⟶ 53:
}
</syntaxhighlight>
 
linker.ld:
 
<pre>
ENTRY(_start)
 
SECTIONS {
/* QEMU loads the kernel in Flash here. I strongly suggest you look at the
* memory map provided in the CoreTile TRM (see below).
*/
. = 0x80010000
 
/* Make sure our entry stub goes first */
.stub : { _start.o(.text) }
.text : { *(.text) }
.rodata : { *(.rodata) }
.data : { *(.data) }
.bss : { *(.bss COMMON) }
 
STACK_BASE = .
. += 0x10000
STACK_TOP = .
}
</pre>
 
== Building and Running ==
 
<pre>
$ arm-none-eabi-as -march=armv7-a -mcpu=cortex-a15 _start.arm -o _start.o
$ arm-none-eabi-gcc -ffreestanding -Wall -Wextra -Werror -c start.c -o start.o
$ arm-none-eabi-ld -T linker.ld _start.o start.o -o kernel.elf
$ qemu-system-arm -M vexpress-a15 -cpu cortex-a15 -kernel kernel.bin -nographic
</pre>
 
== Resources ==
 
It's a lot of material, but these are invaluable references for developing on ARM platforms.
 
* [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html ARMv7 Cortex-A Series Programmer's Guide]
* [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0406c/index.html ARMv7-A Architecture Reference Manual]
* [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0406c/index.html ARM Cortex-A15 Technical Reference Manual]
* [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html CoreTile Express A-15 Technical Reference Manual]
* [http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.boards.express/index.html Motherboard Express &mu;ATX Technical Reference Manual]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu