44 lines
979 B
Makefile
44 lines
979 B
Makefile
|
CROSS_COMPILE:=arm-none-eabi-
|
||
|
CC:=$(CROSS_COMPILE)gcc
|
||
|
LD:=$(CROSS_COMPILE)gcc
|
||
|
VERSION?=1
|
||
|
|
||
|
OBJS=main.o
|
||
|
|
||
|
|
||
|
UMX:=unicore-mx/lib/libucmx_stm32l0.a
|
||
|
UMXFLAGS:=-Iunicore-mx/include/ -DSTM32L0
|
||
|
LIBS+=$(UMX)
|
||
|
|
||
|
|
||
|
LSCRIPT:=unicore-mx/lib/stm32/l0/stm32l0xx6.ld
|
||
|
|
||
|
OBJCOPY:=$(CROSS_COMPILE)objcopy
|
||
|
|
||
|
CFLAGS:=-mcpu=cortex-m0 -mthumb -Wall -Wno-main -Wstack-usage=320 \
|
||
|
-ffreestanding -Wno-unused -DBLOCK_SIZE=4096 -I. -Iunicore-mx/include \
|
||
|
-ffunction-sections -fdata-sections -DSTM32L0
|
||
|
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-m0 -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 unicore-mx FP_FLAGS="-O3 -mfloat-abi=soft" TARGETS=stm32/l0
|
||
|
|
||
|
clean:
|
||
|
@rm -f image.bin image.elf *.o image.map
|
||
|
make -C unicore-mx clean
|