Ein Roboter mit bürstenlosem Antrieb, differenzial und NRF24L01 Funk. Großflächig gebaut um ein großes Solarpanel aufzunehmen. https://gitlab.informatik.hs-fulda.de/fdai5253/roboter
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.

219 lines
4.4 KiB

  1. # (1) Project Information
  2. PROJECT_LIBS = RF24 SPI ;
  3. PROJECT_DIRS = $(PWD) ;
  4. # (2) Board Information
  5. UPLOAD_PROTOCOL ?= stk500v1 ;
  6. UPLOAD_SPEED ?= 115200 ;
  7. MCU ?= atmega328p ;
  8. F_CPU ?= 16000000 ;
  9. CORE ?= arduino ;
  10. VARIANT ?= standard ;
  11. ARDUINO_VERSION ?= 100 ;
  12. # (3) USB Ports
  13. PORTS = p4 p6 p9 u0 u1 u2 ;
  14. PORT_p6 = /dev/tty.usbserial-A600eHIs ;
  15. PORT_p4 = /dev/tty.usbserial-A40081RP ;
  16. PORT_p9 = /dev/tty.usbserial-A9007LmI ;
  17. PORT_u0 = /dev/ttyUSB0 ;
  18. PORT_u1 = /dev/ttyUSB1 ;
  19. PORT_u2 = /dev/ttyUSB2 ;
  20. # (4) Location of AVR tools
  21. #
  22. # This configuration assumes using avr-tools that were obtained separate from the Arduino
  23. # distribution.
  24. if $(OS) = MACOSX
  25. {
  26. AVR_BIN = /usr/local/avrtools/bin ;
  27. AVR_ETC = /usr/local/avrtools/etc ;
  28. AVR_INCLUDE = /usr/local/avrtools/include ;
  29. }
  30. else
  31. {
  32. AVR_BIN = /usr/bin ;
  33. AVR_INCLUDE = /usr/lib/avr/include ;
  34. AVR_ETC = /etc ;
  35. }
  36. # (5) Directories where Arduino core and libraries are located
  37. ARDUINO_DIR ?= /opt/Arduino ;
  38. ARDUINO_CORE = $(ARDUINO_DIR)/hardware/arduino/cores/$(CORE) $(ARDUINO_DIR)/hardware/arduino/variants/$(VARIANT) ;
  39. ARDUINO_LIB = $(ARDUINO_DIR)/libraries ;
  40. SKETCH_LIB = $(HOME)/Source/Arduino/libraries ;
  41. #
  42. # --------------------------------------------------
  43. # Below this line usually never needs to be modified
  44. #
  45. # Tool locations
  46. CC = $(AVR_BIN)/avr-gcc ;
  47. C++ = $(AVR_BIN)/avr-g++ ;
  48. LINK = $(AVR_BIN)/avr-gcc ;
  49. AR = $(AVR_BIN)/avr-ar rcs ;
  50. RANLIB = ;
  51. OBJCOPY = $(AVR_BIN)/avr-objcopy ;
  52. AVRDUDE = $(AVR_BIN)/avrdude ;
  53. # Flags
  54. DEFINES += F_CPU=$(F_CPU)L ARDUINO=$(ARDUINO_VERSION) VERSION_H ;
  55. OPTIM = -Os ;
  56. CCFLAGS = -Wall -Wextra -Wno-strict-aliasing -mmcu=$(MCU) -ffunction-sections -fdata-sections ;
  57. C++FLAGS = $(CCFLAGS) -fno-exceptions -fno-strict-aliasing ;
  58. LINKFLAGS = $(OPTIM) -lm -Wl,--gc-sections -mmcu=$(MCU) ;
  59. AVRDUDEFLAGS = -V -F -D -C $(AVR_ETC)/avrdude.conf -p $(MCU) -c $(UPLOAD_PROTOCOL) -b $(UPLOAD_SPEED) ;
  60. # Search everywhere for headers
  61. HDRS = $(PROJECT_DIRS) $(AVR_INCLUDE) $(ARDUINO_CORE) $(ARDUINO_LIB)/$(PROJECT_LIBS) $(ARDUINO_LIB)/$(PROJECT_LIBS)/utility $(SKETCH_LIB)/$(PROJECT_LIBS) ;
  62. # Output locations
  63. LOCATE_TARGET = $(F_CPU) ;
  64. LOCATE_SOURCE = $(F_CPU) ;
  65. #
  66. # Custom rules
  67. #
  68. rule GitVersion
  69. {
  70. Always $(<) ;
  71. Depends all : $(<) ;
  72. }
  73. actions GitVersion
  74. {
  75. echo "const char program_version[] = \"\\" > $(<)
  76. git log -1 --pretty=format:%h >> $(<)
  77. echo "\";" >> $(<)
  78. }
  79. GitVersion version.h ;
  80. rule Pde
  81. {
  82. Depends $(<) : $(>) ;
  83. MakeLocate $(<) : $(LOCATE_SOURCE) ;
  84. Clean clean : $(<) ;
  85. }
  86. if ( $(ARDUINO_VERSION) < 100 )
  87. {
  88. ARDUINO_H = WProgram.h ;
  89. }
  90. else
  91. {
  92. ARDUINO_H = Arduino.h ;
  93. }
  94. actions Pde
  95. {
  96. echo "#include <$(ARDUINO_H)>" > $(<)
  97. echo "#line 1 \"$(>)\"" >> $(<)
  98. cat $(>) >> $(<)
  99. }
  100. rule C++Pde
  101. {
  102. local _CPP = $(>:B).cpp ;
  103. Pde $(_CPP) : $(>) ;
  104. C++ $(<) : $(_CPP) ;
  105. }
  106. rule UserObject
  107. {
  108. switch $(>:S)
  109. {
  110. case .ino : C++Pde $(<) : $(>) ;
  111. case .pde : C++Pde $(<) : $(>) ;
  112. }
  113. }
  114. rule Objects
  115. {
  116. local _i ;
  117. for _i in [ FGristFiles $(<) ]
  118. {
  119. local _b = $(_i:B)$(SUFOBJ) ;
  120. local _o = $(_b:G=$(SOURCE_GRIST:E)) ;
  121. Object $(_o) : $(_i) ;
  122. Depends obj : $(_o) ;
  123. }
  124. }
  125. rule Library
  126. {
  127. LibraryFromObjects $(<) : $(>:B)$(SUFOBJ) ;
  128. Objects $(>) ;
  129. }
  130. rule Main
  131. {
  132. MainFromObjects $(<) : $(>:B)$(SUFOBJ) ;
  133. Objects $(>) ;
  134. }
  135. rule Hex
  136. {
  137. Depends $(<) : $(>) ;
  138. MakeLocate $(<) : $(LOCATE_TARGET) ;
  139. Depends hex : $(<) ;
  140. Clean clean : $(<) ;
  141. }
  142. actions Hex
  143. {
  144. $(OBJCOPY) -O ihex -R .eeprom $(>) $(<)
  145. }
  146. rule Upload
  147. {
  148. Depends $(1) : $(2) ;
  149. Depends $(2) : $(3) ;
  150. NotFile $(1) ;
  151. Always $(1) ;
  152. Always $(2) ;
  153. UploadAction $(2) : $(3) ;
  154. }
  155. actions UploadAction
  156. {
  157. $(AVRDUDE) $(AVRDUDEFLAGS) -P $(<) $(AVRDUDE_WRITE_FLASH) -U flash:w:$(>):i
  158. }
  159. rule Arduino
  160. {
  161. LINKFLAGS on $(<) = $(LINKFLAGS) -Wl,-Map=$(LOCATE_TARGET)/$(<:B).map ;
  162. Main $(<) : $(>) ;
  163. LinkLibraries $(<) : libs core ;
  164. Hex $(<:B).hex : $(<) ;
  165. for _p in $(PORTS)
  166. {
  167. Upload $(_p) : $(PORT_$(_p)) : $(<:B).hex ;
  168. }
  169. }
  170. #
  171. # Targets
  172. #
  173. # Grab everything from the core directory
  174. Library core : [ GLOB $(ARDUINO_CORE) : *.c *.cpp ] ;
  175. # Grab everything from libraries. To avoid this "grab everything" behaviour, you
  176. # can specify specific modules to pick up in PROJECT_MODULES
  177. Library libs : [ GLOB $(ARDUINO_LIB)/$(PROJECT_LIBS) $(ARDUINO_LIB)/$(PROJECT_LIBS)/utility $(SKETCH_LIB)/$(PROJECT_LIBS) : *.cpp *.c ] ;
  178. # Main output executable
  179. Arduino $(PWD:B).elf : $(PROJECT_MODULES) [ GLOB $(PROJECT_DIRS) : *.c *.cpp *.pde *.ino ] ;