# put your *.o targets here, make should handle the rest! SRCS += main.c system_stm32f10x.c syscalls.c stm32f10x_it.c xprintf.c SRCS += LEDs.c motors.c uart.c adc.c IR.c SW.c MPU6050.c i2c.c # all the files will be generated with this name (main.elf, main.bin, main.hex, etc) PROJ_NAME=introarm OUTPATH=build ################################################### # Check for valid float argument # Set which float type to use (override hard or soft) ifneq ($(FLOAT_TYPE), hard) ifneq ($(FLOAT_TYPE), soft) #override FLOAT_TYPE = hard override FLOAT_TYPE = soft endif endif ################################################### # BINPATH contains the path where your compilers are located. This should typically be /sat/bin BINPATH=~/sat/bin #CC contains the path to the compiler CC=$(BINPATH)/arm-none-eabi-gcc OBJCOPY=$(BINPATH)/arm-none-eabi-objcopy SIZE=$(BINPATH)/arm-none-eabi-size # CFLAGS contains all compiler flags sent to the compiler in CC CFLAGS = -std=gnu99 -g -Os -Wall -ffunction-sections -fdata-sections -Tstm32_flash.ld -Xlinker --gc-sections CFLAGS += -DSTM32F10X_LD_VL -DUSE_STDPERIPH_DRIVER CFLAGS += -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m3 ifeq ($(FLOAT_TYPE), hard) CFLAGS += -fsingle-precision-constant -Wdouble-promotion CFLAGS += -mfpu=fpv4-sp-d16 -mfloat-abi=hard #CFLAGS += -mfpu=fpv4-sp-d16 -mfloat-abi=softfp else CFLAGS += -msoft-float endif ################################################### vpath %.c src vpath %.a lib ROOT=$(shell pwd) # Includes CFLAGS += -Iinc -Ilib/Core/cmsis -Ilib/Core/stm32 CFLAGS += -Ilib/Conf # Extra includes CFLAGS += -Ilib/StdPeriph/inc #CFLAGS += -Ilib/RF2400 #CFLAGS += -Ilib/RF2400/BK # Library paths LIBPATHS = -Llib/StdPeriph # -Llib/RF2400 -Llib/RF2400 # Libraries to link LIBS = -lm -lstdperiph #-lrf2400 SRCS += lib/startup_stm32f10x_ld_vl.s # add startup file to build OBJS = $(SRCS:.c=.o) ################################################### .PHONY: lib proj all: lib proj $(SIZE) $(OUTPATH)/$(PROJ_NAME).elf lib: $(MAKE) -C lib FLOAT_TYPE=$(FLOAT_TYPE) proj: $(OUTPATH)/$(PROJ_NAME).elf $(OUTPATH)/$(PROJ_NAME).elf: $(SRCS) $(CC) $(CFLAGS) $^ -o $@ $(LIBPATHS) $(LIBS) $(OBJCOPY) -O ihex $(OUTPATH)/$(PROJ_NAME).elf $(OUTPATH)/$(PROJ_NAME).hex $(OBJCOPY) -O binary $(OUTPATH)/$(PROJ_NAME).elf $(OUTPATH)/$(PROJ_NAME).bin clean: rm -f *.o rm -f $(OUTPATH)/$(PROJ_NAME).elf rm -f $(OUTPATH)/$(PROJ_NAME).hex rm -f $(OUTPATH)/$(PROJ_NAME).bin $(MAKE) clean -C lib # Remove this line if you don't want to clean the libs as well