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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. ISPBAUD = 57600
  43. TARGET = rx
  44. all: $(BUILDDIR)/$(TARGET).hex
  45. debug:
  46. $(MAKE) BUILDDIR=build/debug TARGET=debug MCU=atmega328 DEBUG=1 all
  47. $(BUILDDIR)/%.o: %.c
  48. @$(MKDIR) $(BUILDDIR)/$(dir $<)
  49. $(GCC) -c $< -o $@ $(CARGS)
  50. $(BUILDDIR)/$(TARGET).elf: $(OBJ)
  51. $(GCC) $(CARGS) $(OBJ) --output $@ $(LINKER) -Wl,-Map -Wl,$(@:.elf=.map)
  52. $(SIZE) $@
  53. $(BUILDDIR)/$(TARGET).hex: $(BUILDDIR)/$(TARGET).elf
  54. $(OBJCOPY) -O ihex $< $@
  55. $(OBJDUMP) -h -S $< > $(@:.hex=.lss)
  56. program: $(BUILDDIR)/$(TARGET).hex
  57. $(AVRDUDE) -p $(MCU) -c $(PROGRAMMER) -b $(ISPBAUD) -P $(ISPPORT) -e -D -U $(BUILDDIR)/$(TARGET).hex
  58. debugProgram:
  59. $(MAKE) BUILDDIR=build/debug TARGET=debug MCU=atmega328p DEBUG=1 program
  60. clean:
  61. $(RM) $(BUILDDIR)