Commit cfffac82 authored by Christian Eichler's avatar Christian Eichler
Browse files

Use target flash/bch_% instead of passing an environment variable

parent 595541e3
.PHONY: flash/ids_%
.PHONY: flash/ids_% flash/bch_%
#### Setup ####
XMC = $(shell pwd)/XMC
......@@ -16,33 +16,16 @@ LIBS = $(CMSIS)/Lib/GCC/libarm_cortexM4lf_math.a
LINKER_FILE = $(CMSIS)/Infineon/$(UC)_series/Source/GCC/XMC4500x1024.ld
CMSIS_SRC += $(CMSIS)/Infineon/$(UC)_series/Source/System_$(UC).c
define JLINK_FLASH_COMMANDS
connect
loadbin bin/xmc.bin 0x8000000
r
g
exit
endef
export JLINK_FLASH_COMMANDS
JLINK = JLinkExe
SYSCC = $(TOOLCHAIN)-gcc
CC = patmos-clang
CP = $(TOOLCHAIN)-objcopy
OD = $(TOOLCHAIN)-objdump
GDB = $(TOOLCHAIN)-gdb
SIZE = $(TOOLCHAIN)-size
STACK_SIZE?=2048
JLINKSER?=0
JLINKSERSTR=
ifneq ($(JLINKSER),0)
JLINKSERSTR=-SelectEmuBySN ${JLINKSER}
endif
JLFLAGS = -device XMC4500-1024 -if SWD -speed 900 ${JLINKSERSTR}
JLFLAGS = -device XMC4500-1024 -if SWD -speed 900
CFLAGS = -target armv6m--none-eabi -mcpu=cortex-m4 -mthumb -integrated-as -ccc-gcc-name arm-none-eabi-gcc
# CFLAGS = -g
......@@ -50,9 +33,6 @@ CFLAGS = -target armv6m--none-eabi -mcpu=cortex-m4 -mthumb -integrated-as -ccc-g
CFLAGS+= -O0 -ffunction-sections -fdata-sections
CFLAGS+= -MD -std=c99 -Wall -fms-extensions
CFLAGS+= -DUC_ID=$(UC_ID) -DARM_MATH_CM4 -DINTERRUPT_CONTROL_ENDPOINT
ifneq ($(JLINKSER),0)
CFLAGS+= -DSERIAL=${JLINKSER}
endif
CFLAGS+= -fmessage-length=0
CFLAGS+= -DXMC4500_F100x1024
CFLAGS+= -I$(CMSIS)/Include -I$(CMSIS)/Infineon/$(UC)_series/Include
......@@ -82,7 +62,7 @@ OBJS += src/System_$(UC).o
OBJS_MAIN = $(OBJS) $(SRC_MAIN:.c=.o)
#### Rules ####
all: $(OBJS) xmc xmccomm
all: $(OBJS) bin/xmc.bin xmccomm
src/System_$(UC).o: $(CMSIS_SRC)
$(CC) -c $(CFLAGS) $< -o $@
......@@ -117,19 +97,18 @@ flash/ids_%: bin/ids_%.bin
g\n\
exit\n" | $(JLINK) $(JLFLAGS) -SelectEmuBySN $*
xmc.axf: $(OBJS_MAIN) bin/startup_XMC4500.o gene.o
flash/bch_%: bin/xmc.bin
echo "connect\n\
loadbin bin/xmc.bin 0x8000000\n\
r\n\
g\n\
exit\n" | $(JLINK) $(JLFLAGS) -SelectEmuBySN $*
bin/xmc.axf: $(OBJS_MAIN) bin/startup_XMC4500.o gene.o
mkdir -p bin
@echo LD $<
@$(CC) -T $(LINKER_FILE) $(LFLAGS) -o bin/xmc.axf $^ $(LIBS)
xmc: xmc.axf
$(CP) $(CPFLAGS) bin/xmc.axf bin/xmc.bin
$(OD) $(ODFLAGS) bin/xmc.axf > bin/xmc.lst
$(SIZE) bin/xmc.axf
flash: xmc
echo "$$JLINK_FLASH_COMMANDS" | $(JLINK) $(JLFLAGS)
gdbsrv:
JLinkGDBServer -device XMC4500-1024 -if SWD -speed 300
......@@ -142,7 +121,7 @@ fastgdb:
make gdb
xmccomm: xmccomm.c
gcc -g xmccomm.c -o xmccomm
gcc -std=c99 -g xmccomm.c -o xmccomm
clean:
rm -f src/*.o src/*.d bin/*
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment