Naze32 clone with Frysky receiver
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.

makefile 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. MCU = attiny85
  2. F_CPU = 16000000
  3. RM = rm -rf
  4. MKDIR = mkdir -p
  5. EXTRAINCDIR = include
  6. CSTANDARD = gnu99
  7. BUILDDIR = build
  8. GCC = avr-gcc
  9. SIZE = avr-size
  10. OBJCOPY = avr-objcopy
  11. OBJDUMP = avr-objdump
  12. AVRDUDE = avrdude
  13. SRC = src/main.c
  14. SRC += src/timer.c
  15. SRC += src/spi.c
  16. SRC += src/cc2500.c
  17. SRC += src/rx.c
  18. SRC += src/cppm.c
  19. ifeq ($(DEBUG),1)
  20. SRC += src/serial.c
  21. endif
  22. OBJ = $(addprefix $(BUILDDIR)/, $(SRC:.c=.o))
  23. CARGS = -mmcu=$(MCU)
  24. CARGS += -I$(EXTRAINCDIR)
  25. CARGS += -Os
  26. #CARGS += -funsigned-char
  27. #CARGS += -funsigned-bitfields
  28. #CARGS += -fpack-struct
  29. #CARGS += -fshort-enums
  30. CARGS += -Wall -pedantic -Wstrict-prototypes -Wshadow
  31. CARGS += -Wpointer-arith -Wcast-qual -Wextra
  32. CARGS += -Wno-main -Wno-write-strings -Wno-unused-parameter
  33. CARGS += -std=$(CSTANDARD)
  34. CARGS += -DF_CPU=$(F_CPU)
  35. #CARGS += -ffunction-sections
  36. ifeq ($(DEBUG),1)
  37. CARGS += -DDEBUG
  38. endif
  39. #LINKER = -Wl,--relax
  40. #PROGRAMMER = avrisp2
  41. #ISPPORT = usb
  42. PROGRAMMER = arduino
  43. ISPPORT = /dev/tty.usbserial-A100OZQ1
  44. ISPBAUD = 57600
  45. TARGET = rx
  46. all: $(BUILDDIR)/$(TARGET).hex
  47. debug:
  48. $(MAKE) BUILDDIR=build/debug TARGET=debug MCU=atmega328 DEBUG=1 all
  49. $(BUILDDIR)/%.o: %.c
  50. @$(MKDIR) $(BUILDDIR)/$(dir $<)
  51. $(GCC) -c $< -o $@ $(CARGS)
  52. $(BUILDDIR)/$(TARGET).elf: $(OBJ)
  53. $(GCC) $(CARGS) $(OBJ) --output $@ $(LINKER) -Wl,-Map -Wl,$(@:.elf=.map)
  54. $(SIZE) $@
  55. $(BUILDDIR)/$(TARGET).hex: $(BUILDDIR)/$(TARGET).elf
  56. $(OBJCOPY) -O ihex $< $@
  57. $(OBJDUMP) -h -S $< > $(@:.hex=.lss)
  58. program: $(BUILDDIR)/$(TARGET).hex
  59. $(AVRDUDE) -p $(MCU) -c $(PROGRAMMER) -b $(ISPBAUD) -P $(ISPPORT) -e -D -U $(BUILDDIR)/$(TARGET).hex
  60. debugProgram:
  61. $(MAKE) BUILDDIR=build/debug TARGET=debug MCU=atmega328p DEBUG=1 program
  62. clean:
  63. $(RM) $(BUILDDIR)