1
0
mirror of git://projects.qi-hardware.com/f32xbase.git synced 2024-11-05 14:43:45 +02:00
f32xbase/fw/common/Makefile.common
Werner Almesberger 3f5ec8aa9e Use config.h as the main source of configuration data. Fixed some boot.c
glitches.

- fw/boot/boot.c, fw/boot/dfu.c: include config.h for platform defines
- fw/common/Makefile.common: add $(F32XBASE)/fw/common to include search
  path
- fw/boot/boot.c: define dummy for uart_init if no debugging is enabled
- fw/boot/boot.c (PLATFORM_EXIT): typo PLAYFORM_EXIT
- fw/boot/boot.c (run_payload): rename BOOT_SETUP to PLATFORM_SETUP
- fw/boot/dfu.c (device_descriptor): use USB_PRODUCT instead of
  USB_PRODUCT_IDBG_DFU
- fw/boot/config.h: removed for now. Might bring it back later as template.
- fw/boot/version.h: moved to fw/common/
- fw/common/Makefile.system: remove serial setup
2010-08-19 01:01:08 -03:00

96 lines
2.2 KiB
Makefile

#
# common/Makefile.common - Common rules and definitions
#
# Written 2008, 2010 by Werner Almesberger
# Copyright 2008, 2010 Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
CC=sdcc
CFLAGS=--std-c99 -I. -I$(F32XBASE)/fw/common \
-DPAYLOAD_START=$(PAYLOAD_START) -DPAYLOAD_SIZE=$(PAYLOAD_SIZE)
LDFLAGS=--xram-size 1024
CPP := $(CPP) # make sure changing CC won't affect CPP
CC_normal := $(CC)
CC_quiet = @echo " CC " $@ && $(CC_normal)
GEN_quiet = @echo " GENERATE " $@ &&
ifeq ($(V),1)
CC = $(CC_normal)
GEN =
else
CC = $(CC_quiet)
GEN = $(GEN_quiet)
endif
.SUFFIXES: .rel .ihx .bin
.PHONY: clean spotless upload version
all: $(MAIN).bin
version version.h:
@if [ -f .version ]; then \
v=`cat .version`; \
expr $$v + 1 >.version; \
else \
echo 0 >.version; \
fi
@[ -s .version ] || echo 0 >.version
@echo '/* MACHINE-GENERATED. DO NOT EDIT ! */' >version.c
@echo '#include "version.h"' >>version.c
@echo "const char *build_date = \"`date`\";" >>version.c
@echo "const uint16_t build_number = `cat .version`;" \
>>version.c
version.rel: version
$(MAIN).ihx: $(OBJS:%=%.rel)
$(GEN) $(CC_normal) $(CFLAGS) $(LDFLAGS) $(OBJS:%=%.rel)
.ihx.bin:
$(GEN) objcopy -I ihex $< -O binary $@
@echo "build #`cat .version`, `ls -l $@`"
.rel.ihx:
$(CC) $(CFLAGS) $<
.c.rel:
$(CC) $(CFLAGS) -c $<
# below, set dummy UART speed to make dependencies build without error
depend .depend:
>.depend
touch version.h version.c
for n in $(OBJS:%=%.c); do \
$(CPP) $(CFLAGS) -DUART_115200_BPS -MM -MG \
`[ -f $$n ] || echo ../common/`$$n >>.depend || \
{ rm -f .depend; exit 1; }; \
done
ifeq (.depend,$(wildcard .depend))
include .depend
endif
clean:
rm -f $(OBJS:%=%.rel)
rm -f $(OBJS:%=%.asm) $(OBJS:%=%.lst)
rm -f $(OBJS:%=%.rst) $(OBJS:%=%.sym)
rm -f $(MAIN).ihx $(MAIN).lnk $(MAIN).map $(MAIN).mem
spotless: clean
rm -f $(MAIN).bin .depend
upload:
ssh lab neo 'cat \>$(MAIN).bin' <$(MAIN).bin