ARMv7-A Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (Added this article to the ARM page category)
(Amending code errors)
Line 37: Line 37:
.global _start
.global _start
_start:
_start:
mov sp, =STACK_TOP
ldr sp, =STACK_TOP
bl start
bl start
1:
1:
Line 47: Line 47:


<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
#include <stdint.h>

#define UART0_BASE 0x1c090000
#define UART0_BASE 0x1c090000
void start()
void start()
Line 63: Line 65:
* memory map provided in the CoreTile TRM (see below).
* memory map provided in the CoreTile TRM (see below).
*/
*/
. = 0x80010000
. = 0x80010000;


/* Make sure our entry stub goes first */
/* Make sure our entry stub goes first */
Line 72: Line 74:
.bss : { *(.bss COMMON) }
.bss : { *(.bss COMMON) }


STACK_BASE = .
STACK_BASE = .;
. += 0x10000
. += 0x10000;
STACK_TOP = .
STACK_TOP = .;
}
}
</pre>
</pre>
Line 84: Line 86:
$ arm-none-eabi-gcc -ffreestanding -Wall -Wextra -Werror -c start.c -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
$ 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
$ qemu-system-arm -M vexpress-a15 -cpu cortex-a15 -kernel kernel.elf -nographic
</pre>
</pre>