changeset 769:f18db0f00ad8

target-utils: simagent application started
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Mar 2021 06:40:24 +0000
parents 4e6837859c0b
children 81f9e4b4f55c
files target-utils/Makefile target-utils/simagent/Makefile target-utils/simagent/cmdtab.c target-utils/simagent/main.c
diffstat 4 files changed, 82 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/Makefile	Thu Mar 11 23:34:54 2021 +0000
+++ b/target-utils/Makefile	Fri Mar 12 06:40:24 2021 +0000
@@ -1,5 +1,5 @@
 INSTPROGS=	buzplayer calversion compalstage c139explore dspdump \
-		flash-boot-wa loadagent lunadrv pirexplore simtest
+		flash-boot-wa loadagent lunadrv pirexplore simagent simtest
 ALLPROGS=	${INSTPROGS} c139-lldbg flash-boot-test helloapp tf-breakin
 LIBS=		libbase libc libcommon libprintf libtiffs
 SUBDIR=		${ALLPROGS} ${LIBS}
@@ -19,6 +19,7 @@
 loadagent:		libbase libc libcommon libprintf
 lunadrv:		libbase libc libcommon libprintf
 pirexplore:		libbase libc libcommon libprintf libtiffs
+simagent:		libbase libc libcommon libprintf
 simtest:		libbase libc libcommon libprintf
 
 ${SUBDIR}: FRC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/simagent/Makefile	Fri Mar 12 06:40:24 2021 +0000
@@ -0,0 +1,35 @@
+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=	simagent
+OBJS=	crt0.o cmdtab.o main.o
+LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a ../libbase/libbase.a \
+	../libc/libc.a
+LIBGCC=	`${CC} -print-file-name=libgcc.a`
+LDS=	../env/iram.lds
+
+all:	${PROG}.srec
+
+crt0.S:
+	ln -s ../env/crt0.S .
+
+${PROG}.elf:	${OBJS} ${LIBS} ${LDS}
+	${LD} -N --defsym Base_addr=0x800750 --defsym stack_bottom=0x83FFFC \
+		-T ${LDS} -o $@ ${OBJS} ${LIBS} ${LIBGCC}
+
+${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/simagent/cmdtab.c	Fri Mar 12 06:40:24 2021 +0000
@@ -0,0 +1,33 @@
+#include "cmdtab.h"
+
+extern void cmd_abbr();
+extern void cmd_abbw();
+extern void cmd_baud_switch();
+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();
+extern void abb_unlock_page2();
+
+const struct cmdtab cmdtab[] = {
+	{"abbinit", abb_init},
+	{"abbpage2", abb_unlock_page2},
+	{"abbr", cmd_abbr},
+	{"abbw", cmd_abbw},
+	{"baud", cmd_baud_switch},
+	{"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/simagent/main.c	Fri Mar 12 06:40:24 2021 +0000
@@ -0,0 +1,12 @@
+main()
+{
+	uart_select_init();
+	printf("Calypso SIM interface agent running\n");
+	print_boot_rom_info();
+	abb_init();
+	for (;;) {
+		putchar('=');
+		if (command_entry())
+			command_dispatch();
+	}
+}