Skip to content
Snippets Groups Projects
Makefile 1.97 KiB
Newer Older
  • Learn to ignore specific revisions
  • #######################################################
    # Environment setup
    
    # toolchain
    
    DFU_SUFFIX = dfu-suffix
    DFU_UTIL = dfu-util
    
    CC = arm-none-eabi-gcc
    CXX = arm-none-eabi-g++
    OBJCOPY = arm-none-eabi-objcopy
    OBJDUMP = arm-none-eabi-objdump
    SIZE = arm-none-eabi-size
    
    
    # Bootloader to include in whole-chip .hex image
    FCBOOT_IMAGE = ../bin/fc-boot-v101.hex
    
    
    #######################################################
    
    
    # The name of your project (used to name the compiled .dfu file)
    
    TARGET = fc-firmware
    
    # Temporary .hex file for application image only, without bootloader
    APP_HEX = app-image.hex
    
    
    	pins_teensy.c \
    	usb_desc.c \
    	usb_dev.c \
    
    	usb_mem.c \
    	serial1.c
    
    	fadecandy.cpp \
    	fc_usb.cpp \
    
    
    # CPPFLAGS = compiler options for C and C++
    
    CPPFLAGS = -Wall -Wno-sign-compare -Wno-strict-aliasing -g -Os -mcpu=cortex-m4 \
    
    Micah Elizabeth Scott's avatar
    Micah Elizabeth Scott committed
    	-mthumb -nostdlib -MMD -Werror $(OPTIONS) $(INCLUDES)
    
    
    # compiler options for C++ only
    CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
    
    # compiler options for C only
    CFLAGS =
    
    # linker script
    
    LDSCRIPT = fcb-app.ld
    
    LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -nostdlib -T$(LDSCRIPT)
    
    
    # additional libraries to link
    LIBS = -lm
    
    OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
    
    
    all: $(TARGET).dfu $(TARGET).hex
    
    
    $(TARGET).elf: $(OBJS) $(LDSCRIPT)
    
    	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
    
    	$(OBJCOPY) -O binary $< $@
    	$(DFU_SUFFIX) -a $@
    
    
    	$(OBJCOPY) -O ihex $< $(APP_HEX)
    	(grep -v :00000001FF $(FCBOOT_IMAGE); cat $(APP_HEX)) > $@
    
    install: $(TARGET).dfu
    
    	$(DFU_UTIL) -d 1d50 -D $<
    
    benchmark: install
    	../tools/benchmark.py
    
    
    # compiler generated dependency info
    -include $(OBJS:.o=.d)
    
    clean:
    
    	rm -f *.d *.o $(TARGET).elf $(TARGET).dfu $(APP_HEX)
    
    disassemble: $(TARGET).elf
    	$(OBJDUMP) -d $< | less
    
    symbols: $(TARGET).elf
    	$(OBJDUMP) -t $< | sort | less
    
    .PHONY: all clean install disassemble symbols benchmark