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.

210 lines
4.2 KiB

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