Mercurial > lcfOS
changeset 324:ed6d0adaa626
Added qemu arm emulated image
author | Windel Bouwman |
---|---|
date | Fri, 31 Jan 2014 12:45:17 +0100 |
parents | e9fe6988497c |
children | 0dd36d2eb954 |
files | test/bare/make.sh test/bare/qemutst.sh test/bare/startup.s test/bare/test.c test/bare/test.ld |
diffstat | 5 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bare/make.sh Fri Jan 31 12:45:17 2014 +0100 @@ -0,0 +1,7 @@ + + +arm-none-eabi-as -mcpu=arm926ej-s -g startup.s -o startup.o +arm-none-eabi-gcc -c -mcpu=arm926ej-s -g test.c -o test.o +arm-none-eabi-ld -T test.ld test.o startup.o -o test.elf +arm-none-eabi-objcopy -O binary test.elf bare.bin +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bare/qemutst.sh Fri Jan 31 12:45:17 2014 +0100 @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +echo "Trying to run versatilePB board" + +qemu-system-arm -M versatilepb -m 128M -nographic -kernel bare.bin +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bare/startup.s Fri Jan 31 12:45:17 2014 +0100 @@ -0,0 +1,6 @@ + +.global _Reset +_Reset: + LDR sp,=stack_top + BL c_entry + B .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bare/test.c Fri Jan 31 12:45:17 2014 +0100 @@ -0,0 +1,16 @@ + +volatile unsigned int * const UART0DR = (unsigned int*)0x101f1000; + +void print_uart0(const char*s) +{ + while (*s != '\0') + { + *UART0DR = (unsigned int)(*s); + s++; + } +} + +void c_entry() +{ + print_uart0("Hello world"); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/bare/test.ld Fri Jan 31 12:45:17 2014 +0100 @@ -0,0 +1,13 @@ + +ENTRY(_Reset) +SECTIONS +{ + . = 0x10000; + .startup . : {startup.o(.text) } + .text : { *(.text) } + .data : { *(.data) } + .bss : { *(.bss COMMON) } + . = ALIGN(8); + . = . + 0x1000; + stack_top = .; +}