Naze32 clone with Frysky receiver
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

makefile 2.1KB

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