forked from 74hc595/PIC16F1-USB-Bootloader
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
72 lines (51 loc) · 1.66 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Mac OS X Makefile for PIC programming using GPASM
# Copyright (c) 2015, Matt Sarnoff (msarnoff.org)
# v1.0, February 12, 2015
# Released under a 3-clause BSD license: see the accompanying LICENSE file.
#
# Run `make` to build the project as a .hex file.
# Run `make flash` to program the device.
#
# MPLAB X is required if using a PICkit 3 to program the device.
# This Makefile assumes it's installed in /Applications/microchip.
########## Project-specific definitions ##########
# Project name
OUT = bootloader
# Source files to assemble
ASM = bootloader.asm
# USB serial number for the device
SERIAL_NUMBER=1
# (use `make list-devices` if not known)
AS_DEVICE = p16f1454
# The MDB-specific part number of the chip, used for programming with MDB
# (should be the actual PIC part number, e.g. PIC16LF1454)
MDB_DEVICE = PIC16F1454
########## Build settings ##########
AS = gpasm
DASM = gpdasm
MPLABX_DIR = /Applications/microchip/mplabx
MDB = $(MPLABX_DIR)/mplab_ide.app/Contents/Resources/mplab_ide/bin/mdb.sh
########## Make rules ##########
HEX = $(OUT).hex
# Link
$(HEX): $(ASM)
$(AS) -p $(AS_DEVICE) -DSERIAL_NUMBER=$(SERIAL_NUMBER) -o $(HEX) $(ASM)
# Disassemble
dis: $(HEX)
$(DASM) -p p$(AS_DEVICE) $(HEX)
# Flash
flash: $(HEX)
@echo "Device $(MDB_DEVICE)" \
"\nSet system.disableerrormsg true" \
"\nHwtool PICkit3 -p" \
"\nSet programoptions.eraseb4program true" \
"\nProgram \"$(HEX)\"" \
"\nQuit\n" > __prog.cmd
@$(MDB) __prog.cmd; status=$$?; rm -f __prog.cmd MPLABXLog.*; exit $$status
# List supported device types
list-devices:
@$(AS) -l
# Clean
clean:
rm -f $(ASM:.asm=.lst) $(HEX) $(OUT).cod $(OUT).lst
.PHONY: all flash clean list-devices