changeset 91:081dd22ca6a2

gcc/makefile-body: created
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 21 Jul 2018 00:21:50 +0000
parents 2de9e5f46550
children e42d528f3e6e
files gcc/makefile-body
diffstat 1 files changed, 64 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/makefile-body	Sat Jul 21 00:21:50 2018 +0000
@@ -0,0 +1,64 @@
+CC=	arm-elf-gcc
+LD=	arm-elf-ld
+OBJCOPY=arm-elf-objcopy
+
+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=libc.a -mthumb-interwork -mthumb`
+
+all:	fwimage.bin flash-script
+ram:	ramimage.srec
+
+${SUBDIR}: FRC
+	cd $@; ${MAKE} ${MFLAGS}
+
+${LIBS}:	${SUBDIR}
+	@true
+
+bootentry-flash.o:	../src/cs/system/main/gcc/bootentry.S
+	${CC} -c -mthumb-interwork -DFLASH -Iconfig -I../src/nucleus/gcc $<
+
+bootentry-xram.o:	../src/cs/system/main/gcc/bootentry.S
+	${CC} -c -mthumb-interwork -DXRAM -Iconfig -I../src/nucleus/gcc $<
+
+ramvecs.o:	../src/cs/system/main/gcc/ramvecs.S
+	${CC} -c -mthumb-interwork $<
+
+build_date.c:	${LIBS} bootentry-flash.o bootentry-xram.o ramvecs.o
+	../helpers/build-date gcc > $@
+
+build_date.o:	build_date.c
+	${CC} -c -mthumb-interwork build_date.c
+
+fwimage.ld:	../targets/${TARGET}.m4 ../gcc/flash.m4 ../gcc/ld-script.src
+	m4 $^ > $@
+
+fwimage.elf:	${LIBS} bootentry-flash.o ramvecs.o build_date.o fwimage.ld
+	${LD} -N -T fwimage.ld -o $@ -Map fwimage.map bootentry-flash.o \
+		ramvecs.o build_date.o --start-group ${LIBS} --end-group \
+		${LIBM_T} ${LIBC_A} ${LIBGCC_A}
+
+fwimage.bin:	fwimage.elf
+	${OBJCOPY} -O binary $< $@
+
+flash-script:	fwimage.bin
+	../helpers/mk-flash-script $< ${FLASH_BASE_ADDR} ${FLASH_SECTOR_SIZE} \
+		> $@
+
+ramimage.ld:	../targets/${TARGET}.m4 ../gcc/xram.m4 ../gcc/ld-script.src
+	m4 $^ > $@
+
+ramimage.elf:	${LIBS} bootentry-xram.o ramvecs.o build_date.o ramimage.ld
+	${LD} -N -T ramimage.ld -o $@ -Map ramimage.map bootentry-xram.o \
+		ramvecs.o build_date.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: