changeset 946:845c2e420069

target-utils/c139explore utility started
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Mon, 02 Nov 2015 18:09:37 +0000
parents 86ff6d0b0a97
children 76149e0628ba
files target-utils/c139explore/Makefile target-utils/c139explore/cmdtab.c target-utils/c139explore/main.c target-utils/c139explore/mygetchar.c target-utils/env/compalram.lds
diffstat 5 files changed, 141 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/c139explore/Makefile	Mon Nov 02 18:09:37 2015 +0000
@@ -0,0 +1,31 @@
+CC=	arm-elf-gcc
+CFLAGS=	-Os -fno-builtin
+CPPFLAGS=-I../include
+LD=	arm-elf-ld
+OBJCOPY=arm-elf-objcopy
+
+PROG=	c139explore
+OBJS=	crt0.o cmdtab.o main.o mygetchar.o
+LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a
+LDS=	../env/compalram.lds
+
+TC_LIBS=`${CC} -print-file-name=libc.a` \
+	`${CC} -print-file-name=libgcc.a`
+
+all:	${PROG}.bin
+
+crt0.S:	../env/crt0.S
+	ln -s $< .
+
+${PROG}.elf:	${OBJS} ${LIBS} ${LDS}
+	${LD} -N -T ${LDS} -o $@ ${OBJS} \
+		--start-group ${LIBS} --end-group \
+		--start-group ${TC_LIBS} --end-group
+
+${PROG}.bin:	${PROG}.elf
+	${OBJCOPY} -O binary $< $@
+
+clean:
+	rm -f *.o *errs *core *.elf *.bin *.srec crt0.S
+
+FRC:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/c139explore/cmdtab.c	Mon Nov 02 18:09:37 2015 +0000
@@ -0,0 +1,27 @@
+#include "cmdtab.h"
+
+extern void cmd_abbr();
+extern void cmd_abbw();
+extern void cmd_r8();
+extern void cmd_r16();
+extern void cmd_r32();
+extern void cmd_w8();
+extern void cmd_w16();
+extern void cmd_w32();
+
+extern void abb_init();
+extern void abb_power_off();
+
+const struct cmdtab cmdtab[] = {
+	{"abbinit", abb_init},
+	{"abbr", cmd_abbr},
+	{"abbw", cmd_abbw},
+	{"poweroff", abb_power_off},
+	{"r8", cmd_r8},
+	{"r16", cmd_r16},
+	{"r32", cmd_r32},
+	{"w8", cmd_w8},
+	{"w16", cmd_w16},
+	{"w32", cmd_w32},
+	{0, 0}
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/c139explore/main.c	Mon Nov 02 18:09:37 2015 +0000
@@ -0,0 +1,15 @@
+#include "types.h"
+#include "ns16550.h"
+
+struct ns16550_regs *uart_base;
+
+main()
+{
+	uart_base = (struct ns16550_regs *) 0xFFFF5800;
+	printf("C139 hardware exploration utility running\n");
+	for (;;) {
+		putchar('=');
+		if (command_entry())
+			command_dispatch();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/c139explore/mygetchar.c	Mon Nov 02 18:09:37 2015 +0000
@@ -0,0 +1,21 @@
+/*
+ * The interactive command entry (editing) function in libcommon
+ * will call mygetchar() for its character input.  It is supposed
+ * to be a blocking wait for input, but in some programs other
+ * processing can be done while waiting - for example, check for
+ * keypad presses as well.  This is the basic version which waits
+ * for serial input and nothing else.
+ */
+
+extern int serial_in_poll();
+
+int
+mygetchar()
+{
+	register int c;
+
+	do
+		c = serial_in_poll();
+	while (c < 0);
+	return c;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/env/compalram.lds	Mon Nov 02 18:09:37 2015 +0000
@@ -0,0 +1,47 @@
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_entry)
+SECTIONS
+{
+    /* code */
+    . = 0x800100;
+    .text : {
+        /* regular code */
+        *(.text*)
+        /* gcc voodoo */
+        *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
+        . = ALIGN(4);
+    }
+
+    /* read-only data */
+    . = ALIGN(4);
+    .rodata : {
+        *(.rodata*)
+    }
+
+    /* initialized data */
+    . = ALIGN(4);
+    .data : {
+        *(.data)
+    }
+    PROVIDE(edata = .);
+
+    /* magic signature for C139/140 bootloader */
+    .magic 0x803ce0 : {
+	LONG(0x33303031)
+    }
+
+    /* uninitialized data */
+    .bss (NOLOAD) : {
+        . = ALIGN(4);
+        __bss_start = .;
+        *(.bss)
+    }
+    . = ALIGN(4);
+    __bss_end = .;
+    /* end of image */
+    _end = .;
+    PROVIDE(end = .);
+}
+
+stack_bottom = 0x83FFFC;