diff gcc/makefile-body @ 8:727914266f28

gcc: adapted from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 03:13:51 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/makefile-body	Fri May 15 03:13:51 2020 +0000
@@ -0,0 +1,41 @@
+CC=	arm-elf-gcc
+LD=	arm-elf-ld
+OBJCOPY=arm-elf-objcopy
+
+CFLAGS=	-mthumb-interwork
+
+LIBC_A=		`${CC} -print-file-name=libc.a -mthumb-interwork`
+LIBGCC_A=	`${CC} -print-file-name=libgcc.a -mthumb-interwork`
+LIBM_T=		`${CC} -print-file-name=libm.a -mthumb-interwork -mthumb`
+
+all:	ramimage.srec
+
+${SUBDIR}: FRC
+	cd $@; ${MAKE} ${MFLAGS}
+
+${LIBS}:	${SUBDIR}
+	@true
+
+bootentry.o:	../src/cs/system/main/gcc/bootentry.S
+	${CC} -c -o $@ ${CFLAGS} -DXRAM -Iconfig -I../src/nucleus/gcc $<
+
+ramvecs.o:	../src/cs/system/main/gcc/ramvecs.S
+	${CC} -c ${CFLAGS} $<
+
+ramimage.ld:	../gcc/xram.m4 ../gcc/memlimits.m4 ../gcc/ld-script.src
+	m4 $^ > $@
+
+ramimage.elf:	${LIBS} bootentry.o ramvecs.o ramimage.ld
+	${LD} -N -T ramimage.ld -o $@ -Map ramimage.map bootentry.o ramvecs.o \
+		--start-group ${LIBS} --end-group \
+		${LIBM_T} ${LIBC_A} ${LIBGCC_A}
+
+ramimage.srec:	ramimage.elf
+	${OBJCOPY} -O srec --srec-forceS3 --srec-len=30 $< $@
+
+clean:	FRC
+	rm -f fwimage.* ramimage.* bootentry*.o ramvecs.o
+	rm -f build_date.* flash-script
+	for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} clean); done
+
+FRC: