changeset 76:5bbba2cab6f3

target-utils: buzplayer started
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 27 Oct 2016 03:50:40 +0000
parents bbc41034f14c
children 0f11da299b7d
files target-utils/Makefile target-utils/buzplayer/Makefile target-utils/buzplayer/cmdtab.c target-utils/buzplayer/main.c target-utils/buzplayer/mygetchar.c
diffstat 5 files changed, 109 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/Makefile	Thu Oct 27 02:13:38 2016 +0000
+++ b/target-utils/Makefile	Thu Oct 27 03:50:40 2016 +0000
@@ -1,4 +1,4 @@
-INSTPROGS=	compalstage c139explore loadagent pirexplore
+INSTPROGS=	buzplayer compalstage c139explore loadagent pirexplore
 ALLPROGS=	${INSTPROGS} c139-lldbg helloapp tf-breakin
 LIBS=		libbase libcommon libload libprintf libtiffs
 SUBDIR=		${ALLPROGS} ${LIBS}
@@ -6,6 +6,7 @@
 default:	${INSTPROGS}
 all:		${ALLPROGS}
 
+buzplayer:	libbase libcommon libprintf
 c139explore:	libbase libcommon libprintf
 c139-lldbg:	libbase libcommon libprintf
 helloapp:	libbase libcommon libprintf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/buzplayer/Makefile	Thu Oct 27 03:50:40 2016 +0000
@@ -0,0 +1,37 @@
+CC=	arm-elf-gcc
+CFLAGS=	-Os -fno-builtin
+CPPFLAGS=-I../include
+LD=	arm-elf-ld
+OBJCOPY=arm-elf-objcopy
+
+INSTDIR=/opt/freecalypso/target-bin
+
+PROG=	buzplayer
+OBJS=	crt0.o cmdtab.o main.o mygetchar.o
+LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a
+LDS=	../env/iram.lds
+
+TC_LIBS=`${CC} -print-file-name=libc.a` \
+	`${CC} -print-file-name=libgcc.a`
+
+all:	${PROG}.srec
+
+crt0.S:	../env/crt0.S
+	ln -s $< .
+
+${PROG}.elf:	${OBJS} ${LIBS} ${LDS}
+	${LD} -N --defsym Base_addr=0x800750 --defsym stack_bottom=0x83FFFC \
+		-T ${LDS} -o $@ ${OBJS} ${LIBS} \
+		--start-group ${TC_LIBS} --end-group
+
+${PROG}.srec:	${PROG}.elf
+	${OBJCOPY} -O srec --srec-forceS3 --srec-len=30 $< $@
+
+install:
+	mkdir -p ${INSTDIR}
+	install -c -m 644 ${PROG}.srec ${INSTDIR}
+
+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/buzplayer/cmdtab.c	Thu Oct 27 03:50:40 2016 +0000
@@ -0,0 +1,35 @@
+#include "cmdtab.h"
+
+extern void cmd_abbr();
+extern void cmd_abbw();
+extern void cmd_baud_switch();
+extern void cmd_buz();
+extern void cmd_buzlev();
+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 abb_init();
+extern void abb_power_off();
+
+const struct cmdtab cmdtab[] = {
+	{"abbinit", abb_init},
+	{"abbr", cmd_abbr},
+	{"abbw", cmd_abbw},
+	{"baud", cmd_baud_switch},
+	{"buz", cmd_buz},
+	{"buzlev", cmd_buzlev},
+	{"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/buzplayer/main.c	Thu Oct 27 03:50:40 2016 +0000
@@ -0,0 +1,14 @@
+#include "types.h"
+
+main()
+{
+	uart_select_init();
+	printf("FreeCalypso buzzer player running\n");
+	print_boot_rom_info();
+	*(volatile u16 *)0xfffe4806 = 0xFFF3;	/* enable ARMIO clock */
+	for (;;) {
+		putchar('=');
+		if (command_entry())
+			command_dispatch();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/buzplayer/mygetchar.c	Thu Oct 27 03:50:40 2016 +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;
+}