changeset 197:dbb54db721d1

target-utils/flash-boot-test written
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 30 Apr 2017 17:40:26 +0000
parents 47d56330609d
children 06c629b34903
files target-utils/flash-boot-test/Makefile target-utils/flash-boot-test/cmdtab.c target-utils/flash-boot-test/ld.script target-utils/flash-boot-test/magic0.S target-utils/flash-boot-test/magic1.S target-utils/flash-boot-test/main.c target-utils/flash-boot-test/mygetchar.c target-utils/flash-boot-test/uartbase.S target-utils/flash-boot-test/vectors.S
diffstat 9 files changed, 172 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/flash-boot-test/Makefile	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,33 @@
+CC=	arm-elf-gcc
+CFLAGS=	-Os -fno-builtin
+CPPFLAGS=-I../include
+LD=	arm-elf-ld
+OBJCOPY=arm-elf-objcopy
+
+OBJS=	vectors.o crt0.o cmdtab.o main.o mygetchar.o uartbase.o
+LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a \
+	../libc/libc.a
+LIBGCC=	`${CC} -print-file-name=libgcc.a`
+LDS=	ld.script
+
+all:	fbt-mode0.bin fbt-mode1.bin
+
+crt0.S:	../env/crt0.S
+	ln -s $< .
+
+fbt-mode0.elf:	${OBJS} magic0.o ${LIBS} ${LDS}
+	${LD} -N -T ${LDS} -o $@ ${OBJS} magic0.o ${LIBS} ${LIBGCC}
+
+fbt-mode0.bin:	fbt-mode0.elf
+	${OBJCOPY} -O binary $< $@
+
+fbt-mode1.elf:	${OBJS} magic1.o ${LIBS} ${LDS}
+	${LD} -N -T ${LDS} -o $@ ${OBJS} magic1.o ${LIBS} ${LIBGCC}
+
+fbt-mode1.bin:	fbt-mode1.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/flash-boot-test/cmdtab.c	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,32 @@
+#include "cmdtab.h"
+
+extern void cmd_abbr();
+extern void cmd_abbw();
+extern void cmd_jump();
+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 cmd_memdump_human();
+
+extern void abb_init();
+extern void abb_power_off();
+
+const struct cmdtab cmdtab[] = {
+	{"abbinit", abb_init},
+	{"abbr", cmd_abbr},
+	{"abbw", cmd_abbw},
+	{"dump", cmd_memdump_human},
+	{"jump", cmd_jump},
+	{"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/flash-boot-test/ld.script	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,46 @@
+ENTRY(_entry)
+SECTIONS
+{
+    /* flash boot */
+    .vectors 0 : {
+        *(.vectors)
+    }
+
+    .magic 0x2000 : {
+        *(.magic)
+    }
+
+    /* main code */
+    .text 0x4000 : {
+        /* regular code */
+        *(.text*)
+        /* gcc voodoo */
+        *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
+        . = ALIGN(4);
+    }
+
+    /* read-only data */
+    . = ALIGN(4);
+    .rodata : {
+        *(.rodata*)
+    }
+
+    /* cannot have any initialized data */
+    /DISCARD/ : {
+        *(.data)
+    }
+
+    /* uninitialized data */
+    .bss 0x83C000 (NOLOAD) : {
+        . = ALIGN(4);
+        __bss_start = .;
+        *(.bss)
+    }
+    . = ALIGN(4);
+    __bss_end = .;
+    /* end of image */
+    _end = .;
+    PROVIDE(end = .);
+}
+
+stack_bottom = 0x83FFFC;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/flash-boot-test/magic0.S	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,7 @@
+	.section	.magic,"ax",%progbits
+	.code	32
+
+	.globl	_Magic_words
+_Magic_words:
+	.word	0
+	.word	_entry
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/flash-boot-test/magic1.S	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,6 @@
+	.section	.magic,"ax",%progbits
+	.code	32
+
+	.globl	_Magic_words
+_Magic_words:
+	.word	1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/flash-boot-test/main.c	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,9 @@
+main()
+{
+	printf("\nFlash boot test program running\n");
+	for (;;) {
+		putchar('=');
+		if (command_entry())
+			command_dispatch();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/flash-boot-test/mygetchar.c	Sun Apr 30 17:40:26 2017 +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/flash-boot-test/uartbase.S	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,5 @@
+	.section	.rodata
+	.balign	4
+	.globl	uart_base
+uart_base:
+	.word	0xFFFF5000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/flash-boot-test/vectors.S	Sun Apr 30 17:40:26 2017 +0000
@@ -0,0 +1,13 @@
+	.section	.vectors,"ax",%progbits
+	.code	32
+
+	.globl	_Reset_vector
+_Reset_vector:
+	b	_entry
+	b	.
+	b	.
+	b	.
+	b	.
+	b	.
+	b	.
+	b	.