-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRules.arduino.mk
1158 lines (985 loc) · 31.4 KB
/
Rules.arduino.mk
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Arduino-mpe/Rules.mk
$(module-header,old,$/Rules.old.mk)
#
# ------------ --
# XXX: makefile broke with Arduino 1.6.*
#
#
#DIR := $/mydir
#include $(call rules,$(DIR)/)
#
# DMK += $/dynamic-makefile.mk
# DEP += $/generated-dependency
# TRGT += $/build-target
# TEST += $/testtarget
# XXX: cleanable only noticed on 'make clean'
METHODS = \
arduino576="-c arduino -P $(PORT) -b 57600"; \
arduino384="-c arduino -P $(PORT) -b 38400"; \
arduino192="-c arduino -P $(PORT) -b 19200"; \
arduino96="-c arduino -P $(PORT) -b 9600"; \
arduino="-c arduino -P $(PORT) -b 57600"; \
uno="-c arduino -P $(PORT) -b 115200"; \
leonardo="-cavr109 -P $(PORT) -b 57600 "; \
parisp="-c avr-par-isp-mpe -b 19200"; \
parisp_="-c bsd -b 19200"; \
arduino8="-cstk500 -P $(PORT) -b 19200"; \
arduinoisp="-cstk500v1 -P $(PORT) -b 9600"; \
arduinoisp_="-cstk500v1 -P $(PORT) -b 19200"; \
arduinoisp__="-cstk500v1 -P $(PORT) -b 57600"; \
usbasp="-c usbasp -P usb"
#IMAGES := \
# blink=firmware/betemcu-usbasp/misc/betemcu_blink/betemcu_blink.cpp.hex\
# ArduinoISP=ArduinoISP_mega328.hex
#atmega8_mkjdz.com_I2C_lcd1602.hex
# ifneq ($(M),"parisp")
# ifeq ("$(PORT)","")
# $(error "No port: $(PORT)")
# endif
# endif
define _flash
$(call log,header2,I,$(I));\
$(call log,header2,C,$(C));\
$(call log,header2,M,$(M));\
$(call log,header2,X,$(X));\
[ "$(M)" = "micronucleus" -o "$(M)" == "mn" ] && { \
micronucleus $(I); \
} || { \
$(D) $${sudo}$(avrdude) \
$(call key,METHODS,$(M))\
-V \
-p $(C) \
-U flash:w:$(I) \
$(X) ; \
}
endef
# avrdude chip ID
upload: C := m328p
# avrdude protocol
upload: M := arduino
# flash image
#upload: I := firmware/ArduinoISP_mega328.hex
#upload: I := firmware/isp_flash_m328p.hex
# avrdude extra flags
upload: X := -D
upload: _upload
avrdude=$(ARDUINODIR)/hardware/tools/avr/bin/avrdude -C$(ARDUINODIR)/hardware/tools/avr/etc/avrdude.conf
_upload:
@\
$(ll) attention $@ "Starting upload to $(C) using $(M).." $(I);\
[ "$(M)" = "usbasp" ] && { sudo="sudo "; } || { sudo=; }; \
$(call _flash)
@\
$(ll) OK $@ "Flash upload completed successfully"
download: C := m328p
download: M := arduino
download: I :=
download: X := -D
download: _download
_read_fuses:
$(avrdude) \
-p $(C) \
$(call key,METHODS,$(M)) \
-U lock:r:-:h -U lfuse:r:-:h -U hfuse:r:-:h
_download:
@\
$(ll) attention $@ "Starting flash/eeprom download using $(M).." $(I);\
[ "$(M)" = "usbasp" ] && { sudo="sudo "; } || { sudo=; }; \
I=$(I);\
[ -z "$$I" ] && I=download-$(C)-$(M);\
$(avrdude) \
-p $(C) \
$(call key,METHODS,$(M)) \
-U eeprom:r:$$I-eeprom.hex:i \
-U flash:r:$$I.hex:i \
-U lock:r:-:h -U lfuse:r:-:h -U hfuse:r:-:h
@\
$(ll) OK $@ "Download completed successfully" $$I-*
_uctest:
@\
$(ll) attention $@ "Testing for $(C) using $(M).." $(PORT);\
[ "$(M)" = "usbasp" ] && { sudo="sudo "; } || { sudo=; }; \
$(D) $${sudo}$(avrdude) \
-p $(C) \
$(call key,METHODS,$(M)) \
-U lfuse:r:-:h \
-U hfuse:r:-:h \
-U lock:r:-:h \
$(X)
@$(ll) OK $@
uctest: C := m328p
uctest: M := usbasp
uctest: X :=
uctest: _uctest
m328ptest: C := m328p
m328ptest: M := arduinoisp
m328ptest: X :=
m328ptest: _uctest
t85test: C := t85
t85test: M := usbasp
t85test: X := "-B3"
t85test: _uctest
erase: C := m328p
erase: M := arduinoisp
erase:
@\
$(ll) attention $@ "Starting erase of $(C) using $(M)..";\
$(avrdude) \
-p $(C) $(call key,METHODS,$(M)) -e;\
$(ll) OK $@
flash: C := m8
flash: M := usbasp
flash: I :=
# Low-, high- and extended fuse
flash: LF :=
flash: HF :=
flash: EF :=
# Lock/unlock bits
flash: LB :=
flash: UB :=
# Debug
flash: D := echo
flash: _flash
_flash:
@\
[ "$(M)" = "usbasp" ] && { sudo="sudo "; } || { sudo=; }; \
test -n "$(ERASE)" && erase_f=-e || erase_f=-D; \
$(ll) attention $@ "Starting flash to $(C) using $(M).." $(I);\
X="$(X)";\
( [ -n "$(HF)" ] && [ -n "$(LF)" ] || { exit 1; } ) && ( \
[ -n "$(UB)" ] && { \
$(ll) attention $@ "Unlocking.." && \
$(D) $${sudo}$(avrdude) \
-p $(C) $$erase_f $$X \
$(call key,METHODS,$(M)) \
-U lock:w:$(UB):m \
|| exit 2;\
} || echo "No unlock"; \
$(ll) attention $@ "Writing new fuses.." && \
([ -n "$(EF)" ] && { \
$(D) $${sudo}$(avrdude) \
-p $(C) $$erase_f $$X \
$(call key,METHODS,$(M)) \
-U hfuse:w:$(HF):m \
-U lfuse:w:$(LF):m \
-U efuse:w:$(EF):m \
&& $(ll) info $@ OK \
|| exit 3;\
} || { \
$(D) $${sudo}$(avrdude) -p $(C) $$erase_f $$X \
$(call key,METHODS,$(M)) \
-U hfuse:w:$(HF):m \
-U lfuse:w:$(LF):m \
&& $(ll) info $@ OK \
|| exit 4;\
});\
([ -n "$(E)" ] && { \
$(ll) attention $@ "Writing EEPROM.." && \
$(D) $${sudo}$(avrdude) -p $(C) -D $$X \
$(call key,METHODS,$(M)) \
-U eeprom:w:$(E) \
&& $(ll) info $@ OK \
|| exit 5;\
});\
([ -n "$(I)" ] && { \
$(ll) attention $@ "Writing Flash.." && \
$(D) $${sudo}$(avrdude) -p $(C) -D $$X \
$(call key,METHODS,$(M)) \
-V -U flash:w:$(I) \
&& $(ll) info $@ OK \
|| exit 6;\
} || printf "");\
([ -n "$(LB)" ] && { \
$(ll) attention $@ "Locking.." && \
$(D) $${sudo}$(avrdude) $$X \
-p $(C) -D \
$(call key,METHODS,$(M)) \
-U lock:w:$(LB):m \
&& $(ll) info $@ OK \
|| exit 7;\
} || printf ""); \
)
### Preset common flash
# 1st version
# Update 3: Baud: 2400
# Update 4: Baud: 4800
fusebit-doctor-m328-update8: C := m328p
fusebit-doctor-m328-update8: M := usbasp
fusebit-doctor-m328-update8: I := $(wildcard ~/Downloads/atmega-hvpp-fusebit-doctor_archive/update8-05.03.2011/firmware/Atmega328,328P/atmega_fusebit_doctor_2.08_m328p.hex)
fusebit-doctor-m328-update8: E := $(wildcard ~/Downloads/atmega-hvpp-fusebit-doctor_archive/update8-05.03.2011/firmware/Atmega328,328P/atmega_fusebit_doctor_2.08_m328p.bin)
fusebit-doctor-m328-update8: LF := 0x62
fusebit-doctor-m328-update8: HF := 0xD1
fusebit-doctor-m328-update8: EF := 0x07
fusebit-doctor-m328-update8: LB := 0x0F
fusebit-doctor-m328-update8: UB := 0x3F
fusebit-doctor-m328-update8: X := -B 3
fusebit-doctor-m328-update8: _flash
fusebit-doctor-m328-update10: C := m328p
fusebit-doctor-m328-update10: M := usbasp
fusebit-doctor-m328-update10: I := $(wildcard ~/Downloads/atmega-hvpp-fusebit-doctor_archive/update10-20.04.2011/firmware/Atmega328,328P/atmega_fusebit_doctor_2.10_m328p.hex)
fusebit-doctor-m328-update10: E := $(wildcard ~/Downloads/atmega-hvpp-fusebit-doctor_archive/update10-20.04.2011/firmware/Atmega328,328P/atmega_fusebit_doctor_2.10_m328p.bin)
#fusebit-doctor-m328: I := firmware/atmega_fusebit_doctor_2.11_m328p.hex
#fusebit-doctor-m328: LF := 0x62
fusebit-doctor-m328-update10: LF := 0x62
fusebit-doctor-m328-update10: HF := 0xD1
fusebit-doctor-m328-update10: EF := 0x07
fusebit-doctor-m328-update10: LB := 0x0F
fusebit-doctor-m328-update10: UB := 0x3F
fusebit-doctor-m328-update10: X := -B 3
fusebit-doctor-m328-update10: _flash
#fusebit-doctor-m328: D :=
fusebit-doctor-m328-update11: C := m328p
fusebit-doctor-m328-update11: M := usbasp
fusebit-doctor-m328-update11: I := $(wildcard ~/Downloads/atmega-hvpp-fusebit-doctor_archive/update11-30.04.2011/firmware/Atmega328,328P/atmega_fusebit_doctor_2.11_m328p.hex)
fusebit-doctor-m328-update11: E := $(wildcard ~/Downloads/atmega-hvpp-fusebit-doctor_archive/update11-30.04.2011/firmware/Atmega328,328P/atmega_fusebit_doctor_2.11_m328p.bin)
fusebit-doctor-m328-update11: LF := 0x62
fusebit-doctor-m328-update11: HF := 0xD1
fusebit-doctor-m328-update11: EF := 0x07
fusebit-doctor-m328-update11: LB := 0x0F
fusebit-doctor-m328-update11: UB := 0x3F
fusebit-doctor-m328-update11: X := -B 3
fusebit-doctor-m328-update11: _flash
fusebit-doctor: fusebit-doctor-m328-update10
fusebit-doctor-m8: C := m8
fusebit-doctor-m8: M := usbasp
fusebit-doctor-m8: I := atmega_fusebit_doctor_2.09_m8.hex
fusebit-doctor-m8: LF := 0xE1
fusebit-doctor-m8: HF := 0xD1
fusebit-doctor-m8: EF :=
fusebit-doctor-m8: LB := 0x3C
fusebit-doctor-m8: UB := 0x3F
fusebit-doctor-m8: D :=
fusebit-doctor-m8: _flash
upload-betemcu: C := m8
upload-betemcu: M := usbasp
upload-betemcu: I :=
upload-betemcu: _flash
flash-betemcu-usbasploader: C := m8
flash-betemcu-usbasploader: M := usbasp
flash-betemcu-usbasploader: I := firmware/betemcu-usbasp/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex
flash-betemcu-usbasploader: LF := 0xFF
flash-betemcu-usbasploader: HF := 0xD9
flash-betemcu-usbasploader: EF :=
flash-betemcu-usbasploader: LB := 0x3C
flash-betemcu-usbasploader: UB := 0x3F
flash-betemcu-usbasploader: _flash
flash-betemcu-usbasploader-alt: M := usbasp
flash-betemcu-usbasploader-alt: I := firmware/betemcu-usbasp/alternate_USBaspLoader_betemcu_timeout.hex
flash-betemcu-usbasploader-alt:
$(avrdude) \
-p m8 -e \
$(call key,METHODS,$(M)) \
-U lock:w:0x3F:m
$(avrdude) \
-p m8 \
$(call key,METHODS,$(M)) \
-U hfuse:w:0xC8:m -U lfuse:w:0xBF:m
$(avrdude) \
-p m8 \
$(call key,METHODS,$(M)) \
-U flash:w:$(I)
$(avrdude) \
-p m8 \
$(call key,METHODS,$(M)) \
-U lock:w:0x0F:m
# from /home/berend/Application/arduino-0021/hardware/arduino/boards.txt
# This is working with 19200 baud
m8-16MHz: C := m8
m8-16MHz: M := usbasp
#m8-16MHz: I := firmware/ATmegaBOOT.hex
# from 1.0.3
m8-16MHz: I := firmware/ATmegaBOOT-prod-firmware-2009-11-07.hex
m8-16MHz: HF := 0xCA
m8-16MHz: LF := 0xDF
m8-16MHz: LB := 0x0F
m8-16MHz: UB := 0x3F
m8-16MHz: X := -B 3
m8-16MHz: _flash
# not sure what this is
m8-fd: C := m8
m8-fd: M := usbasp
m8-fd: HF := 0x99
m8-fd: LF := 0XC1
m8-fd: LB := 0x0F
m8-fd: UB := 0x3F
m8-fd: X := -B 3
m8-fd: _flash
# 8MHz optiboot, cannot get this to work at 9600b
# http://www.robertoinzerillo.com/wordpress/wp-content/uploads/2012/10/optiboot_atmega8_8.zip
# http://www.robertoinzerillo.com/wordpress/?p=45
# Arduino BOARD: atmega8_opti_8mhz
m8-optiboot: C := m8
m8-optiboot: M := usbasp
m8-optiboot: HF := 0xCC
m8-optiboot: LF := 0xA4
m8-optiboot: LB := 0x0F
m8-optiboot: UB := 0x3F
m8-optiboot: I := firmware/optiboot_atmega8_8.hex
m8-optiboot: X := -B 3
m8-optiboot: D :=
m8-optiboot: _flash
# 8MHz noxtal
# http://todbot.com/blog/2009/05/26/minimal-arduino-with-atmega8/
# http://todbot.com/blog/wp-content/uploads/2009/05/atmega8_noxtal.zip
# Arduino BOARD: atmega8noxtal
m8-noxtal: C := m8
m8-noxtal: M := usbasp
m8-noxtal: HF := 0xC4
m8-noxtal: LF := 0xE4
m8-noxtal: LB := 0x0F
m8-noxtal: UB := 0x3F
m8-noxtal: I := firmware/atmega8_noxtal/ATmegaBOOT.hex
#m8-noxtal: X := -B 3
m8-noxtal: D :=
m8-noxtal: _flash
m8: M := arduinoisp
m8:
avrdude \
-p m8 \
$(call key,METHODS,$(M))
m16: M := arduinoisp
m16:
avrdude \
-p m16 \
$(call key,METHODS,$(M))
m32-DI-8MHz-int: M := arduinoisp
m32-DI-8MHz-int: I := firmware/ATmegaBOOT_168_diecimila.hex
m32-DI-8MHz-int:
avrdude \
-p m32 -e \
$(call key,METHODS,$(M)) \
-U lock:w:0x3F:m -U lfuse:w:0xD4:m -U hfuse:w:0x99:m
avrdude \
-p m32 \
$(call key,METHODS,$(M)) \
-D -U flash:w:$(I)
avrdude \
-p m32 \
$(call key,METHODS,$(M)) \
-U lock:w:0x0F:m
# 16MHz ext, 5V, delay bootloader
m32: M := arduinoisp
m32: I := firmware/ATmegaBOOT_168_diecimila.hex
m32:
avrdude \
-p m32 -e \
$(call key,METHODS,$(M)) \
-U lock:w:0x3F:m -U lfuse:w:0xD4:m -U hfuse:w:0x99:m
avrdude \
-p m32 \
$(call key,METHODS,$(M)) \
-D -U flash:w:$(I)
avrdude \
-p m32 \
$(call key,METHODS,$(M)) \
-U lock:w:0x0F:m
m48: M := arduinoisp
m48:
avrdude \
-p m48 \
$(call key,METHODS,$(M))
m328p: M := arduinoisp
m328p:
avrdude \
-p m328p \
$(call key,METHODS,$(M))
# Internal 8MHz/57600baud 328 target
m328p-8MHz: I := firmware/ATmegaBOOT_168_atmega328_pro_8MHz.hex
m328p-8MHz: M := arduinoisp
m328p-8MHz:
avrdude \
-p m328p -e \
$(call key,METHODS,$(M)) \
-U lock:w:0x3F:m -U lfuse:w:0xE2:m -U hfuse:w:0xDA:m -U efuse:w:0x05:m
avrdude \
-p m328p \
$(call key,METHODS,$(M)) \
-D -U flash:w:$(I)
avrdude \
-p m328p \
$(call key,METHODS,$(M)) \
-U lock:w:0x0F:m
#m328p-16MHz: I := firmware/optiboot_atmega328.hex
m328p-16MHz: I := firmware/ATmegaBOOT_168_atmega328.hex
m328p-16MHz: M := usbasp
m328p-16MHz: X :=
m328p-16MHz: C := m328p
m328p-16MHz: LF := 0xFF
m328p-16MHz: HF := 0xDA
m328p-16MHz: EF := 0x07
m328p-16MHz: LB := 0x0F
m328p-16MHz: UB := 0x3F
m328p-16MHz: _flash
# Cannot re-read protected flash without -e? check fuses
#verify-betemcu: M := usbasp
#verify-betemcu:
# sudo avrdude -p m8 \
# $(call key,METHODS,$(M)) \
# -U lock:w:0x3F:m
# sudo avrdude -p m8 -v \
# $(call key,METHODS,$(M)) \
# -U flash:v:firmware/betemcu-usbasp/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex:i
# -U lock:v:0x3C:m -U lfuse:v:0xff:m -U hfuse:v:0xd9:m
# sudo avrdude -p m8 \
# $(call key,METHODS,$(M)) \
# -U lock:w:0x3C:m
m1284p: M := arduinoisp
m1284p:
avrdude \
-p m1284p \
$(call key,METHODS,$(M))
# ------------ --
#
# Integrating with another makefile for easy builds
#ARDUINODIR := /home/berend/Application/arduino-1.0.3
#ARDUINODIR := ./tmp/arduino-1.0.4
#ARDUINODIR := /usr/share/arduino/
#ARDUINODIR := /home/berend/Application/arduino-1.0.3
#ARDUINODIR := /usr/share/arduino/
#ARDUINODIR := $(shell realpath ./arduino-1.0.5)
#ARDUINODIR := $(shell realpath ./arduino-1.0.1)
#AVRTOOLSPATH += $(ARDUINODIR)/hardware/tools
#AVRTOOLSPATH += $(ARDUINODIR)/hardware/tools/avr/bin
#$(info $(shell $(ll) header1 $(MK_$d) Wrapping arduino.mk))
#$(info $(shell $(ll) header3 $(MK_$d) AVRTOOLSPATH: $(AVRTOOLSPATH)))
#$(info $(shell $(ll) header3 $(MK_$d) ARDUINODIR: $(ARDUINODIR)))
#
#BOARDS_FILES := $(wildcard \
# $(ARDUINODIR)/hardware/*/boards.txt \
# ./hardware/*/boards.txt)
#$(info BOARDS_FILES = $(BOARDS_FILES))
#
#BOARD_BUILD_MCU := $(foreach BOARDS_FILE,$(BOARDS_FILES),\
# $(shell sed -ne "s/$(BOARD).build.mcu=\(.*\)/\1/p" $(BOARDS_FILE)))
#$(info BOARD_BUILD_MCU = $(BOARD_BUILD_MCU))
# Build anything in target folder 'P'
#arduino: P :=
#arduino: BRD :=
#_arduino: LIB := $/libraries/
#_arduino: TARGETS := clean all
_arduino:
@\
$(call log,header2,BRD,$(BRD));\
p=$$(realpath .);\
cd $P; \
ARDUINODIR=$(ARDUINODIR) \
AVRTOOLSPATH="$(AVRTOOLSPATH)" \
BOARD=$(BRD) \
make -f $$p/arduino.mk $(TARGETS)
#make -f /usr/local/opt/arduino-mk/Arduino.mk $(TARGETS)
arduino: TARGETS := target
arduino: _arduino
jeenode: BRD := atmega328
jeenode: M := arduino
jeenode: arduino
arduino-firmware: BRD :=
arduino-firmware: P :=
arduino-firmware: TARGETS :=
arduino-firmware: _arduino-firmware
_arduino-firmware:
$(call log,header2,BRD,$(BRD));\
p=$$(realpath .);\
cd $P; \
make -f $$p/arduino.mk \
ARDUINODIR=$(ARDUINODIR) \
BOARD=$(BRD) \
$(TARGETS)
boards: TARGETS := boards
boards: _arduino
monitor: TARGETS := monitor
monitor: _arduino
size: P :=
size: TARGETS := size
size: _arduino
ardnlib:
cd $(ARDUINODIR)/libraries/;\
ln -s /src/jeelabs/jeelib JeeLib; \
ln -s /src/jeelabs/embencode EmBencode; \
ln -s /src/jeelabs/ethercard EtherCard; \
ln -s /srv/project-mpe/Arduino-mpe/libraries/DHT; \
ln -s /srv/project-mpe/Arduino-mpe/libraries/OneWire
isp_flash: P := $/libraries/JeeLib/examples/Ports/isp_flash/
isp_flash: I := $/libraries/JeeLib/examples/Ports/isp_flash/isp_flash.hex
isp_flash: BRD := atmega328
isp_flash: arduino upload
arduino-boards:
@p=$$(realpath .);\
echo ARDUINODIR=$(ARDUINODIR);\
make -f $$p/arduino.mk boards
### Common preset uploads
jeenodeisp: I := firmware/isp_flash_m328p.hex
jeenodeisp: X := -D
jeenodeisp: upload
#jeenode-isp-repair: P = $/libraries/JeeLib/examples/Ports/isp_repair2/
#jeenode-isp-repair: arduino
#
#jeenode-isp-repair-post: DIR := $/
#jeenode-isp-repair-post:
# cp $(DIR)libraries/JeeLib/examples/Ports/isp_repair2/isp_repair2.hex firmware/isp_repair_m328p.hex
jeenodeisp-repair: C := m328p
jeenodeisp-repair: M := arduino
jeenodeisp-repair: I := firmware/isp_repair2_m328p.hex
#jeenodeisp-repair: X := -D
jeenodeisp-repair: upload
#blink: C ?= m328p
blink: P := Prototype/Blink
blink: I := Prototype/Blink/Blink.hex
blink: arduino upload
blinknodelayJeelib: C := m328p
blinknodelayJeelib: P := Prototype/Blink/BlinkNodelayJeelib
blinknodelayJeelib: I := Prototype/Blink/BlinkNodelayJeelib/BlinkNodelayJeelib.hex
blinknodelayJeelib: jeenode upload
blinkall: C := m328p
blinkall: P := Prototype/Blink/BlinkAll
blinkall: I := Prototype/Blink/BlinkAll/BlinkAll.hex
blinkall: jeenode upload
oe: C := m328p
oe: P := Mpe/Plugs/OutputExpander
oe: I := Mpe/Plugs/OutputExpander/OutputExpander.hex
oe: jeenode upload
3way: C := m328p
3way: P := Mpe/eBay-ThreeWayMeter/
3way: I := Mpe/eBay-ThreeWayMeter/Prototype.hex
3way: jeenode upload
radioblip: C := m328p
radioblip: P := Mpe/RadioBlip/
radioblip: I := Mpe/RadioBlip/RadioBlip.hex
radioblip: jeenode upload
# XXX merge with Prototype if needed
#radiolink: C := m328p
#radiolink: P := Mpe/RadioLink/
#radiolink: I := Mpe/RadioLink/RadioLink.hex
#radiolink: jeenode upload
radiolink: C := m328p
radiolink: P := Prototype/RadioLink/
radiolink: I := Prototype/RadioLink/RadioLink.hex
radiolink: jeenode upload
# RF24 Compiles with 1.0.1,4,5 on darwin. Latest libs.
rf24helper: C := m328p
rf24helper: P := Mpe/RF24Helper
rf24helper: I := Mpe/RF24Helper/RF24Helper.hex
rf24helper: jeenode upload
rf24test: C := m328p
rf24test: P := Mpe/RF24Test
rf24test: I := Mpe/RF24Test/RF24Test.hex
rf24test: jeenode upload
rf24scan: C := m328p
rf24scan: P := libraries/RF24/examples/scanner/
rf24scan: I := libraries/RF24/examples/scanner/scanner.hex
rf24scan: jeenode upload
rf24ping: C := m328p
rf24ping: P := libraries/RF24/examples/pingpair/
rf24ping: I := libraries/RF24/examples/pingpair/pingpair.hex
rf24ping: jeenode upload
# RF24Network Compiles with 1.0.4 or 1.0.5 on Darwin
rf24hwtx: C := m328p
#rf24hwtx: BRD := atmega8
rf24hwtx: P := libraries/RF24Network/examples/helloworld_tx/
rf24hwtx: I := libraries/RF24Network/examples/helloworld_tx/helloworld_tx.hex
#rf24hwtx: arduino _upload
rf24hwtx: jeenode upload
#rf24hwrx: C := m8
#rf24hwrx: BRD := atmega8
rf24hwrx: P := libraries/RF24Network/examples/helloworld_rx/
rf24hwrx: I := libraries/RF24Network/examples/helloworld_rx/helloworld_rx.hex
rf24hwrx: jeenode upload
sensornet: P := libraries/RF24Network/examples/sensornet/
sensornet: I := libraries/RF24Network/examples/sensornet/sensornet.hex
sensornet: jeenode upload
meshping: P := libraries/RF24Network/examples/meshping/
meshping: I := libraries/RF24Network/examples/meshping/meshping.hex
meshping: jeenode upload
carriercase: C := m328p
#carriercase: BRD := uno
carriercase: P := Mpe/CarrierCase/
carriercase: I := Mpe/CarrierCase/CarrierCase.hex
carriercase: jeenode upload
cassette328p: C := m328p
cassette328p: P := Mpe/Cassette328P/
cassette328p: I := Mpe/Cassette328P/Cassette328P.hex
cassette328p: jeenode upload
cassette328pmilli: C := m328p
cassette328pmilli: P := Mpe/Cassette328P/Milli/
cassette328pmilli: I := Mpe/Cassette328P/Milli/Milli.hex
cassette328pmilli: jeenode upload
hanrun: C := m328p
hanrun: P := Misc/HanrunENC28J60/
hanrun: I := Misc/HanrunENC28J60/HanrunENC28J60.hex
hanrun: jeenode upload
utilitybug: C := m328p
utilitybug: P := Mpe/Utility/UtilityBug/
utilitybug: I := Mpe/Utility/UtilityBug/UtilityBug.hex
utilitybug: jeenode upload
gastest: C := m328p
gastest: P := Mpe/GasDetector/Test/
gastest: I := Mpe/GasDetector/Test/Test.hex
gastest: jeenode upload
gasdet: C := m328p
gasdet: P := Mpe/GasDetector/
gasdet: I := Mpe/GasDetector/GasDetector.hex
gasdet: jeenode upload
sandbox: C := m328p
sandbox: P := Mpe/Sandbox/
sandbox: I := Mpe/Sandbox/Sandbox.hex
sandbox: jeenode upload
sandbox-avr: C := m328p
sandbox-avr: P := Mpe/Sandbox/AVR
sandbox-avr: I := Mpe/Sandbox/AVR/AVR.hex
sandbox-avr: arduino _upload
mla: C := m328p
mla: P := Misc/miniLogicAnalyzer/
mla: I := Misc/miniLogicAnalyzer/miniLogicAnalyzer.hex
mla: jeenode upload
logicanalyzer: C := m328p
logicanalyzer: P := Mpe/LogicAnalyzer/
logicanalyzer: I := Mpe/LogicAnalyzer/LogicAnalyzer.hex
logicanalyzer: jeenode upload
pcd8544: C := m328p
pcd8544: P := Misc/nokia_pcd8544_display_testing2/
pcd8544: I := Misc/nokia_pcd8544_display_testing2/nokia_pcd8544_display_testing2.hex
pcd8544: jeenode upload
ledseg: C := m328p
ledseg: P := libraries/LedControl/examples/LCDemo7Segment
ledseg: I := libraries/LedControl/examples/LCDemo7Segment/LCDemo7Segment.hex
ledseg: jeenode upload
ledseg595: C := m328p
ledseg595: P := Mpe/LedSegment595/
ledseg595: I := Mpe/LedSegment595/LedSegment595.hex
ledseg595: jeenode upload
# See ~/project/transistortester
avrtransistortester: E := firmware/TransistorTester.eep
avrtransistortester: M := usbasp
avrtransistortester: X := -B 3
avrtransistortester: _flash
avrtransistortester168: I := firmware/TransistorTester_168.hex
avrtransistortester168: LF := 0xE2
avrtransistortester168: HF := 0xDC
avrtransistortester168: UB := 0x3F
avrtransistortester168: LB := 0x30
avrtransistortester168: C := m168p
avrtransistortester168: avrtransistortester
avrtransistortester328: I := $(wildcard ~/project/transistortester/Software/trunk/mega328_3.3V/TransistorTester.hex)
avrtransistortester328: E := $(wildcard ~/project/transistortester/Software/trunk/mega328_3.3V/TransistorTester.eep)
avrtransistortester328: LF := 0xE2
avrtransistortester328: HF := 0xDC
# 04 is same as FC, E4, etc
avrtransistortester328: EF := 0x04
avrtransistortester328: UB :=
avrtransistortester328: LB :=
avrtransistortester328: C := m328p
avrtransistortester328: M := usbasp
avrtransistortester328: X := -B 3
avrtransistortester328: _flash
#avrtransistortester: E := Misc/AVR-Transistortester_neu/ATmega8/TransistorTestNew.eep
#avrtransistortester: I := Misc/AVR-Transistortester_neu/ATmega8/TransistorTestNew.hex
# XXX: This one gives timeout, circuit change?
#avrtransistortester: E := Mpe/transistortester/Software/trunk/mega8/TransistorTester.eep
#avrtransistortester: I := Mpe/transistortester/Software/trunk/mega8/TransistorTester.hex
at85blink: M:=usbasp
at85blink: BRD:=t85
at85blink: LF:=0x62
at85blink: HF:=0xD9
at85blink: C:=t85
at85blink: X:=-B1
at85blink: P:=Prototype/Blink
at85blink: I:=Prototype/Blink/Blink.hex
at85blink: TARGETS:= clean all
at85blink: _arduino _flash
# micronucleus allows v-usb uploads
# PLL, startup time/powerdown reset: 1K CK/14K CK+64ms
# BODLEVEL: 101 (2.7V)
at85mn: M:=usbasp
at85mn: C:=t85
at85mn: LF:=0xE1
at85mn: HF:=0xDD
at85mn: EF:=0xFE
at85mn: X:=-B12
at85mn: I:=firmware/attiny85-micronucleus-bootloader.hex
at85mn: _flash
at85usb: M:=usbasp
at85usb: BRD:=t85
at85usb: C:=t85
at85usb: X:=-B 3
#-q -q
#no locking:
at85usb: LB:=
at85usb: UB:=
#v-usb atiny fuses:
at85usb: LF:=0xE1
at85usb: HF:=0xDD
#clock out PB4:
#at85usb: LF:=0xA1
#at85usb: HF:=0xDD
#int 1MHz:
#at85usb: LF:=0x62
#at85usb: HF:=0xDF
#clock out PB4:
#at85usb: LF:=0x22
#at85usb: HF:=0xDF
#at85usb: D:=echo
#at85usb: P:=Mpe/BlinkAll/
#at85usb: I:=Mpe/BlinkAll/BlinkAll.hex
#at85usb: TARGETS := clean all
#at85usb: _arduino _flash
at85usb: P:=Mpe/TinyUSB/TinyUSBLedDimmer1
at85usb: I:=Mpe/TinyUSB/TinyUSBLedDimmer1/TinyUSBLedDimmer1.hex
at85usb: TARGETS := clean all
at85usb: _arduino _flash
#at85usb: I:=Misc/usb_tiny85/main.hex
#at85usb: _flash
lcd1602_i2c: C := m328p
lcd1602_i2c: BRD := atmega328
# this is for JeeLabs expander plug
#lcd1602_i2c: P := Mpe/LCD_I2C
#lcd1602_i2c: I := Mpe/LCD_I2C/LCD_I2C.hex
lcd1602_i2c: P := Misc/I2C_LCD_CustomChars_mjkdz
lcd1602_i2c: I := Misc/I2C_LCD_CustomChars_mjkdz/I2C_LCD_CustomChars_mjkdz.hex
lcd1602_i2c: _arduino upload
i2cpir: C := m328p
i2cpir: P := Mpe/I2CPIR/
i2cpir: I := Mpe/I2CPIR/I2CPIR.hex
i2cpir: jeenode upload
all_i2c: C := m328p
all_i2c: BRD := atmega328
all_i2c: P := Mpe/i2c_all/
all_i2c: I := Mpe/i2c_all/i2c_all.hex
all_i2c: _arduino upload
I2CLCD: C := m328p
I2CLCD: P := Prototype/I2CLCD/
I2CLCD: I := Prototype/I2CLCD/I2CLCD.hex
I2CLCD: jeenode upload
rf12mon: C := m328p
rf12mon: P := Misc/rf12mon/
rf12mon: I := Misc/rf12mon/rf12mon.hex
rf12mon: jeenode upload
rf12bert: C := m328p
rf12bert: P := Misc/rf12bert/
rf12bert: I := Misc/rf12bert/rf12bert.hex
rf12bert: jeenode upload
nrfmon: C := m328p
nrfmon: P := Mpe/Milli/
nrfmon: I := Mpe/Milli/Milli.hex
nrfmon: jeenode upload
mbug1: C := m328p
mbug1: P := Mpe/
mbug1: I := Mpe/MoistureBug/MoistureNode/MoistureNode.hex
mbug1: jeenode upload
soarer: I := Misc/Soarer_Converter/firmware/Soarer_at2usb_v1.12_atmega32u4.hex
soarer: M := leonardo
soarer: C := atmega32u4
#soarer: PORT := /dev/ttyACM0
soarer: PORT := $(wildcard /dev/tty.usbmodem*)
soarer: X := -D -v
soarer: SC := samsung
soarer: _upload sc-$(SC)
sc-samsung::
./Misc/Soarer_Converter/tools/scas \
./Misc/Soarer_Converter/samsung-SEM-M2A.sc \
./Misc/Soarer_Converter/samsung.bin
./Misc/Soarer_Converter/tools/scwr ./Misc/Soarer_Converter/samsung.bin
jeedht: C := m328p
jeedht: P := Prototype/DHTTest/JeeLibDHT/
jeedht: I := Prototype/DHTTest/JeeLibDHT/JeeLibDHT.hex
jeedht: jeenode upload
adadht: C := m328p
adadht: P := Prototype/DHTTest/AdafruitDHT/
adadht: I := Prototype/DHTTest/AdafruitDHT/AdafruitDHT.hex
adadht: jeenode upload
pcdthermotest: C := m328p
pcdthermotest: P := Misc/PCD8544_Thermometer/
pcdthermotest: I := Misc/PCD8544_Thermometer/PCD8544_Thermometer.hex
pcdthermotest: jeenode upload
m8guard: C := m8
m8guard: BRD := atmega8
m8guard: M := usbasp
m8guard: X := -B3
m8guard: P := Prototype/TempGuard/Atmega8TempGuard/
m8guard: I := Prototype/TempGuard/Atmega8TempGuard/Atmega8TempGuard.hex
#m8guard: TARGETS := clean all
m8guard: arduino _upload
#dstbus: C := m8
#dstbus: BRD := atmega8
#dstbus: C := m328p
#dstbus: BRD := atmega328
#dstbus: M := usbasp
#dstbus: X := -B3
dstbus: P := Prototype/DallasTempBus/
dstbus: I := Prototype/DallasTempBus/DallasTempBus.hex
dstbus: jeenode upload
lcd5110: C := m328p
lcd5110: P := Prototype/Lcd84x48/
lcd5110: I := Prototype/Lcd84x48/Lcd84x48.hex
lcd5110: jeenode upload
log5110: C := m328p
log5110: P := Prototype/LogReader84x48/
log5110: I := Prototype/LogReader84x48/LogReader84x48.hex
log5110: jeenode upload
thermo5110: C := m328p
thermo5110: P := Prototype/ThermoLog84x48/
thermo5110: I := Prototype/ThermoLog84x48/ThermoLog84x48.hex
thermo5110: jeenode upload
rf24link: C := m328p
rf24link: P := Prototype/RadioLinkRF24
rf24link: I := Prototype/RadioLinkRF24/RadioLinkRF24.hex
rf24link: jeenode upload
rf24node: C := m328p
rf24node: P := Prototype/RF24Node
rf24node: I := Prototype/RF24Node/RF24Node.hex
rf24node: jeenode upload
eeprom: C := m328p
eeprom: P := Prototype/AtmegaEEPROM/
eeprom: I := Prototype/AtmegaEEPROM/AtmegaEEPROM.hex
eeprom: jeenode upload
attemp: C := m328p
attemp: P := Prototype/AtmegaTemp
attemp: I := Prototype/AtmegaTemp/AtmegaTemp.hex
attemp: arduino upload
mmcinfo: C := m328p
mmcinfo: P := Misc/MMC/CardInfo/
mmcinfo: I := Misc/MMC/CardInfo/CardInfo.hex
mmcinfo: jeenode upload
mmc: C := m328p
mmc: P := Prototype/MMC/
mmc: I := Prototype/MMC/MMC.hex
mmc: jeenode upload
jproomnode: C := m328p
jproomnode: P := libraries/JeeLib/examples/RF12/roomNode/
jproomnode: I := libraries/JeeLib/examples/RF12/roomNode/roomNode.hex
jproomnode: jeenode upload
roomnode: C := m328p
roomnode: P := Mpe/RoomNode/
roomnode: I := Mpe/RoomNode/RoomNode.hex
roomnode: jeenode upload
roomnode24: C := m328p
roomnode24: P := Mpe/RoomNodeRF24/
roomnode24: I := Mpe/RoomNodeRF24/RoomNodeRF24.hex
roomnode24: jeenode upload
magnetometer: C := m328p
magnetometer: P := Prototype/Magnetometer/
magnetometer: I := Prototype/Magnetometer/Magnetometer.hex
magnetometer: jeenode upload
# this needs some avr-gcc setup, not working
pff: C := m328p
pff: P := Prototype/MMC/PFF/
pff: I := Prototype/MMC/PFF/PFF.hex
pff: jeenode upload
### Prototypes