view gcc/makefile-body @ 134:7d50d8d13711

FFS code sync with Magnetite + gcc version fix This change brings the new flash autodetection for FC and Pirelli targets from Magnetite, and should also fix the gcc version for C1xx and gtamodem targets, which were previously broken because they used TI's original flash autodetect code (which operates at address 0) while the boot ROM is mapped there.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Dec 2018 08:43:25 +0000
parents 5ba0bee90efa
children 767c75e3d2f2
line wrap: on
line source

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:	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 -o $@ ${CFLAGS} -DFLASH -Iconfig -I../src/nucleus/gcc $<

bootentry-xram.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} $<

build_date.c:	${LIBS} bootentry-flash.o bootentry-xram.o ramvecs.o Makefile
	../helpers/build-date ${CONFIG_NAME} > $@

build_date.o:	build_date.c
	${CC} -c ${CFLAGS} 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: