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.

182 lines
3.7 KiB

  1. MCU = cortex-m3 ;
  2. CHIP = STM32F103ZE ;
  3. BOARD = maple_native ;
  4. #CHIP = at91sam3u4 ;
  5. #BOARD = sam3u-ek ;
  6. if ! $(TOOLSET)
  7. {
  8. TOOLSET = devkit ;
  9. Echo "Assuming TOOLSET=devkit" ;
  10. }
  11. if $(TOOLSET) = yagarto
  12. {
  13. TOOLS_PATH = ~/Source/yagarto-4.6.2/bin ;
  14. TOOLS_ARCH = arm-none-eabi- ;
  15. }
  16. if $(TOOLSET) = yagarto-install
  17. {
  18. TOOLS_PATH = ~/Source/yagarto/install/bin ;
  19. TOOLS_ARCH = arm-none-eabi- ;
  20. }
  21. else if $(TOOLSET) = devkit
  22. {
  23. TOOLS_PATH = /opt/devkitARM/bin ;
  24. TOOLS_ARCH = arm-eabi- ;
  25. }
  26. else if $(TOOLSET) = maple
  27. {
  28. TOOLS_PATH = /opt/Maple/Resources/Java/hardware/tools/arm/bin ;
  29. TOOLS_ARCH = arm-none-eabi- ;
  30. }
  31. else if $(TOOLSET) = ports
  32. {
  33. TOOLS_PATH = /opt/local/bin ;
  34. TOOLS_ARCH = arm-none-eabi- ;
  35. }
  36. CC = $(TOOLS_PATH)/$(TOOLS_ARCH)gcc ;
  37. C++ = $(TOOLS_PATH)/$(TOOLS_ARCH)g++ ;
  38. AS = $(TOOLS_PATH)/$(TOOLS_ARCH)gcc -c ;
  39. LINK = $(TOOLS_PATH)/$(TOOLS_ARCH)g++ ;
  40. OBJCOPY = $(TOOLS_PATH)/$(TOOLS_ARCH)objcopy ;
  41. DFU = dfu-util ;
  42. DEFINES += VECT_TAB_FLASH BOARD_$(BOARD) MCU_$(CHIP) ERROR_LED_PORT=GPIOC ERROR_LED_PIN=15 STM32_HIGH_DENSITY MAPLE_IDE ;
  43. OPTIM = -Os ;
  44. MFLAGS = cpu=$(MCU) thumb arch=armv7-m ;
  45. CCFLAGS = -Wall -m$(MFLAGS) -g -nostdlib -ffunction-sections -fdata-sections -Wl,--gc-sections ;
  46. C++FLAGS = $(CCFLAGS) -fno-rtti -fno-exceptions ;
  47. LINKFLAGS += -m$(MFLAGS) -Xlinker --gc-sections ;
  48. DFUFLAGS = -a1 -d 0x1eaf:0x0003 -R ;
  49. MAPLE_DIR = $(HOME)/Source/SAM3U/libmaple ;
  50. MAPLE_LIBS = Servo LiquidCrystal Wire FreeRTOS ;
  51. MAPLE_SUBDIRS = wirish wirish/comm wirish/boards libmaple libmaple/usb libmaple/usb/usb_lib ;
  52. SKETCH_DIR = $(HOME)/Source/Arduino ;
  53. SKETCH_LIBS = RF24 ;
  54. MODULE_DIRS = . $(MAPLE_DIR)/$(MAPLE_SUBDIRS) $(MAPLE_DIR)/libraries/$(MAPLE_LIBS) $(SKETCH_DIR)/libraries/$(SKETCH_LIBS) ;
  55. HDRS = $(MODULE_DIRS) ;
  56. LOCATE_TARGET = out/$(TOOLSET) ;
  57. LOCATE_SOURCE = $(LOCATE_TARGET) ;
  58. rule Pde
  59. {
  60. Depends $(<) : $(>) ;
  61. MakeLocate $(<) : $(LOCATE_SOURCE) ;
  62. Clean clean : $(<) ;
  63. }
  64. if ( $(ARDUINO_VERSION) < 100 )
  65. {
  66. ARDUINO_H = WProgram.h ;
  67. }
  68. else
  69. {
  70. ARDUINO_H = Arduino.h ;
  71. }
  72. actions Pde
  73. {
  74. echo "#include <$(ARDUINO_H)>" > $(<)
  75. echo "#line 1 \"$(>)\"" >> $(<)
  76. cat $(>) >> $(<)
  77. }
  78. rule C++Pde
  79. {
  80. local _CPP = $(>:B).cpp ;
  81. Pde $(_CPP) : $(>) ;
  82. C++ $(<) : $(_CPP) ;
  83. }
  84. rule Hex
  85. {
  86. Depends $(<) : $(>) ;
  87. MakeLocate $(<) : $(LOCATE_TARGET) ;
  88. Depends hex : $(<) ;
  89. Clean clean : $(<) ;
  90. }
  91. actions Hex
  92. {
  93. $(OBJCOPY) -O ihex $(>) $(<)
  94. }
  95. rule Binary
  96. {
  97. Depends $(<) : $(>) ;
  98. MakeLocate $(<) : $(LOCATE_TARGET) ;
  99. Depends binary : $(<) ;
  100. Clean clean : $(<) ;
  101. }
  102. actions Binary
  103. {
  104. $(OBJCOPY) -O binary $(>) $(<)
  105. }
  106. rule UserObject
  107. {
  108. switch $(>:S)
  109. {
  110. case .S : As $(<) : $(>) ;
  111. case .ino : C++Pde $(<) : $(>) ;
  112. case .pde : C++Pde $(<) : $(>) ;
  113. }
  114. }
  115. rule Upload
  116. {
  117. Depends up : $(<) ;
  118. NotFile up ;
  119. Always $(<) ;
  120. Always up ;
  121. }
  122. actions Upload
  123. {
  124. $(DFU) $(DFUFLAGS) -D $(<)
  125. }
  126. # Override base objects rule, so all output can go in the output dir
  127. rule Objects
  128. {
  129. local _i ;
  130. for _i in [ FGristFiles $(<) ]
  131. {
  132. local _b = $(_i:B)$(SUFOBJ) ;
  133. local _o = $(_b:G=$(SOURCE_GRIST:E)) ;
  134. Object $(_o) : $(_i) ;
  135. Depends obj : $(_o) ;
  136. }
  137. }
  138. # Override base main rule, so all output can go in the output dir
  139. rule Main
  140. {
  141. MainFromObjects $(<) : $(>:B)$(SUFOBJ) ;
  142. Objects $(>) ;
  143. }
  144. # Modules
  145. MODULES = [ GLOB $(MODULE_DIRS) : *.pde *.c *.cpp *.S ] ;
  146. # Main output executable
  147. MAIN = $(PWD:B).elf ;
  148. # Linker script
  149. LINK_DIR = $(MAPLE_DIR)/support/ld ;
  150. LINKSCRIPT = $(LINK_DIR)/$(BOARD)/flash.ld ;
  151. # Bring in the map and link script
  152. LINKFLAGS += -Wl,-Map=$(LOCATE_TARGET)/$(MAIN:B).map -T$(LINKSCRIPT) -L$(LINK_DIR) ;
  153. Main $(MAIN) : $(MODULES) ;
  154. Binary $(MAIN:B).bin : $(MAIN) ;
  155. Upload $(MAIN:B).bin ;