Keyboard firmwares for Atmel AVR and Cortex-M
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

13 лет назад
13 лет назад
13 лет назад
13 лет назад
13 лет назад
13 лет назад
13 лет назад
13 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. # Hey Emacs, this is a -*- makefile -*-
  2. #----------------------------------------------------------------------------
  3. # WinAVR Makefile Template written by Eric B. Weddington, J�rg Wunsch, et al.
  4. #
  5. # Released to the Public Domain
  6. #
  7. # Additional material for this makefile was written by:
  8. # Peter Fleury
  9. # Tim Henigan
  10. # Colin O'Flynn
  11. # Reiner Patommel
  12. # Markus Pfaff
  13. # Sander Pool
  14. # Frederik Rouleau
  15. # Carlos Lamas
  16. #
  17. #----------------------------------------------------------------------------
  18. # On command line:
  19. #
  20. # make all = Make software.
  21. #
  22. # make clean = Clean out built project files.
  23. #
  24. # make coff = Convert ELF to AVR COFF.
  25. #
  26. # make extcoff = Convert ELF to AVR Extended COFF.
  27. #
  28. # make program = Download the hex file to the device, using avrdude.
  29. # Please customize the avrdude settings below first!
  30. #
  31. # make debug = Start either simulavr or avarice as specified for debugging,
  32. # with avr-gdb or avr-insight as the front end for debugging.
  33. #
  34. # make filename.s = Just compile filename.c into the assembler code only.
  35. #
  36. # make filename.i = Create a preprocessed source file for use in submitting
  37. # bug reports to the GCC project.
  38. #
  39. # To rebuild project do "make clean" then "make all".
  40. #----------------------------------------------------------------------------
  41. # Target file name (without extension).
  42. TARGET = tmk_hhkb
  43. # List C source files here. (C dependencies are automatically generated.)
  44. SRC = tmk.c \
  45. usb.c \
  46. usb_keyboard.c \
  47. usb_mouse.c \
  48. usb_debug.c \
  49. keymap_hhkb.c \
  50. matrix_hhkb.c \
  51. jump_bootloader.c \
  52. print.c
  53. # MCU name, you MUST set this to match the board you are using
  54. # type "make clean" after changing this, so all files will be rebuilt
  55. #MCU = at90usb162 # Teensy 1.0
  56. #MCU = atmega32u4 # Teensy 2.0
  57. #MCU = at90usb646 # Teensy++ 1.0
  58. MCU = at90usb1286 # Teensy++ 2.0
  59. # Processor frequency.
  60. # Normally the first thing your program should do is set the clock prescaler,
  61. # so your program will run at the correct speed. You should also set this
  62. # variable to same clock speed. The _delay_ms() macro uses this, and many
  63. # examples use this variable to calculate timings. Do not add a "UL" here.
  64. F_CPU = 16000000
  65. # Output format. (can be srec, ihex, binary)
  66. FORMAT = ihex
  67. # Object files directory
  68. # To put object files in current directory, use a dot (.), do NOT make
  69. # this an empty or blank macro!
  70. OBJDIR = .
  71. # List C++ source files here. (C dependencies are automatically generated.)
  72. CPPSRC =
  73. # List Assembler source files here.
  74. # Make them always end in a capital .S. Files ending in a lowercase .s
  75. # will not be considered source files but generated files (assembler
  76. # output from the compiler), and will be deleted upon "make clean"!
  77. # Even though the DOS/Win* filesystem matches both .s and .S the same,
  78. # it will preserve the spelling of the filenames, and gcc itself does
  79. # care about how the name is spelled on its command-line.
  80. ASRC =
  81. # Optimization level, can be [0, 1, 2, 3, s].
  82. # 0 = turn off optimization. s = optimize for size.
  83. # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
  84. OPT = s
  85. # Debugging format.
  86. # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
  87. # AVR Studio 4.10 requires dwarf-2.
  88. # AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
  89. DEBUG = dwarf-2
  90. # List any extra directories to look for include files here.
  91. # Each directory must be seperated by a space.
  92. # Use forward slashes for directory separators.
  93. # For a directory that has spaces, enclose it in quotes.
  94. EXTRAINCDIRS =
  95. # Compiler flag to set the C Standard level.
  96. # c89 = "ANSI" C
  97. # gnu89 = c89 plus GCC extensions
  98. # c99 = ISO C99 standard (not yet fully implemented)
  99. # gnu99 = c99 plus GCC extensions
  100. CSTANDARD = -std=gnu99
  101. # Place -D or -U options here for C sources
  102. CDEFS = -DF_CPU=$(F_CPU)UL
  103. # Place -D or -U options here for ASM sources
  104. ADEFS = -DF_CPU=$(F_CPU)
  105. # Place -D or -U options here for C++ sources
  106. CPPDEFS = -DF_CPU=$(F_CPU)UL
  107. #CPPDEFS += -D__STDC_LIMIT_MACROS
  108. #CPPDEFS += -D__STDC_CONSTANT_MACROS
  109. #---------------- Compiler Options C ----------------
  110. # -g*: generate debugging information
  111. # -O*: optimization level
  112. # -f...: tuning, see GCC manual and avr-libc documentation
  113. # -Wall...: warning level
  114. # -Wa,...: tell GCC to pass this to the assembler.
  115. # -adhlns...: create assembler listing
  116. CFLAGS = -g$(DEBUG)
  117. CFLAGS += $(CDEFS)
  118. CFLAGS += -O$(OPT)
  119. CFLAGS += -funsigned-char
  120. CFLAGS += -funsigned-bitfields
  121. CFLAGS += -ffunction-sections
  122. CFLAGS += -fpack-struct
  123. CFLAGS += -fshort-enums
  124. CFLAGS += -Wall
  125. CFLAGS += -Wstrict-prototypes
  126. #CFLAGS += -mshort-calls
  127. #CFLAGS += -fno-unit-at-a-time
  128. #CFLAGS += -Wundef
  129. #CFLAGS += -Wunreachable-code
  130. #CFLAGS += -Wsign-compare
  131. CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
  132. CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
  133. CFLAGS += $(CSTANDARD)
  134. #---------------- Compiler Options C++ ----------------
  135. # -g*: generate debugging information
  136. # -O*: optimization level
  137. # -f...: tuning, see GCC manual and avr-libc documentation
  138. # -Wall...: warning level
  139. # -Wa,...: tell GCC to pass this to the assembler.
  140. # -adhlns...: create assembler listing
  141. CPPFLAGS = -g$(DEBUG)
  142. CPPFLAGS += $(CPPDEFS)
  143. CPPFLAGS += -O$(OPT)
  144. CPPFLAGS += -funsigned-char
  145. CPPFLAGS += -funsigned-bitfields
  146. CPPFLAGS += -fpack-struct
  147. CPPFLAGS += -fshort-enums
  148. CPPFLAGS += -fno-exceptions
  149. CPPFLAGS += -Wall
  150. CPPFLAGS += -Wundef
  151. #CPPFLAGS += -mshort-calls
  152. #CPPFLAGS += -fno-unit-at-a-time
  153. #CPPFLAGS += -Wstrict-prototypes
  154. #CPPFLAGS += -Wunreachable-code
  155. #CPPFLAGS += -Wsign-compare
  156. CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
  157. CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
  158. #CPPFLAGS += $(CSTANDARD)
  159. #---------------- Assembler Options ----------------
  160. # -Wa,...: tell GCC to pass this to the assembler.
  161. # -adhlns: create listing
  162. # -gstabs: have the assembler create line number information; note that
  163. # for use in COFF files, additional information about filenames
  164. # and function names needs to be present in the assembler source
  165. # files -- see avr-libc docs [FIXME: not yet described there]
  166. # -listing-cont-lines: Sets the maximum number of continuation lines of hex
  167. # dump that will be displayed for a given single line of source input.
  168. ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
  169. #---------------- Library Options ----------------
  170. # Minimalistic printf version
  171. PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
  172. # Floating point printf version (requires MATH_LIB = -lm below)
  173. PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
  174. # If this is left blank, then it will use the Standard printf version.
  175. PRINTF_LIB =
  176. #PRINTF_LIB = $(PRINTF_LIB_MIN)
  177. #PRINTF_LIB = $(PRINTF_LIB_FLOAT)
  178. # Minimalistic scanf version
  179. SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
  180. # Floating point + %[ scanf version (requires MATH_LIB = -lm below)
  181. SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
  182. # If this is left blank, then it will use the Standard scanf version.
  183. SCANF_LIB =
  184. #SCANF_LIB = $(SCANF_LIB_MIN)
  185. #SCANF_LIB = $(SCANF_LIB_FLOAT)
  186. MATH_LIB = -lm
  187. # List any extra directories to look for libraries here.
  188. # Each directory must be seperated by a space.
  189. # Use forward slashes for directory separators.
  190. # For a directory that has spaces, enclose it in quotes.
  191. EXTRALIBDIRS =
  192. #---------------- External Memory Options ----------------
  193. # 64 KB of external RAM, starting after internal RAM (ATmega128!),
  194. # used for variables (.data/.bss) and heap (malloc()).
  195. #EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
  196. # 64 KB of external RAM, starting after internal RAM (ATmega128!),
  197. # only used for heap (malloc()).
  198. #EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
  199. EXTMEMOPTS =
  200. #---------------- Linker Options ----------------
  201. # -Wl,...: tell GCC to pass this to linker.
  202. # -Map: create map file
  203. # --cref: add cross reference to map file
  204. LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
  205. LDFLAGS += -Wl,--relax
  206. LDFLAGS += -Wl,--gc-sections
  207. LDFLAGS += $(EXTMEMOPTS)
  208. LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
  209. LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
  210. #LDFLAGS += -T linker_script.x
  211. #---------------- Programming Options (avrdude) ----------------
  212. # Programming hardware
  213. # Type: avrdude -c ?
  214. # to get a full listing.
  215. #
  216. AVRDUDE_PROGRAMMER = stk500v2
  217. # com1 = serial port. Use lpt1 to connect to parallel port.
  218. AVRDUDE_PORT = com1 # programmer connected to serial device
  219. AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
  220. #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
  221. # Uncomment the following if you want avrdude's erase cycle counter.
  222. # Note that this counter needs to be initialized first using -Yn,
  223. # see avrdude manual.
  224. #AVRDUDE_ERASE_COUNTER = -y
  225. # Uncomment the following if you do /not/ wish a verification to be
  226. # performed after programming the device.
  227. #AVRDUDE_NO_VERIFY = -V
  228. # Increase verbosity level. Please use this when submitting bug
  229. # reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
  230. # to submit bug reports.
  231. #AVRDUDE_VERBOSE = -v -v
  232. AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
  233. AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
  234. AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
  235. AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
  236. #---------------- Debugging Options ----------------
  237. # For simulavr only - target MCU frequency.
  238. DEBUG_MFREQ = $(F_CPU)
  239. # Set the DEBUG_UI to either gdb or insight.
  240. # DEBUG_UI = gdb
  241. DEBUG_UI = insight
  242. # Set the debugging back-end to either avarice, simulavr.
  243. DEBUG_BACKEND = avarice
  244. #DEBUG_BACKEND = simulavr
  245. # GDB Init Filename.
  246. GDBINIT_FILE = __avr_gdbinit
  247. # When using avarice settings for the JTAG
  248. JTAG_DEV = /dev/com1
  249. # Debugging port used to communicate between GDB / avarice / simulavr.
  250. DEBUG_PORT = 4242
  251. # Debugging host used to communicate between GDB / avarice / simulavr, normally
  252. # just set to localhost unless doing some sort of crazy debugging when
  253. # avarice is running on a different computer.
  254. DEBUG_HOST = localhost
  255. #============================================================================
  256. # Define programs and commands.
  257. SHELL = sh
  258. CC = avr-gcc
  259. OBJCOPY = avr-objcopy
  260. OBJDUMP = avr-objdump
  261. SIZE = avr-size
  262. AR = avr-ar rcs
  263. NM = avr-nm
  264. AVRDUDE = avrdude
  265. REMOVE = rm -f
  266. REMOVEDIR = rm -rf
  267. COPY = cp
  268. WINSHELL = cmd
  269. # Define Messages
  270. # English
  271. MSG_ERRORS_NONE = Errors: none
  272. MSG_BEGIN = -------- begin --------
  273. MSG_END = -------- end --------
  274. MSG_SIZE_BEFORE = Size before:
  275. MSG_SIZE_AFTER = Size after:
  276. MSG_COFF = Converting to AVR COFF:
  277. MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
  278. MSG_FLASH = Creating load file for Flash:
  279. MSG_EEPROM = Creating load file for EEPROM:
  280. MSG_EXTENDED_LISTING = Creating Extended Listing:
  281. MSG_SYMBOL_TABLE = Creating Symbol Table:
  282. MSG_LINKING = Linking:
  283. MSG_COMPILING = Compiling C:
  284. MSG_COMPILING_CPP = Compiling C++:
  285. MSG_ASSEMBLING = Assembling:
  286. MSG_CLEANING = Cleaning project:
  287. MSG_CREATING_LIBRARY = Creating library:
  288. # Define all object files.
  289. OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
  290. # Define all listing files.
  291. LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
  292. # Compiler flags to generate dependency files.
  293. GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
  294. # Combine all necessary flags and optional flags.
  295. # Add target processor to flags.
  296. ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
  297. ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
  298. ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
  299. # Default target.
  300. all: begin gccversion sizebefore build sizeafter end
  301. # Change the build target to build a HEX file or a library.
  302. build: elf hex eep lss sym
  303. #build: lib
  304. elf: $(TARGET).elf
  305. hex: $(TARGET).hex
  306. eep: $(TARGET).eep
  307. lss: $(TARGET).lss
  308. sym: $(TARGET).sym
  309. LIBNAME=lib$(TARGET).a
  310. lib: $(LIBNAME)
  311. # Eye candy.
  312. # AVR Studio 3.x does not check make's exit code but relies on
  313. # the following magic strings to be generated by the compile job.
  314. begin:
  315. @echo
  316. @echo $(MSG_BEGIN)
  317. end:
  318. @echo $(MSG_END)
  319. @echo
  320. # Display size of file.
  321. HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
  322. #ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf
  323. ELFSIZE = $(SIZE) $(TARGET).elf
  324. sizebefore:
  325. @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
  326. 2>/dev/null; echo; fi
  327. sizeafter:
  328. @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
  329. 2>/dev/null; echo; fi
  330. # Display compiler version information.
  331. gccversion :
  332. @$(CC) --version
  333. # Program the device.
  334. program: $(TARGET).hex $(TARGET).eep
  335. $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
  336. # Generate avr-gdb config/init file which does the following:
  337. # define the reset signal, load the target file, connect to target, and set
  338. # a breakpoint at main().
  339. gdb-config:
  340. @$(REMOVE) $(GDBINIT_FILE)
  341. @echo define reset >> $(GDBINIT_FILE)
  342. @echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
  343. @echo end >> $(GDBINIT_FILE)
  344. @echo file $(TARGET).elf >> $(GDBINIT_FILE)
  345. @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE)
  346. ifeq ($(DEBUG_BACKEND),simulavr)
  347. @echo load >> $(GDBINIT_FILE)
  348. endif
  349. @echo break main >> $(GDBINIT_FILE)
  350. debug: gdb-config $(TARGET).elf
  351. ifeq ($(DEBUG_BACKEND), avarice)
  352. @echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
  353. @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
  354. $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
  355. @$(WINSHELL) /c pause
  356. else
  357. @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
  358. $(DEBUG_MFREQ) --port $(DEBUG_PORT)
  359. endif
  360. @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
  361. # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
  362. COFFCONVERT = $(OBJCOPY) --debugging
  363. COFFCONVERT += --change-section-address .data-0x800000
  364. COFFCONVERT += --change-section-address .bss-0x800000
  365. COFFCONVERT += --change-section-address .noinit-0x800000
  366. COFFCONVERT += --change-section-address .eeprom-0x810000
  367. coff: $(TARGET).elf
  368. @echo
  369. @echo $(MSG_COFF) $(TARGET).cof
  370. $(COFFCONVERT) -O coff-avr $< $(TARGET).cof
  371. extcoff: $(TARGET).elf
  372. @echo
  373. @echo $(MSG_EXTENDED_COFF) $(TARGET).cof
  374. $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
  375. # Create final output files (.hex, .eep) from ELF output file.
  376. %.hex: %.elf
  377. @echo
  378. @echo $(MSG_FLASH) $@
  379. $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
  380. %.eep: %.elf
  381. @echo
  382. @echo $(MSG_EEPROM) $@
  383. -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
  384. --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0
  385. # Create extended listing file from ELF output file.
  386. %.lss: %.elf
  387. @echo
  388. @echo $(MSG_EXTENDED_LISTING) $@
  389. $(OBJDUMP) -h -S -z $< > $@
  390. # Create a symbol table from ELF output file.
  391. %.sym: %.elf
  392. @echo
  393. @echo $(MSG_SYMBOL_TABLE) $@
  394. $(NM) -n $< > $@
  395. # Create library from object files.
  396. .SECONDARY : $(TARGET).a
  397. .PRECIOUS : $(OBJ)
  398. %.a: $(OBJ)
  399. @echo
  400. @echo $(MSG_CREATING_LIBRARY) $@
  401. $(AR) $@ $(OBJ)
  402. # Link: create ELF output file from object files.
  403. .SECONDARY : $(TARGET).elf
  404. .PRECIOUS : $(OBJ)
  405. %.elf: $(OBJ)
  406. @echo
  407. @echo $(MSG_LINKING) $@
  408. $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
  409. # Compile: create object files from C source files.
  410. $(OBJDIR)/%.o : %.c
  411. @echo
  412. @echo $(MSG_COMPILING) $<
  413. $(CC) -c $(ALL_CFLAGS) $< -o $@
  414. # Compile: create object files from C++ source files.
  415. $(OBJDIR)/%.o : %.cpp
  416. @echo
  417. @echo $(MSG_COMPILING_CPP) $<
  418. $(CC) -c $(ALL_CPPFLAGS) $< -o $@
  419. # Compile: create assembler files from C source files.
  420. %.s : %.c
  421. $(CC) -S $(ALL_CFLAGS) $< -o $@
  422. # Compile: create assembler files from C++ source files.
  423. %.s : %.cpp
  424. $(CC) -S $(ALL_CPPFLAGS) $< -o $@
  425. # Assemble: create object files from assembler source files.
  426. $(OBJDIR)/%.o : %.S
  427. @echo
  428. @echo $(MSG_ASSEMBLING) $<
  429. $(CC) -c $(ALL_ASFLAGS) $< -o $@
  430. # Create preprocessed source for use in sending a bug report.
  431. %.i : %.c
  432. $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
  433. # Target: clean project.
  434. clean: begin clean_list end
  435. clean_list :
  436. @echo
  437. @echo $(MSG_CLEANING)
  438. $(REMOVE) $(TARGET).hex
  439. $(REMOVE) $(TARGET).eep
  440. $(REMOVE) $(TARGET).cof
  441. $(REMOVE) $(TARGET).elf
  442. $(REMOVE) $(TARGET).map
  443. $(REMOVE) $(TARGET).sym
  444. $(REMOVE) $(TARGET).lss
  445. $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o)
  446. $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst)
  447. $(REMOVE) $(SRC:.c=.s)
  448. $(REMOVE) $(SRC:.c=.d)
  449. $(REMOVE) $(SRC:.c=.i)
  450. $(REMOVEDIR) .dep
  451. # Create object files directory
  452. $(shell mkdir $(OBJDIR) 2>/dev/null)
  453. # Include the dependency files.
  454. -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
  455. # Listing of phony targets.
  456. .PHONY : all begin finish end sizebefore sizeafter gccversion \
  457. build elf hex eep lss sym coff extcoff \
  458. clean clean_list program debug gdb-config