From: Joshua Wise Date: Sat, 10 Jan 2009 09:11:45 +0000 (-0500) Subject: Add tests directory. X-Git-Url: http://git.joshuawise.com/firearm.git/commitdiff_plain/4aa2768b7a9c6eff4e9c26daba0b46ded3fe3a71?ds=sidebyside Add tests directory. --- diff --git a/ram.hex b/ram.hex deleted file mode 100644 index 7fe5faf..0000000 --- a/ram.hex +++ /dev/null @@ -1,82 +0,0 @@ -e28f1014 -e5d10000 -e2811001 -ee000510 -e0100000 -1afffffa -eafffffe -74736f43 -6c207361 -73656b69 -73736120 -00000000 -E3A0103A -EE001510 -E59E0000 -E02DE190 -E1800001 -E0012011 -E0013038 -E0014058 -E0015031 -E0016071 -E0012138 -E0013158 -E0014008 -E0015028 -E0016048 -E0017068 -E00120E1 -E0013161 -E00141E1 -E0015261 -E00162E1 -E0017361 -E180F081 -E180F081 -E180F081 -EA000001 -EE001510 -EAFFFFFD -E1A00000 -EBFFFFFC -E0000001 -E0000002 -E0000003 -E0000004 -E0000005 -E0000006 -E0000007 -E0000008 -E0000009 -E0000011 -E0000012 -E0000013 -E0000014 -E0000015 -E0000016 -E0000017 -E0000018 -E0000019 -E0000021 -E0000022 -E0000023 -E0000024 -E0000025 -E0000026 -E0000027 -E0000028 -E0000029 -E0000031 -E0000032 -E0000033 -E0000034 -E0000035 -E0000036 -E0000037 -E0000038 -E0000039 -E0000041 -E0000042 -E0000043 -E0000044 diff --git a/ram.hex b/ram.hex new file mode 120000 index 0000000..5d115b1 --- /dev/null +++ b/ram.hex @@ -0,0 +1 @@ +tests/ram.hex \ No newline at end of file diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..62be4ba --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,16 @@ +all: costas.hex + +%.o: %.c + arm-elf-gcc -c -o $@ $< + +%.o: %.S + arm-elf-gcc -c -o $@ $< + +%.elf: %.o anulib.o script.lds + arm-elf-ld -o $@ -T script.lds anulib.o $< + +%.bin: %.elf + arm-elf-objcopy $< -O binary $@ + +%.hex: %.bin + xxd -ps -c 4 $< | sed -e 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/' > $@ diff --git a/tests/anulib.S b/tests/anulib.S new file mode 100644 index 0000000..a77ca26 --- /dev/null +++ b/tests/anulib.S @@ -0,0 +1,11 @@ + .text + .globl _start +_start: + mov sp, #0x2000 + bl main +1: b 1b + + .globl putc +putc: + mcr 5, 0, r0, c0, c0 + mov pc, lr diff --git a/tests/costas.c b/tests/costas.c new file mode 100644 index 0000000..fdce3fe --- /dev/null +++ b/tests/costas.c @@ -0,0 +1,22 @@ +extern void putc(unsigned char c); + +int main() +{ +// unsigned char *costas = "Costas likes ass"; + + putc('A'); + putc('n'); + putc('u'); + putc('s'); + putc('?'); + +// while (*costas) +// { +// putc(*costas); +// costas++; +// } + while(1) + ; + + return 0; +} diff --git a/tests/costas.hex b/tests/costas.hex new file mode 100644 index 0000000..a6858d4 --- /dev/null +++ b/tests/costas.hex @@ -0,0 +1,19 @@ +e3a0da02 +eb000002 +eafffffe +ee000510 +e1a0f00e +e1a0c00d +e92dd800 +e24cb004 +e3a00041 +ebfffff8 +e3a0006e +ebfffff6 +e3a00075 +ebfffff4 +e3a00073 +ebfffff2 +e3a0003f +ebfffff0 +eafffffe diff --git a/tests/ram.hex b/tests/ram.hex new file mode 120000 index 0000000..0f379b7 --- /dev/null +++ b/tests/ram.hex @@ -0,0 +1 @@ +costas.hex \ No newline at end of file diff --git a/tests/script.lds b/tests/script.lds new file mode 100644 index 0000000..434d075 --- /dev/null +++ b/tests/script.lds @@ -0,0 +1,55 @@ +/* Default linker script, for normal executables */ +OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", + "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__executable_start = 0x0000); . = 0x0000; + + .text : + { + *(.text .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.glue_7t) *(.glue_7) + } =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .data : + { + __data_start = . ; + *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + __bss_start__ = .; + .bss : + { + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; + PROVIDE (end = .); + .stack : + { + _stack = .; + *(.stack) + } +}