changeset 516:8bdbae4c0e53

target-utils/helloapp: build boot-ROM-based and fixed-UART versions
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 29 May 2019 05:40:51 +0000
parents 455c394c014d
children 809829dbc58a
files target-utils/helloapp/Makefile target-utils/helloapp/main-bootrom.c target-utils/helloapp/main-fixeduart.c target-utils/helloapp/main.c target-utils/helloapp/uartbase-irda.S target-utils/helloapp/uartbase-modem.S
diffstat 6 files changed, 49 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/helloapp/Makefile	Wed May 29 05:05:25 2019 +0000
+++ b/target-utils/helloapp/Makefile	Wed May 29 05:40:51 2019 +0000
@@ -4,24 +4,36 @@
 LD=	arm-elf-ld
 OBJCOPY=arm-elf-objcopy
 
-PROG=	helloapp
-OBJS=	crt0.o cmdtab.o main.o mygetchar.o
+BOOTROM_OBJS=	crt0.o cmdtab.o main-bootrom.o mygetchar.o
+IRDA_OBJS=	crt0.o cmdtab.o main-fixeduart.o mygetchar.o uartbase-irda.o
+MODEM_OBJS=	crt0.o cmdtab.o main-fixeduart.o mygetchar.o uartbase-modem.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
+all:	helloapp-bootrom.srec helloapp-irda.srec helloapp-modem.srec
+
+.SUFFIXES: .elf .srec
+
+.elf.srec:
+	${OBJCOPY} -O srec --srec-forceS3 --srec-len=30 $< $@
 
 crt0.S:
 	ln -s ../env/crt0.S .
 
-${PROG}.elf:	${OBJS} ${LIBS} ${LDS}
+helloapp-bootrom.elf:	${BOOTROM_OBJS} ${LIBS} ${LDS}
 	${LD} -N --defsym Base_addr=0x800750 --defsym stack_bottom=0x83FFFC \
-		-T ${LDS} -o $@ ${OBJS} ${LIBS} ${LIBGCC}
+		-T ${LDS} -o $@ ${BOOTROM_OBJS} ${LIBS} ${LIBGCC}
 
-${PROG}.srec:	${PROG}.elf
-	${OBJCOPY} -O srec --srec-forceS3 --srec-len=30 $< $@
+helloapp-irda.elf:	${IRDA_OBJS} ${LIBS} ${LDS}
+	${LD} -N --defsym Base_addr=0x820000 --defsym stack_bottom=0x83FFFC \
+		-T ${LDS} -o $@ ${IRDA_OBJS} ${LIBS} ${LIBGCC}
+
+helloapp-modem.elf:	${MODEM_OBJS} ${LIBS} ${LDS}
+	${LD} -N --defsym Base_addr=0x820000 --defsym stack_bottom=0x83FFFC \
+		-T ${LDS} -o $@ ${MODEM_OBJS} ${LIBS} ${LIBGCC}
 
 clean:
 	rm -f *.o *errs *core *.elf *.bin *.srec crt0.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/helloapp/main-bootrom.c	Wed May 29 05:40:51 2019 +0000
@@ -0,0 +1,11 @@
+main()
+{
+	uart_select_init();
+	printf("Hello-world demo app running\n");
+	print_boot_rom_info();
+	for (;;) {
+		putchar('=');
+		if (command_entry())
+			command_dispatch();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/helloapp/main-fixeduart.c	Wed May 29 05:40:51 2019 +0000
@@ -0,0 +1,9 @@
+main()
+{
+	printf("Hello-world demo app (fixed UART version) running\n");
+	for (;;) {
+		putchar('=');
+		if (command_entry())
+			command_dispatch();
+	}
+}
--- a/target-utils/helloapp/main.c	Wed May 29 05:05:25 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-main()
-{
-	uart_select_init();
-	printf("Hello-world demo app running\n");
-	print_boot_rom_info();
-	for (;;) {
-		putchar('=');
-		if (command_entry())
-			command_dispatch();
-	}
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/helloapp/uartbase-irda.S	Wed May 29 05:40:51 2019 +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/helloapp/uartbase-modem.S	Wed May 29 05:40:51 2019 +0000
@@ -0,0 +1,5 @@
+	.section	.rodata
+	.balign	4
+	.globl	uart_base
+uart_base:
+	.word	0xFFFF5800