Guest User

makefile arduino

a guest
Mar 13th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 16.45 KB | None | 0 0
  1. ########################################################################
  2. #
  3. # Arduino command line tools Makefile
  4. # System part (i.e. project independent)
  5. #
  6. # Copyright (C) 2010,2011,2012 Martin Oldfield <[email protected]>, based on
  7. # work that is copyright Nicholas Zambetti, David A. Mellis & Hernando
  8. # Barragan.
  9. #
  10. # This file is free software; you can redistribute it and/or modify it
  11. # under the terms of the GNU Lesser General Public License as
  12. # published by the Free Software Foundation; either version 2.1 of the
  13. # License, or (at your option) any later version.
  14. #
  15. # Adapted from Arduino 0011 Makefile by M J Oldfield
  16. #
  17. # Original Arduino adaptation by mellis, eighthave, oli.keller
  18. #
  19. # Version 0.1  17.ii.2009  M J Oldfield
  20. #
  21. #         0.2  22.ii.2009  M J Oldfield
  22. #                          - fixes so that the Makefile actually works!
  23. #                          - support for uploading via ISP
  24. #                          - orthogonal choices of using the Arduino for
  25. #                            tools, libraries and uploading
  26. #
  27. #         0.3  21.v.2010   M J Oldfield
  28. #                          - added proper license statement
  29. #                          - added code from Philip Hands to reset
  30. #                            Arduino prior to upload
  31. #
  32. #         0.4  25.v.2010   M J Oldfield
  33. #                          - tweaked reset target on Philip Hands' advice
  34. #
  35. #         0.5  23.iii.2011 Stefan Tomanek
  36. #                          - added ad-hoc library building
  37. #              17.v.2011   M J Oldfield
  38. #                          - grabbed said version from Ubuntu
  39. #
  40. #         0.6  22.vi.2011  M J Oldfield
  41. #                          - added ard-parse-boards supports
  42. #                          - added -lc to linker opts,
  43. #                            on Fabien Le Lez's advice
  44. #
  45. #         0.7  12.vii.2011 M J Oldfield
  46. #                          - moved -lm to the end of linker opts,
  47. #                        to solve Frank Knopf's problem;
  48. #                          - added -F to stty opts: Craig Hollabaugh
  49. #                        reckons it's good for Ubuntu
  50. #
  51. #         0.8  12.ii.2012  M J Oldfield
  52. #                          - Patches for Arduino 1.0 IDE:
  53. #                              support .ino files;
  54. #                              handle board 'variants';
  55. #                              tweaked compile flags.
  56. #                          - Build a library from all the system
  57. #                            supplied code rather than linking the .o
  58. #                            files directly.
  59. #                          - Let TARGET default to current directory
  60. #                as per Daniele Vergini's patch.
  61. #                          - Add support for .c files in system
  62. #                            libraries: Dirk-Willem van Gulik and Evan
  63. #                            Goldenberg both reported this and
  64. #                            provided patches in the same spirit.
  65. #
  66. ########################################################################
  67. #
  68. # STANDARD ARDUINO WORKFLOW
  69. #
  70. # Given a normal sketch directory, all you need to do is to create
  71. # a small Makefile which defines a few things, and then includes this one.
  72. #
  73. # For example:
  74. #
  75. #       ARDUINO_DIR  = /usr/share/arduino
  76. #
  77. #       TARGET       = CLItest
  78. #       ARDUINO_LIBS = Ethernet Ethernet/utility SPI
  79. #
  80. #       BOARD_TAG    = uno
  81. #       ARDUINO_PORT = /dev/cu.usb*
  82. #
  83. #       include /usr/share/arduino/Arduino.mk
  84. #
  85. # Hopefully these will be self-explanatory but in case they're not:
  86. #
  87. #    ARDUINO_DIR  - Where the Arduino software has been unpacked
  88. #
  89. #    TARGET       - The basename used for the final files. Canonically
  90. #                   this would match the .pde file, but it's not needed
  91. #                   here: you could always set it to xx if you wanted!
  92. #
  93. #    ARDUINO_LIBS - A list of any libraries used by the sketch (we
  94. #                   assume these are in
  95. #                   $(ARDUINO_DIR)/hardware/libraries
  96. #
  97. #    ARDUINO_PORT - The port where the Arduino can be found (only needed
  98. #                   when uploading
  99. #
  100. #    BOARD_TAG    - The ard-parse-boards tag for the board e.g. uno or mega
  101. #                   'make show_boards' shows a list
  102. #
  103. # You might also want to specify these, but normally they'll be read from the
  104. # boards.txt file i.e. implied by BOARD_TAG
  105. #
  106. #    MCU,F_CPU    - The target processor description
  107. #
  108. # Once this file has been created the typical workflow is just
  109. #
  110. #   $ make upload
  111. #
  112. # All of the object files are created in the build-cli subdirectory
  113. # All sources should be in the current directory and can include:
  114. #  - at most one .pde or .ino file which will be treated as C++ after
  115. #    the standard Arduino header and footer have been affixed.
  116. #  - any number of .c, .cpp, .s and .h files
  117. #
  118. # Included libraries are built in the build-cli/libs subdirectory.
  119. #
  120. # Besides make upload you can also
  121. #   make             - no upload
  122. #   make clean       - remove all our dependencies
  123. #   make depends     - update dependencies
  124. #   make reset       - reset the Arduino by tickling DTR on the serial port
  125. #   make raw_upload  - upload without first resetting
  126. #   make show_boards - list all the boards defined in boards.txt
  127. #
  128. ########################################################################
  129. #
  130. # ARDUINO WITH OTHER TOOLS
  131. #
  132. # If the tools aren't in the Arduino distribution, then you need to
  133. # specify their location:
  134. #
  135. #    AVR_TOOLS_PATH = /usr/bin
  136. #    AVRDUDE_CONF   = /etc/avrdude/avrdude.conf
  137. #
  138. ########################################################################
  139. #
  140. # ARDUINO WITH ISP
  141. #
  142. # You need to specify some details of your ISP programmer and might
  143. # also need to specify the fuse values:
  144. #
  145. #     ISP_PROG     = -c stk500v2
  146. #     ISP_PORT     = /dev/ttyACM0
  147. #
  148. # You might also need to set the fuse bits, but typically they'll be
  149. # read from boards.txt, based on the BOARD_TAG variable:
  150. #    
  151. #     ISP_LOCK_FUSE_PRE  = 0x3f
  152. #     ISP_LOCK_FUSE_POST = 0xcf
  153. #     ISP_HIGH_FUSE      = 0xdf
  154. #     ISP_LOW_FUSE       = 0xff
  155. #     ISP_EXT_FUSE       = 0x01
  156. #
  157. # I think the fuses here are fine for uploading to the ATmega168
  158. # without bootloader.
  159. #
  160. # To actually do this upload use the ispload target:
  161. #
  162. #    make ispload
  163. #
  164. #
  165. ########################################################################
  166.  
  167. ########################################################################
  168. #
  169. # Default TARGET to cwd (ex Daniele Vergini)
  170. ifndef TARGET
  171. TARGET  = $(notdir $(CURDIR))
  172. endif
  173.  
  174. ########################################################################
  175.  
  176. #
  177. # Arduino version number
  178. ifndef ARDUINO_VERSION
  179. ARDUINO_VERSION = 100
  180. endif
  181.  
  182. #
  183. # Some paths
  184. #
  185.  
  186. ifneq (ARDUINO_DIR,)
  187.  
  188. ifndef AVR_TOOLS_PATH
  189. AVR_TOOLS_PATH    = /usr/bin
  190. endif
  191.  
  192. ifndef ARDUINO_ETC_PATH
  193. ARDUINO_ETC_PATH  = /etc
  194. endif
  195.  
  196. ifndef AVRDUDE_CONF
  197. AVRDUDE_CONF     = $(ARDUINO_ETC_PATH)/avrdude.conf
  198. endif
  199.  
  200. ARDUINO_LIB_PATH  = $(ARDUINO_DIR)/libraries
  201. ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
  202. ARDUINO_VAR_PATH  = $(ARDUINO_DIR)/hardware/arduino/variants
  203.  
  204. ifndef ARDUINO_SKETCHBOOK
  205. ARDUINO_SKETCHBOOK = $(HOME)/sketchbook
  206. endif
  207.  
  208. ifndef USER_LIB_PATH
  209. USER_LIB_PATH = $(ARDUINO_SKETCHBOOK)/libraries
  210. endif
  211.  
  212. endif
  213.  
  214. ########################################################################
  215. # boards.txt parsing
  216. #
  217. ifndef BOARD_TAG
  218. BOARD_TAG   = uno
  219. endif
  220.  
  221. ifndef BOARDS_TXT
  222. BOARDS_TXT  = $(ARDUINO_DIR)/hardware/arduino/boards.txt
  223. endif
  224.  
  225. ifndef PARSE_BOARD
  226. PARSE_BOARD = ard-parse-boards --boards_txt=$(BOARDS_TXT)
  227. endif
  228.  
  229. # Which variant ? This affects the include path
  230. ifndef VARIANT
  231. VARIANT = $(shell $(PARSE_BOARD) $(BOARD_TAG) build.variant)
  232. endif
  233.  
  234. # processor stuff
  235. ifndef MCU
  236. MCU   = $(shell $(PARSE_BOARD) $(BOARD_TAG) build.mcu)
  237. endif
  238.  
  239. ifndef F_CPU
  240. F_CPU = $(shell $(PARSE_BOARD) $(BOARD_TAG) build.f_cpu)
  241. endif
  242.  
  243. # normal programming info
  244. ifndef AVRDUDE_ARD_PROGRAMMER
  245. AVRDUDE_ARD_PROGRAMMER = $(shell $(PARSE_BOARD) $(BOARD_TAG) upload.protocol)
  246. endif
  247.  
  248. ifndef AVRDUDE_ARD_BAUDRATE
  249. AVRDUDE_ARD_BAUDRATE   = $(shell $(PARSE_BOARD) $(BOARD_TAG) upload.speed)
  250. endif
  251.  
  252. # fuses if you're using e.g. ISP
  253. ifndef ISP_LOCK_FUSE_PRE
  254. ISP_LOCK_FUSE_PRE  = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.unlock_bits)
  255. endif
  256.  
  257. ifndef ISP_LOCK_FUSE_POST
  258. ISP_LOCK_FUSE_POST = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.lock_bits)
  259. endif
  260.  
  261. ifndef ISP_HIGH_FUSE
  262. ISP_HIGH_FUSE      = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.high_fuses)
  263. endif
  264.  
  265. ifndef ISP_LOW_FUSE
  266. ISP_LOW_FUSE       = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.low_fuses)
  267. endif
  268.  
  269. ifndef ISP_EXT_FUSE
  270. ISP_EXT_FUSE       = $(shell $(PARSE_BOARD) $(BOARD_TAG) bootloader.extended_fuses)
  271. endif
  272.  
  273. # Everything gets built in here
  274. OBJDIR        = build-cli
  275.  
  276. ########################################################################
  277. # Local sources
  278. #
  279. LOCAL_C_SRCS    = $(wildcard *.c)
  280. LOCAL_CPP_SRCS  = $(wildcard *.cpp)
  281. LOCAL_CC_SRCS   = $(wildcard *.cc)
  282. LOCAL_PDE_SRCS  = $(wildcard *.pde)
  283. LOCAL_INO_SRCS  = $(wildcard *.ino)
  284. LOCAL_AS_SRCS   = $(wildcard *.S)
  285. LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o)   $(LOCAL_CPP_SRCS:.cpp=.o) \
  286.         $(LOCAL_CC_SRCS:.cc=.o)   $(LOCAL_PDE_SRCS:.pde=.o) \
  287.         $(LOCAL_INO_SRCS:.ino=.o) $(LOCAL_AS_SRCS:.S=.o)
  288. LOCAL_OBJS      = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
  289.  
  290. # Dependency files
  291. DEPS            = $(LOCAL_OBJS:.o=.d)
  292.  
  293. # core sources
  294. ifeq ($(strip $(NO_CORE)),)
  295. ifdef ARDUINO_CORE_PATH
  296. CORE_C_SRCS     = $(wildcard $(ARDUINO_CORE_PATH)/*.c)
  297. CORE_CPP_SRCS   = $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
  298. CORE_OBJ_FILES  = $(CORE_C_SRCS:.c=.o) $(CORE_CPP_SRCS:.cpp=.o)
  299. CORE_OBJS       = $(patsubst $(ARDUINO_CORE_PATH)/%,  \
  300.             $(OBJDIR)/%,$(CORE_OBJ_FILES))
  301. endif
  302. endif
  303.  
  304.  
  305. ########################################################################
  306. # Rules for making stuff
  307. #
  308.  
  309. # The name of the main targets
  310. TARGET_HEX = $(OBJDIR)/$(TARGET).hex
  311. TARGET_ELF = $(OBJDIR)/$(TARGET).elf
  312. TARGETS    = $(OBJDIR)/$(TARGET).*
  313. CORE_LIB   = $(OBJDIR)/libcore.a
  314.  
  315. # A list of dependencies
  316. DEP_FILE   = $(OBJDIR)/depends.mk
  317.  
  318. # Names of executables
  319. CC      = $(AVR_TOOLS_PATH)/avr-gcc
  320. CXX     = $(AVR_TOOLS_PATH)/avr-g++
  321. OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy
  322. OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump
  323. AR      = $(AVR_TOOLS_PATH)/avr-ar
  324. SIZE    = $(AVR_TOOLS_PATH)/avr-size
  325. NM      = $(AVR_TOOLS_PATH)/avr-nm
  326. REMOVE  = rm -f
  327. MV      = mv -f
  328. CAT     = cat
  329. ECHO    = echo
  330.  
  331. # General arguments
  332. SYS_LIBS      = $(patsubst %,$(ARDUINO_LIB_PATH)/%,$(ARDUINO_LIBS))
  333. USER_LIBS     = $(patsubst %,$(USER_LIB_PATH)/%,$(ARDUINO_LIBS))
  334. SYS_INCLUDES  = $(patsubst %,-I%,$(SYS_LIBS)) $(patsubst %,-I%,$(USER_LIBS))
  335. LIB_C_SRCS    = $(wildcard $(patsubst %,%/*.c,$(SYS_LIBS)))
  336. LIB_CPP_SRCS  = $(wildcard $(patsubst %,%/*.cpp,$(SYS_LIBS)))
  337. USER_LIB_CPP_SRC   = $(wildcard $(patsubst %,%/*.cpp,$(USER_LIBS)))
  338. USER_LIB_C_SRC     = $(wildcard $(patsubst %,%/*.c,$(USER_LIBS)))
  339. LIB_OBJS      = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(LIB_C_SRCS)) \
  340.         $(patsubst $(ARDUINO_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(LIB_CPP_SRCS)) \
  341.         $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(USER_LIB_CPP_SRCS)) \
  342.         $(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(USER_LIB_C_SRCS))
  343.  
  344.  
  345. CPPFLAGS      = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \
  346.             -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \
  347.             $(SYS_INCLUDES) -g -Os -w -Wall \
  348.             -ffunction-sections -fdata-sections
  349. CFLAGS        = -std=gnu99
  350. CXXFLAGS      = -fno-exceptions
  351. ASFLAGS       = -mmcu=$(MCU) -I. -x assembler-with-cpp
  352. LDFLAGS       = -mmcu=$(MCU) -Wl,--gc-sections -Os
  353.  
  354. # Expand and pick the first port
  355. ARD_PORT      = $(firstword $(wildcard $(ARDUINO_PORT)))
  356.  
  357. # Implicit rules for building everything (needed to get everything in
  358. # the right directory)
  359. #
  360. # Rather than mess around with VPATH there are quasi-duplicate rules
  361. # here for building e.g. a system C++ file and a local C++
  362. # file. Besides making things simpler now, this would also make it
  363. # easy to change the build options in future
  364.  
  365. # library sources
  366. $(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.c
  367.     mkdir -p $(dir $@)
  368.     $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
  369.  
  370. $(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp
  371.     mkdir -p $(dir $@)
  372.     $(CC) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
  373.  
  374. $(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.cpp
  375.     mkdir -p $(dir $@)
  376.     $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
  377.  
  378. $(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.c
  379.     mkdir -p $(dir $@)
  380.     $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
  381.  
  382. # normal local sources
  383. # .o rules are for objects, .d for dependency tracking
  384. # there seems to be an awful lot of duplication here!!!
  385. $(OBJDIR)/%.o: %.c
  386.     $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
  387.  
  388. $(OBJDIR)/%.o: %.cc
  389.     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
  390.  
  391. $(OBJDIR)/%.o: %.cpp
  392.     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
  393.  
  394. $(OBJDIR)/%.o: %.S
  395.     $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
  396.  
  397. $(OBJDIR)/%.o: %.s
  398.     $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
  399.  
  400. $(OBJDIR)/%.d: %.c
  401.     $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< -MF $@ -MT $(@:.d=.o)
  402.  
  403. $(OBJDIR)/%.d: %.cc
  404.     $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
  405.  
  406. $(OBJDIR)/%.d: %.cpp
  407.     $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
  408.  
  409. $(OBJDIR)/%.d: %.S
  410.     $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
  411.  
  412. $(OBJDIR)/%.d: %.s
  413.     $(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
  414.  
  415. # the pde -> cpp -> o file
  416. $(OBJDIR)/%.cpp: %.pde
  417.     $(ECHO) '#include "WProgram.h"' > $@
  418.     $(CAT)  $< >> $@
  419.  
  420. # the ino -> cpp -> o file
  421. $(OBJDIR)/%.cpp: %.ino
  422.     $(ECHO) '#include <Arduino.h>' > $@
  423.     $(CAT)  $< >> $@
  424.  
  425. $(OBJDIR)/%.o: $(OBJDIR)/%.cpp
  426.     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
  427.  
  428. $(OBJDIR)/%.d: $(OBJDIR)/%.cpp
  429.     $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< -MF $@ -MT $(@:.d=.o)
  430.  
  431. # core files
  432. $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c
  433.     $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
  434.  
  435. $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp
  436.     $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
  437.  
  438. # various object conversions
  439. $(OBJDIR)/%.hex: $(OBJDIR)/%.elf
  440.     $(OBJCOPY) -O ihex -R .eeprom $< $@
  441.  
  442. $(OBJDIR)/%.eep: $(OBJDIR)/%.elf
  443.     -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  444.         --change-section-lma .eeprom=0 -O ihex $< $@
  445.  
  446. $(OBJDIR)/%.lss: $(OBJDIR)/%.elf
  447.     $(OBJDUMP) -h -S $< > $@
  448.  
  449. $(OBJDIR)/%.sym: $(OBJDIR)/%.elf
  450.     $(NM) -n $< > $@
  451.  
  452. ########################################################################
  453. #
  454. # Avrdude
  455. #
  456. ifndef AVRDUDE
  457. AVRDUDE          = $(AVR_TOOLS_PATH)/avrdude
  458. endif
  459.  
  460. AVRDUDE_COM_OPTS = -q -V -p $(MCU)
  461. ifdef AVRDUDE_CONF
  462. AVRDUDE_COM_OPTS += -C $(AVRDUDE_CONF)
  463. endif
  464.  
  465. AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(ARD_PORT) $(AVRDUDE_ARD_EXTRAOPTS)
  466.  
  467. ifndef ISP_PROG
  468. ISP_PROG       = -c stk500v2
  469. endif
  470.  
  471. AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG)
  472.  
  473.  
  474. ########################################################################
  475. #
  476. # Explicit targets start here
  477. #
  478.  
  479. all:        $(OBJDIR) $(TARGET_HEX)
  480.  
  481. $(OBJDIR):
  482.         mkdir $(OBJDIR)
  483.  
  484. $(TARGET_ELF):  $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
  485.         $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm
  486.  
  487. $(CORE_LIB):    $(CORE_OBJS) $(LIB_OBJS)
  488.         $(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS)
  489.  
  490. $(DEP_FILE):    $(OBJDIR) $(DEPS)
  491.         cat $(DEPS) > $(DEP_FILE)
  492.  
  493. upload:     reset raw_upload
  494.  
  495. raw_upload: $(TARGET_HEX)
  496.         $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
  497.             -U flash:w:$(TARGET_HEX):i
  498.  
  499. # BSD stty likes -F, but GNU stty likes -f/--file.  Redirecting
  500. # stdin/out appears to work but generates a spurious error on MacOS at
  501. # least. Perhaps it would be better to just do it in perl ?
  502. reset:     
  503.         for STTYF in 'stty -F' 'stty --file' 'stty -f' 'stty <' ; \
  504.           do $$STTYF /dev/tty >/dev/null 2>&1 && break ; \
  505.         done ; \
  506.         $$STTYF $(ARD_PORT)  hupcl ; \
  507.         (sleep 0.1 2>/dev/null || sleep 1) ; \
  508.         $$STTYF $(ARD_PORT) -hupcl
  509.  
  510. ispload:    $(TARGET_HEX)
  511.         $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
  512.             -U lock:w:$(ISP_LOCK_FUSE_PRE):m \
  513.             -U hfuse:w:$(ISP_HIGH_FUSE):m \
  514.             -U lfuse:w:$(ISP_LOW_FUSE):m \
  515.             -U efuse:w:$(ISP_EXT_FUSE):m
  516.         $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -D \
  517.             -U flash:w:$(TARGET_HEX):i
  518.         $(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \
  519.             -U lock:w:$(ISP_LOCK_FUSE_POST):m
  520.  
  521. clean:
  522.         $(REMOVE) $(LOCAL_OBJS) $(CORE_OBJS) $(LIB_OBJS) $(CORE_LIB) $(TARGETS) $(DEP_FILE) $(DEPS)
  523.  
  524. depends:    $(DEPS)
  525.         cat $(DEPS) > $(DEP_FILE)
  526.  
  527. size:       $(OBJDIR) $(TARGET_HEX)
  528.         $(SIZE) $(TARGET_HEX)
  529.  
  530. show_boards:   
  531.         $(PARSE_BOARD) --boards
  532.  
  533. .PHONY: all clean depends upload raw_upload reset size show_boards
  534.  
  535. include $(DEP_FILE)
Advertisement
Add Comment
Please, Sign In to add comment