forked from timelab/ADEM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (52 loc) · 2.11 KB
/
Copy pathMakefile
File metadata and controls
66 lines (52 loc) · 2.11 KB
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
ARDUINO_PATH = $(CURDIR)/Arduino
ARDUINO15_PATH = $(CURDIR)/arduino15
BUILD_PATH = $(CURDIR)/Build
SERIAL_PORT := /dev/ttyUSB0
SERIAL_BAUD := 38400
#SERIAL_BAUD := 74880
#SERIAL_BAUD := 115200
FLASH_BAUD := 921600
SKETCH = adem/adem.ino
BOARD = esp8266:esp8266:thing
HWTYPE = esp8266
ESPTOOL = $(ARDUINO15_PATH)/packages/$(HWTYPE)/tools/esptool/0.4.9/esptool
CTAGS = $(ARDUINO_PATH)/tools-builder/ctags/5.8-arduino10
# Define DEBUG_OUTPUT for internal ESP DNS library when DEBUG is set
CFLAGS := -DDEBUG -DDEBUG_OUTPUT=Serial
PREFS = --prefs=build.debug_level="$(CFLAGS)" --prefs=tools.ctags.path="$(CTAGS)"
SKETCHES = $(find $(CURDIR) -name *.ino)
.PHONY: all flash upload tests
all:
@if [ ! -d "$(ARDUINO_PATH)" ]; then echo "Please make a symlink from your Arduino installation to $(ARDUINO_PATH)."; false; fi
mkdir -p "$(BUILD_PATH)"
"$(ARDUINO_PATH)/arduino-builder" --compile \
--fqbn=$(BOARD) \
--verbose --debug-level=9 $(PREFS) \
--hardware="$(ARDUINO_PATH)/hardware" \
--hardware="$(ARDUINO15_PATH)/packages" \
--tools="$(ARDUINO_PATH)/tools" \
--tools="$(ARDUINO15_PATH)/packages" \
--libraries=./libraries \
--build-path="$(BUILD_PATH)" \
$(SKETCH)
flash:
"$(ESPTOOL)" -v -cd nodemcu -cb $(FLASH_BAUD) -cp $(SERIAL_PORT) -ca 0x00000 -cf "$(BUILD_PATH)/$(shell basename $(SKETCH)).bin"
upload: all flash
tests:
$(foreach SKETCH,$(SKETCHES), make SKETCH=$(SKETCH); )
clean:
rm -rf $(BUILD_PATH)
serial:
@echo "Serial speed is $(SERIAL_BAUD)"
setserial -v $(SERIAL_PORT) spd_cust divisor $$(( 24000000 / ( 2 * $(SERIAL_BAUD) ) ))
# stty -F $(SERIAL_PORT) ispeed $(SERIAL_BAUD) ospeed $(SERIAL_BAUD) cs8 -cstopb parenb
# stty -F $(SERIAL_PORT) ispeed $(SERIAL_BAUD) ospeed $(SERIAL_BAUD)
# stty <$(SERIAL_PORT)
cat <$(SERIAL_PORT)
monitor:
@echo "Serial speed is $(SERIAL_BAUD)"
setserial -v $(SERIAL_PORT) spd_cust divisor $$(( 24000000 / ( 2 * $(SERIAL_BAUD) ) ))
# stty -F $(SERIAL_PORT) ispeed $(SERIAL_BAUD) ospeed $(SERIAL_BAUD) cs8 -cstopb parenb
# stty -F $(SERIAL_PORT) ispeed $(SERIAL_BAUD) ospeed $(SERIAL_BAUD)
stty <$(SERIAL_PORT)
screen $(SERIAL_PORT) $(SERIAL_BAUD),cs8,-ixon,-ixoff,-istrip