46 lines
1.1 KiB
Makefile
46 lines
1.1 KiB
Makefile
CROSS_COMPILE:=arm-none-eabi-
|
|
CC:=$(CROSS_COMPILE)gcc
|
|
LD:=$(CROSS_COMPILE)gcc
|
|
VERSION?=1
|
|
|
|
OBJS:=startup.o main.o system.o mem.o led.o \
|
|
i2c.o display.o font_twisted.o button.o systick.o newlib.o uart.o ui.o timer.o\
|
|
mutex.o ui_tester.o adc.o spi.o
|
|
|
|
|
|
UMX:=lib/unicore-mx/lib/libucmx_stm32f4.a
|
|
UMXFLAGS:=-Ilib/unicore-mx/include/ -DSTM32F4
|
|
LIBS+=$(UMX)
|
|
|
|
|
|
LSCRIPT:=target.ld
|
|
|
|
OBJCOPY:=$(CROSS_COMPILE)objcopy
|
|
|
|
CFLAGS:=-mcpu=cortex-m3 -mthumb -Wall -Wno-main -Wstack-usage=320 \
|
|
-ffreestanding -Wno-unused -DBLOCK_SIZE=4096 -I. -Ilib/unicore-mx/include \
|
|
-ffunction-sections -fdata-sections
|
|
CFLAGS+=-specs=nano.specs -lc -lg
|
|
CFLAGS+=$(UMXFLAGS)
|
|
CFLAGS+=-O3
|
|
#CFLAGS+=-g -ggdb3
|
|
|
|
ASFLAGS:=$(CFLAGS)
|
|
|
|
LDFLAGS:=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map -mcpu=cortex-m3 -mthumb -nostartfiles
|
|
|
|
#all: image.bin
|
|
|
|
image.bin: image.elf
|
|
$(OBJCOPY) -O binary $^ $@
|
|
|
|
image.elf: $(LIBS) $(OBJS) $(LSCRIPT)
|
|
$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
|
|
|
$(UMX):
|
|
make -C lib/unicore-mx FP_FLAGS="-O3 -mfloat-abi=soft" TARGETS=stm32/f4
|
|
|
|
clean:
|
|
@rm -f image.bin image.elf *.o image.map $(USECFS)/src/*.o
|
|
make -C lib/unicore-mx clean
|
|
|