Quadrotor from scratch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

72 lines
1.8 KiB

# Makefile
NAME=quad
SSRCS=crt0.s
CSRCS=main.c i2c.c mpu6050.c timer.c interrupt.c uart.c event.c matrix.c dcm.c
CSRCS+=fisqrt.c stick.c trig.c motor.c led.c watchdog.c panic.c status.c
CSRCS+=thrust.c sensors.c spi.c sdcard.c log.c hmc5883l.c mpl3115a2.c config.c
CSRCS+=crc.c memcpy.c
#PROJOPTS=-DUSE_UART -DSEND_DCM -DSTICK_DEBUG_CALIBRATE
PROJOPTS=-DTIMER_CPPM -DI2C_FAST
#PROJOPTS=-DTIMER_CPPM -DI2C_FAST -DUSE_UART
#PROJOPTS=-DTIMER_CPPM -DUSE_UART -DPANIC_32BIT -DPANIC_CHECKPOINT -DI2C_FAST -DSEND_DCM
#PROJOPTS=-DTIMER_CPPM -DPANIC_32BIT -DPANIC_CHECKPOINT -DI2C_FAST -DSEND_DCM
#PROJOPTS=-DTIMER_CPPM -DPANIC_32BIT -DPANIC_CHECKPOINT -DI2C_FAST -DUSE_UART -DSEND_DCM
# Enable debug
#PROJOPTS+=-DUSE_UART
COPTIM?=-Os
CFLAGS=-march=armv4t -msoft-float $(COPTIM) -Wall -Werror -Wextra $(PROJOPTS)
LDSCRIPT=lpc2103_flash.ld
# To build with the Clang Static Analyzer, use
# scan-build --use-cc=arm-elf-gcc make
# And uncomment the following line:
CC=arm-elf-gcc
OBJCOPY=arm-elf-objcopy
LINT=splint
LINTFLAGS=-booltype bool -nolib +charint
CLEANOBJS=$(OBJS) $(NAME).hex $(NAME).elf $(NAME).bin $(NAME).map .depend
all: $(NAME).bin
# In theory, nothing below here needs touching for as long as all of the
# sources are in a single directory.
COBJS=$(CSRCS:.c=.o)
SOBJS=$(SSRCS:.s=.o)
OBJS=$(SOBJS) $(COBJS)
.SUFFIXES: .elf .hex .bin
$(OBJS): Makefile
$(NAME).elf: $(OBJS)
$(CC) $(CFLAGS) -nostdlib -nostartfiles -T $(LDSCRIPT) -Wl,-Map -Wl,$(NAME).map -o $(NAME).elf $(OBJS) -lgcc
run: $(NAME).hex
$(FLASHER) -hex -term -control $(NAME).hex $(PORT) $(SPEED) $(OSC)
.elf.hex:
$(OBJCOPY) -O ihex ${.IMPSRC} ${.TARGET}
.hex.bin:
$(OBJCOPY) -I ihex -O binary ${.IMPSRC} ${.TARGET}
clean:
rm -rf $(CLEANOBJS)
depend:
$(CC) -MM $(CFLAGS) -nostdlib -nostartfiles $(CSRCS) >.depend
lint:
$(LINT) $(LINTFLAGS) $(CSRCS)
.sinclude ".depend"