Home | History | Annotate | Line # | Download | only in microcode
      1 #	$NetBSD: Makefile,v 1.6 2022/09/25 21:19:20 ryo Exp $
      2 
      3 S	= ${.CURDIR}/../../../..
      4 
      5 TOOLDIR	?= /usr/pkg/cross-arm-none-eabi
      6 
      7 CC	= ${TOOLDIR}/bin/arm-none-eabi-gcc
      8 OBJCOPY	= ${TOOLDIR}/bin/arm-none-eabi-objcopy
      9 
     10 CFLAGS	= -W -Wall -mlittle-endian
     11 CFLAGS	+= -O3 -mcpu=arm7
     12 CFLAGS	+= -fomit-frame-pointer -funroll-loops -finline-functions
     13 CFLAGS	+= -I${S}
     14 
     15 all: aica_armcode.h
     16 
     17 aica_armcode.h: aica_armcode.elf
     18 	${OBJCOPY} -O binary aica_armcode.elf aica_armcode.bin
     19 	echo '/* $$'NetBSD'$$ */' > ${.TARGET}.tmp
     20 	echo 'static uint32_t aica_armcode[] = {' >> ${.TARGET}.tmp
     21 	hexdump -v -e '" /* %04.4_ax */\t" 1/4 "0x%08x, " "\n"' \
     22 		aica_armcode.bin >> ${.TARGET}.tmp
     23 	echo '		0 };' >> ${.TARGET}.tmp
     24 	mv ${.TARGET}.tmp ${.TARGET}
     25 
     26 aica_armcode.elf: aica_arm_locore.o aica_arm.o
     27 	${CC} ${CFLAGS} -Wl,-Ttext,0 -Wl,-T ldscript -nostdlib -e 0 \
     28 		-o aica_armcode.elf aica_arm_locore.o aica_arm.o
     29 
     30 clean: clean-tmp
     31 #	rm -f aica_armcode.h
     32 
     33 clean-tmp:
     34 	rm -f *.o aica_armcode.elf aica_armcode.bin aica_armcode.h.tmp
     35 
     36