2012-06-10 04:40:07 +00:00
|
|
|
PROBE_HOST ?= native
|
|
|
|
PLATFORM_DIR = platforms/$(PROBE_HOST)
|
2020-04-16 15:27:26 +00:00
|
|
|
VPATH += $(PLATFORM_DIR) target
|
2016-06-18 08:26:56 +00:00
|
|
|
ENABLE_DEBUG ?=
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2015-03-07 18:32:52 +00:00
|
|
|
ifneq ($(V), 1)
|
|
|
|
MAKEFLAGS += --no-print-dir
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
2019-09-27 12:02:18 +00:00
|
|
|
CFLAGS += -Wall -Wextra -Werror -Wno-char-subscripts \
|
2020-04-16 15:27:26 +00:00
|
|
|
-std=gnu99 -g3 -MD -I./target \
|
|
|
|
-I. -Iinclude -I$(PLATFORM_DIR)
|
2016-06-18 08:26:56 +00:00
|
|
|
|
|
|
|
ifeq ($(ENABLE_DEBUG), 1)
|
|
|
|
CFLAGS += -DENABLE_DEBUG
|
|
|
|
endif
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2012-11-03 08:33:28 +00:00
|
|
|
SRC = \
|
2011-02-04 07:23:52 +00:00
|
|
|
adiv5.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
adiv5_jtagdp.c \
|
2011-02-04 07:23:52 +00:00
|
|
|
adiv5_swdp.c \
|
|
|
|
command.c \
|
2016-04-18 18:30:25 +00:00
|
|
|
cortexa.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
cortexm.c \
|
|
|
|
crc32.c \
|
2015-10-23 18:47:23 +00:00
|
|
|
efm32.c \
|
2015-03-01 04:50:10 +00:00
|
|
|
exception.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
gdb_if.c \
|
|
|
|
gdb_main.c \
|
2016-07-01 04:50:19 +00:00
|
|
|
gdb_hostio.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
gdb_packet.c \
|
|
|
|
hex_utils.c \
|
2019-03-05 14:35:19 +00:00
|
|
|
jtag_devs.c \
|
2020-04-16 17:38:32 +00:00
|
|
|
jtag_scan.c \
|
2011-02-04 07:23:52 +00:00
|
|
|
lmi.c \
|
2015-04-05 02:15:03 +00:00
|
|
|
lpc_common.c \
|
2013-06-17 04:06:03 +00:00
|
|
|
lpc11xx.c \
|
2018-03-25 19:53:30 +00:00
|
|
|
lpc17xx.c \
|
2016-06-09 22:20:07 +00:00
|
|
|
lpc15xx.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
lpc43xx.c \
|
2020-09-30 07:44:03 +00:00
|
|
|
lpc546xx.c \
|
2015-01-06 09:26:00 +00:00
|
|
|
kinetis.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
main.c \
|
2015-03-01 06:05:10 +00:00
|
|
|
morse.c \
|
2018-06-06 20:34:21 +00:00
|
|
|
msp432.c \
|
2014-04-25 21:34:58 +00:00
|
|
|
nrf51.c \
|
2018-06-22 13:44:17 +00:00
|
|
|
nxpke04.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
platform.c \
|
2020-04-15 15:36:26 +00:00
|
|
|
remote.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
sam3x.c \
|
2019-10-01 12:06:30 +00:00
|
|
|
sam4l.c \
|
2015-01-18 22:40:02 +00:00
|
|
|
samd.c \
|
2019-10-10 04:38:36 +00:00
|
|
|
samx5x.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
stm32f1.c \
|
2011-11-12 06:15:52 +00:00
|
|
|
stm32f4.c \
|
2018-07-25 08:58:52 +00:00
|
|
|
stm32h7.c \
|
2014-12-20 00:25:22 +00:00
|
|
|
stm32l0.c \
|
2015-08-21 14:57:10 +00:00
|
|
|
stm32l4.c \
|
2012-06-24 04:53:13 +00:00
|
|
|
target.c \
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2012-06-10 04:40:07 +00:00
|
|
|
include $(PLATFORM_DIR)/Makefile.inc
|
2019-03-05 14:01:38 +00:00
|
|
|
|
2020-04-18 15:54:00 +00:00
|
|
|
OPT_FLAGS ?= -Og
|
2019-08-05 13:29:00 +00:00
|
|
|
CFLAGS += $(OPT_FLAGS)
|
|
|
|
LDFLAGS += $(OPT_FLAGS)
|
|
|
|
|
2019-03-05 09:53:33 +00:00
|
|
|
ifndef TARGET
|
2020-04-20 15:36:21 +00:00
|
|
|
ifdef PC_HOSTED
|
|
|
|
TARGET = blackmagic
|
|
|
|
else
|
|
|
|
TARGET = blackmagic.elf
|
|
|
|
endif
|
2019-03-05 09:53:33 +00:00
|
|
|
endif
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2019-07-18 18:44:59 +00:00
|
|
|
ifdef NO_OWN_LL
|
|
|
|
SRC += jtagtap_generic.c swdptap_generic.c
|
2019-03-05 14:01:38 +00:00
|
|
|
endif
|
|
|
|
|
2020-04-15 15:36:26 +00:00
|
|
|
ifdef PC_HOSTED
|
|
|
|
CFLAGS += -DPC_HOSTED=1
|
|
|
|
else
|
2020-04-19 15:36:44 +00:00
|
|
|
SRC += swdptap.c jtagtap.c
|
2020-04-15 15:36:26 +00:00
|
|
|
CFLAGS += -DPC_HOSTED=0
|
2020-04-16 15:27:26 +00:00
|
|
|
VPATH += platforms/common
|
|
|
|
CFLAGS += -Iplatforms/common
|
2020-04-15 15:36:26 +00:00
|
|
|
endif
|
|
|
|
|
2019-08-05 13:41:46 +00:00
|
|
|
OBJ = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(SRC)))
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2019-03-05 09:53:33 +00:00
|
|
|
$(TARGET): include/version.h $(OBJ)
|
2015-03-07 18:32:52 +00:00
|
|
|
@echo " LD $@"
|
2015-04-04 03:21:33 +00:00
|
|
|
$(Q)$(CC) -o $@ $(OBJ) $(LDFLAGS)
|
2015-03-07 18:32:52 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@echo " CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -c $< -o $@
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2019-08-05 13:41:46 +00:00
|
|
|
%.o: %.S
|
|
|
|
@echo " AS $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2020-04-20 15:36:21 +00:00
|
|
|
ifndef PC_HOSTED
|
|
|
|
%.bin: %.elf
|
2015-03-07 18:32:52 +00:00
|
|
|
@echo " OBJCOPY $@"
|
|
|
|
$(Q)$(OBJCOPY) -O binary $^ $@
|
2015-03-06 22:36:24 +00:00
|
|
|
|
2020-04-20 15:36:21 +00:00
|
|
|
%.hex: %.elf
|
2015-03-07 18:32:52 +00:00
|
|
|
@echo " OBJCOPY $@"
|
|
|
|
$(Q)$(OBJCOPY) -O ihex $^ $@
|
2020-04-20 15:36:21 +00:00
|
|
|
endif
|
2015-03-06 22:36:24 +00:00
|
|
|
|
2015-04-04 03:21:33 +00:00
|
|
|
.PHONY: clean host_clean all_platforms FORCE
|
2011-02-04 07:23:52 +00:00
|
|
|
|
|
|
|
clean: host_clean
|
2015-03-07 18:32:52 +00:00
|
|
|
$(Q)echo " CLEAN"
|
2020-04-20 15:36:21 +00:00
|
|
|
-$(Q)$(RM) *.o *.d *.elf *~ $(TARGET) $(HOSTFILES)
|
2019-03-27 22:09:32 +00:00
|
|
|
-$(Q)$(RM) platforms/*/*.o platforms/*/*.d mapfile include/version.h
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2015-03-03 06:20:25 +00:00
|
|
|
all_platforms:
|
2015-03-07 18:32:52 +00:00
|
|
|
$(Q)set -e ;\
|
2020-10-19 16:14:59 +00:00
|
|
|
mkdir -p artifacts/$(shell git describe --always --dirty --tags) ;\
|
2016-10-22 19:17:57 +00:00
|
|
|
echo "<html><body><ul>" > artifacts/index.html ;\
|
2015-03-03 06:20:25 +00:00
|
|
|
for i in platforms/*/Makefile.inc ; do \
|
|
|
|
export DIRNAME=`dirname $$i` ;\
|
|
|
|
export PROBE_HOST=`basename $$DIRNAME` ;\
|
|
|
|
export CFLAGS=-Werror ;\
|
2015-03-07 18:32:52 +00:00
|
|
|
echo "Building for hardware platform: $$PROBE_HOST" ;\
|
|
|
|
$(MAKE) $(MAKEFLAGS) clean ;\
|
|
|
|
$(MAKE) $(MAKEFLAGS);\
|
2015-03-03 06:20:25 +00:00
|
|
|
if [ -f blackmagic.bin ]; then \
|
2016-10-22 18:52:41 +00:00
|
|
|
mv blackmagic.bin artifacts/blackmagic-$$PROBE_HOST.bin ;\
|
2016-10-22 19:17:57 +00:00
|
|
|
echo "<li><a href='blackmagic-$$PROBE_HOST.bin'>$$PROBE_HOST</a></li>"\
|
|
|
|
>> artifacts/index.html ;\
|
2015-03-03 06:20:25 +00:00
|
|
|
fi ;\
|
2019-10-28 14:58:48 +00:00
|
|
|
if [ -f blackmagic_dfu.bin ]; then \
|
|
|
|
mv blackmagic_dfu.bin artifacts/blackmagic_dfu-$$PROBE_HOST.bin ;\
|
|
|
|
echo "<li><a href='blackmagic_dfu-$$PROBE_HOST.bin'>$$PROBE_HOST DFU</a></li>"\
|
|
|
|
>> artifacts/index.html ;\
|
|
|
|
fi ;\
|
2016-10-22 19:17:57 +00:00
|
|
|
done ;\
|
|
|
|
echo "</ul></body></html>" >> artifacts/index.html ;\
|
2020-10-19 16:14:59 +00:00
|
|
|
cp artifacts/*.bin artifacts/$(shell git describe --always --dirty --tags)
|
2016-10-22 19:17:57 +00:00
|
|
|
|
2017-05-23 18:57:35 +00:00
|
|
|
command.c: include/version.h
|
2015-03-03 06:20:25 +00:00
|
|
|
|
2015-04-04 03:21:33 +00:00
|
|
|
include/version.h: FORCE
|
2019-03-27 22:09:32 +00:00
|
|
|
$(Q)echo " GIT include/version.h"
|
2020-09-22 16:54:09 +00:00
|
|
|
$(Q)echo "#define FIRMWARE_VERSION \"$(shell git describe --always --dirty --tags)\"" > $@
|
2012-01-08 05:42:24 +00:00
|
|
|
-include *.d
|