From 4aa2768b7a9c6eff4e9c26daba0b46ded3fe3a71 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Sat, 10 Jan 2009 04:11:45 -0500 Subject: [PATCH 1/1] Add tests directory. --- ram.hex | Bin 738 -> 13 bytes tests/Makefile | 16 ++++++++++++++ tests/anulib.S | 11 ++++++++++ tests/costas.c | 22 +++++++++++++++++++ tests/costas.hex | Bin 0 -> 171 bytes tests/ram.hex | 1 + tests/script.lds | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 105 insertions(+) mode change 100644 => 120000 ram.hex create mode 100644 tests/Makefile create mode 100644 tests/anulib.S create mode 100644 tests/costas.c create mode 100644 tests/costas.hex create mode 120000 tests/ram.hex create mode 100644 tests/script.lds diff --git a/ram.hex b/ram.hex deleted file mode 100644 index 7fe5faf942a43e164c3be44b57bdbf789d8d4090..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 738 zcmZXSOLoH`3`OT!jecNz=r&{@X-oFMgi46lNg3o^Kg2~qrk-zMahmN%I0j8UB}iz_ z_-qmhuNfwJy>q;17EC()u>N+V{;eD+6hEzh^(!F1l_{+`XxJSlyJ?K@r+Kt1FsE1_ zL#_ZhGmuC)7E6J#ohxx}1&ytyIv=}Oc8$rdab^^2L1!;GxECmoy@f>cxv9%en(n0Q zPSydl!zZ6n{2%V@J)8eK;Qh?;h~k=~@v)N6+-nyXC=vrWpaDAI0IXA_;Mz&uSOfy0 zKp3xFn+k*ip+G1Q3WU0@C4>s0LZ}cbgbJZTST~=`A*_ds#2_>X4MKy^AT$W;m2)|S Ojt(8d_(Rr7-RTz`8jh?0 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 0000000000000000000000000000000000000000..a6858d41224e116967951e2b7c21e07bd0e44bdb GIT binary patch literal 171 zcmXwz+ZDhd2t)swCcf=BRB`_i8m;gHTuu@!DW)Qdz1YP;*Dez??j=AhC>B7%VE|L? piF0=F6!V}ki_wQY(C5heC6%h5)Js}%;;NRMF#Y(X<%ALb&j()cFDC#1 literal 0 HcmV?d00001 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) + } +} -- 2.43.0