-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
886 lines (749 loc) · 20.1 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
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
##
# @file Makefile
# @brief General makefile for EMF32GG
# @version v1.5
# @date 10/11/2023
#
# @note CMSIS library used
#
# @note It works now with gnuwin32 Make. It can be find in
# http://gnuwin32.sourceforge.net/packages/make.htm
#
# @note Options:
# @param all generate image file
# @param build generate the axf file
# @param flash write image file into microcontroller
# @param edit open source files for editing
# @param debug creates debug session (default: gdb}
# @param gdb creates debug session with gdb (same as debug}
# @param tui creates debug session with gdb text user interface
# @param ddd creates debug session with ddd
# @param nemiver creates debug session with nemiver
# @param size show code size
# @param nm list symbols
# @param dis disassemble output file into ${OBJDIR}/${PROGNAME}.S
# @param dump generate a hexadecimal dump file into ${OBJDIR}/${PROGNAME}.dump
# @param term open a terminal for serial communication to board
# @param openocd start an openOCD proxy
# @param gdbproxy start a GDB proxy
# @param docs generates docs using doxygen
# @param stack-report generates a stack usage report
# @param cflow generates flow (call) map
# @param touch forces compilation of all modules by next build
#
#
# @note There is support for JLink and OpenOCD. The OpenOCD is not fully tested.
# The OpenOCD is not fully tested
#
###############################################################################
# Main parameters #
###############################################################################
#
# Program name
#
PROGNAME=tt2
#
# Verbose output for Make (Coment to have verbose output}
#
#MAKEFLAGS+= --silent --no-print-directory
.SILENT:
#
# Compatibility Windows/Linux
#
ifeq (${OS},Windows_NT)
HOSTOS :=Windows
else
HOSTOS :=${shell uname -s}
endif
#
# Test if it is run inside or by vs code. If so, disable some unneeded targets like edit,. gdb. tui. ...
#
ifdef VSCODE_CLI
INSIDEVSCODE:=yes
else
INSIDEVSCODE:=no
endif
#
# Defines the part (device} that this project uses
PART=EFM32GG990F1024
# Used to find correct CMSIS include file
PARTCLASSCMSIS=EFM32GG
#
# Source files
#
SRCFILES=${wildcard *.c}
#SRCFILES= main.c
#
# Include the common make definitions.
#
PREFIX:=arm-none-eabi
#
# Set debug mode
#
DEBUG=y
#
# Gecko_SDK DIr
#
GECKOSDKDIR=../../Gecko_SDK
#
# CMSIS header files folders (ARM and manufacturer specific)
#
# Use CMSIS inside Gecko SDK
CMSISDIR=${GECKOSDKDIR}/platform/CMSIS
CMSISDEVINCDIR=${GECKOSDKDIR}/platform/Device/SiliconLabs/EFM32GG/Include
#
# Commands Linux/Windows
#
ifeq (${HOSTOS},Windows)
RM=rmdir /s /q
MKDIR=mkdir
MV=move
CP=copy
NOOUT= > NUL
else
RM=rm -rf
MKDIR=mkdir -p
MV=mv
CP=cp
NOOUT=
endif
#
# When using VSCODE
#
ifeq (${INSIDEVSCODE},yes)
#
# SVC Dir contains the SVC files.
# This is only needed for the Cortex Debug extension of VS Code
#
# See https://www.silabs.com/community/mcu/32-bit/knowledge-base.entry.html/
# 2017/07/04/svd_file_for_efm32d-gRFh
#
SVCDIR :=../../SVD-${PARTCLASSCMSIS}
endif
#
# Default target
#
#default: usage
default: build
#
# Compiler parameters
# See readme.txt in the the share/doc/gcc-arm-none-eabi/ subfolder
# of the GNU ARM installation folder
#
# The EFM32GG990F1024 is a Cortex M3 processor with a1024 MByte Flash memory and
# a 128KByte RAM.
# It has no FPU!. So it will use a software emulation of the FPU (default)
#
# The default printf and scanf functions do not support floating point data.
# In order to use printf and scanf that support floating point,
# the *-u _printf_float* and *-u scanf_float* parameters must be set during compilation
#
CPUFLAGS= -mcpu=cortex-m3 -mthumb
FPUFLAGS= -mfloat-abi=soft
#
# Specs script (modification of compiler and linker flags}
#
# This parameter is only recognized by gcc.
# Linking must be done by a gcc call instead of ld
#
# Alternatives are:
# nosys.specs: no libc or libm
# nano.specs: minimal libc (newlib-nano)
# rdimon.specs: semihosting (serial interface thru debug lines)
# rdpmon.specs: RDP
# redboot.specs:
# picolibc.specs:
#
SPECFLAGS= --specs=nano.specs
ifeq (${INSIDEVSCODE},no)
#
# default debugger
#
debug: gdb
#debug: tui
#debug: ddd
#debug: nemiver
endif
#
# Folder for object files
#
OBJDIR=gcc
#
# Object files
#
OBJFILES=${addprefix ${OBJDIR}/,${SRCFILES:.c=.o}}
#
# Use sections to optimize code generation.
# Functions and data are put in separated sections.
# The linker can drop a (function or data) section
# if there is no reference to i
#
ASECTIONS= -ffunction-sections \
-fdata-sections \
CSECTIONS= -ffunction-sections \
-fdata-sections \
LSECTIONS= -gc-sections
#
# C Error and Warning Messages Flags
#
CERRORFLAGS= \
-Wall \
-std=c11 \
-pedantic \
#
# Include path
#
CMSISINCDIR= ${CMSISDIR}/Include
INCLUDEPATH= ${CMSISDEVINCDIR} ${CMSISINCDIR}
###############################################################################
# Compilation parameters #
###############################################################################
#
#
# The flags passed to the assembler.
#
AFLAGS= \
${CPUFLAGS} \
${FPUFLAGS} \
${addprefix -I ,${INCLUDEPATH}} \
${ASECTIONS} \
#
# The flags passed to the compiler.
#
CFLAGS= \
${CPUFLAGS} \
${FPUFLAGS} \
${addprefix -I ,${INCLUDEPATH}} \
${CSECTIONS} \
-D${PART} \
#
# To generate map output file
#
MAPFLAGS= -Map,${OBJDIR}/${PROGNAME}.map
#
# The flags passed to the linker.
#
# For now only one parameter when using gcc to link
#
LDFLAGS= \
${LSECTIONS} \
${MAPFLAGS} \
#
# Generate debug version if DEBUG is set
#
ifneq (${DEBUG},)
CFLAGS+=-g -D DEBUG -O0
else
CFLAGS+=-Os
endif
#
# Additional Flags
#
CFLAGS+= -Wuninitialized -Werror
#
# Controlling dependencies on header files
#
DEPFLAGS=-MT $@ -MMD -MP -MF ${OBJDIR}/$*.d
#
# libraries linked
#
# Thery are modified by the specs files
#
#LIBS=-lm -lc -lgcc
LIBS=
#
#
#
###############################################################################
# Generally it is not needed to modify the lines bellow #
###############################################################################
###############################################################################
# Commands #
###############################################################################
#
# Terminal application (used to open new windows in debug}
#
#TERMAPP=xterm
TERMAPP=gnome-terminal
#
# The command for calling the compiler.
#
CC=${PREFIX}-gcc
#
# The command for calling the library archiver.
#
AR=${PREFIX}-ar
#
# The command for calling the linker
# Using gcc instead of ld to use --specs parameters
# To try:
# -ffunction-sections
# -fdata-sections
# -fno-builtin
# -nostdlib
# -nodefaultlibs
# ???
#
COMMA=,
LD=${PREFIX}-gcc ${CFLAGS} -nostartfiles ${addprefix -Wl${COMMA},${LDFLAGS}}
#LD=${PREFIX}-ld ${LDFLAGS}
#
# The command for extracting images from the linked executables.
#
OBJCOPY=${PREFIX}-objcopy
#
# The command for disassembly
#
OBJDUMP=${PREFIX}-objdump
#
# The command for listing size of code
#
OBJSIZE=${PREFIX}-size
#
# The command for listing symbol table
#
OBJNM=${PREFIX}-nm
#
# Debuggers
#
## GDB with and without TUI
GDB=${PREFIX}-gdb
## nemiver
NEMIVER=nemiver
NEMIVERFLAGS=
## ddd
DDD=ddd
DDDFLAGS=
## cdbg
CDBG=cdbg
CDBGFLAGS=
## kdbg
KDBG=kdbg
KDBGFLAGS=
#
# GUI Editor
#
GUIEDITOR=gedit --new-window
#GUIEDITOR=geany
#
# Doxygen
#
DOXYGEN=doxygen
#
# cflow to generate call graphs
#
CFLOW=cflow
CFLOWFLAGS=-l -b --omit-arguments
#
# Generation of stack usage report
#
# There are some options for the generation of the stack usage report
#
# 1. puncover: /~https://github.com/HBehrens/puncover/
# 2. stack-usage: /~https://github.com/sharkfox/stack-usage
# Alternatives not implemented
# 3. worst-case-stack: /~https://github.com/PeterMcKinnis/WorstCaseStack
# 4. check-stack-usage: /~https://github.com/ttsiodras/checkStackUsage
#
# OBS:
# stack-usage demands compilation with certain flags for the generation of
# auxiliary files
#
#
stack-report=stack-usage
#stack-report=puncover
#
# Programs
#
PUNCOVER=puncover
STACKUSAGE=stack-usage
# Only needed for stack-usage
CFLAGS += -fstack-usage -fdump-ipa-cgraph
#
# Options for flash and debug
#
USE_JLINK=yes
#USE_OPENOCD=yes
###############################################################################
# Command parameters #
###############################################################################
ifeq (${USE_JLINK},yes)
#
# JLink
#
ifeq (${HOSTOS},Windows)
# For Windows
JLINK=JLink
GDBPROXY=JLinkGDBServer
JLINKPARMS= -Device ${PART} -If SWD -Speed 4000
JLINKFLASHSCRIPT=${OBJDIR}/flash.jlink
else
# For Linux
JLINK=JLinkExe
GDBPROXY=JLinkGDBServer
JLINKPARMS= -Device ${PART} -If SWD -Speed 4000
JLINKFLASHSCRIPT=${OBJDIR}/flash.jlink
endif
endif
ifeq (${USE_OPENOCD},yes)
#
# OpenOCD
#
OPENOCD=openocd
GPDBPROXY=openocd
OPENOCDSCRIPTDIR=/usr/share/openocd/scripts
OPENOCDFLAGS= -f ${OPENOCDSCRIPTDIR}/interface/stlink-v2.cfg \
-f ${OPENOCDSCRIPTDIR}/target/efm32_stlink.cfg
endif
#
# Flags for disassembler
#
ODDISFLAGS= -x -S -D
ODDUMPFLAGS= -x -s
#
# Doxygen parameters
#
DOXYGENCFG=Doxyfile
#
# Project name (for Doxygen}
#
PROJNAME=${shell basename ${CURDIR}}
#
# Serial terminal communication
#
TTYTERM=/dev/ttyACM0
TTYBAUD=115200
#
# Serial terminal emulator
#
# Use one of configuration below
# cu
#TTYPROG=cu
#TTYPARMS=-l ${TTYTERM} -s ${TTYBAUD}
# screen
#TTYPROG=screen
#TTYPARMS= ${TTYTERM} ${TTYBAUD}
# minicom
TTYPROG=minicom
TTYPARMS=-D ${TTYTERM} -b ${TTYBAUD}
# putty
#TTYPROG=putty
# tip
#TTYPROG=tip
#TTYPARMS=-${TTYBAUD} ${TTYTERM}
#
# The flags passed to the debugger
#
GDBFLAGS=-x ${GDBINIT} -n
#
# GDB initialization file
#
GDBINIT=${OBJDIR}/gdbinit
#
# Linker script
#
#LINKERSCRIPT=${PROGNAME}.ld
LINKERSCRIPT=efm32gg.ld
#LINKERSCRIPT=${shell echo ${PART}| tr A-Z a-z}.ld
#
# Entry Point
#
ENTRY=Reset_Handler
###############################################################################
# Rules #
###############################################################################
#
# The rule for building the object file from each C source file.
#
${OBJDIR}/%.o: %.c
@echo "Compiling ${<}"
${CC} -c ${CFLAGS} ${SPECFLAGS} -D${OBJDIR} ${DEPFLAGS} -o ${@} ${<}
#
# The rule for building the object file from each assembly source file.
#
${OBJDIR}/%.o: %.S
@echo "Assembling ${<}"
${CC} -c ${AFLAGS} ${SPECFLAGS} -D${OBJDIR} -o ${@} -c ${<}
#
# The rule for creating an object library.
#
${OBJDIR}/%.a:
@echo "Archiving ${@}"
${AR} -cr ${@} ${^}
#
# The rule for linking the application.
#
# LDFLAGS are incorporated in the LD symbol, because
# it is used differently by gcc and ld
#
${OBJDIR}/%.axf: ${OBJFILES}
@echo "Linking ${@}"
${LD} -T '${LINKERSCRIPT}' \
${SPECFLAGS} \
-Wl,--print-memory-usage \
--entry '${ENTRY}' \
-o ${@} \
${OBJFILES} \
${LIBS}
${OBJDIR}/%.bin: ${OBJDIR}/%.axf
@echo "Generating binary ${@}"
${OBJCOPY} -O binary ${^} ${@}
###############################################################################
# Targets #
###############################################################################
#
#
#
help: usage
usage:
@echo "Usage:"
@echo "make all generate image file in ${OBJDIR}"
@echo "make build generate .axf file in "
@echo "make edit open files in a editor"
@echo "make flash write to flash using ${FLASHER}"
@echo "make clean delete all generated files"
@echo "make debug creates debug session with gdb"
@echo "make gdb creates debug session with gdb (same as debug}"
@echo "make tui creates debug session with gdb text user interface"
@echo "make ddd creates debug session with ddd"
@echo "make nemiver creates debug session with nemiver"
@echo "make dis disassemble output file into ${OBJDIR}/${PROGNAME}.S"
@echo "make dump generate a hexadecimal dump file into ${OBJDIR}/${PROGNAME}.dump"
@echo "make nm list symbol table in standard output"
@echo "make size list size of output file"
@echo "make term open a terminal for serial communication to board"
@echo "make openocd start an openOCD proxy"
@echo "make gdbproxy start a GDB proxy"
@echo "make docs generates docs using doxygen"
@echo "make stack-report generates a stack usage report"
@echo "make cflow generates flow (call) map"
@echo "make touch forces compilation of all modules by next build"
@echo "make stack-report generates a stack usage report"
@echo "make cflow generates flow (call) map"
@echo "make touch forces compilation of all modules by next build"
#
# The default rule, which causes the ${PROGNAME} example to be built
# and generates a binary file, that is ready to be flashed.
#
all: ${OBJDIR} ${OBJDIR}/${PROGNAME}.bin
@echo Done
#
# The default rule, which causes the ${PROGNAME} example to be built.
#
build: ${OBJDIR} ${OBJDIR}/${PROGNAME}.axf
@echo Done
#
# Transfer binary to board
#
flash: deploy
burn: deploy
ifeq (${USE_JLINK},yes)
deploy: ${OBJDIR} svd ${OBJDIR}/${PROGNAME}.bin ${JLINKFLASHSCRIPT}
echo ${JLINK} ${JLINKPARMS} -CommanderScript ${JLINKFLASHSCRIPT}
${JLINK} ${JLINKPARMS} -CommanderScript ${JLINKFLASHSCRIPT}
#
# Flash script
#
${JLINKFLASHSCRIPT}: FORCE
echo r > ${JLINKFLASHSCRIPT}
echo h >> ${JLINKFLASHSCRIPT}
echo loadbin ${OBJDIR}/${PROGNAME}.bin,0 >> ${JLINKFLASHSCRIPT}
echo exit >> ${JLINKFLASHSCRIPT}
FORCE:
endif
ifeq (${USE_OPENOCD},yes)
deploy: svd ${OBJDIR}/${PROGNAME}.bin ${OPENOCDFLASHSCRIPT}
sudo ${OPENOCD} -f ${OPENOCDBOARD} -f ${OPENOCDFLASHSCRIPT}
#
# Flash script
#
${OPENOCDFLASHSCRIPT}:
echo reset halt > ${OPENOCDFLASHSCRIPT}
echo flash probe 0 >> ${OPENOCDFLASHSCRIPT}
echo flash write_image erase ${OBJDIR}/${PROGNAME}.bin 0 >> ${OPENOCDFLASHSCRIPT}
echo reset run >> ${OPENOCDFLASHSCRIPT}
endif
#
# Disassembling/Dump
#
dis: disassembly
disassembly: ${OBJDIR}/${PROGNAME}.axf
@echo "Disassembling ${^} and storing output in ${OBJDIR}/${PROGNAME}.S"
${OBJDUMP} ${ODDISFLAGS} $^ > ${OBJDIR}/${PROGNAME}.S
dump: ${OBJDIR}/${PROGNAME}.axf
@echo "Dumping ${^} and storing output in ${OBJDIR}/${PROGNAME}.dump"
${OBJDUMP} ${ODDUMPFLAGS} $^ > ${OBJDIR}/${PROGNAME}.dump
imagedump: ${OBJDIR}/${PROGNAME}.bin
$\{OBJDUMP} -x $^ > ${OBJDIR}/${PROGNAME}.hexdump
#
# List size
#
size: ${OBJDIR}/${PROGNAME}.axf
${OBJSIZE} -A -x $^
#
# List size
#
nm: ${OBJDIR}/${PROGNAME}.axf
${OBJNM} $^
#
# The rule to create the target directory.
#
${OBJDIR}:
${MKDIR} ${OBJDIR}
#
# Rules for building the ${PROGNAME} example.
#
${OBJDIR}/${PROGNAME}.bin: ${OBJDIR}/${PROGNAME}.axf
${OBJDIR}/${PROGNAME}.axf: ${OBJFILES}
ifeq (${INSIDEVSCODE},no)
#
# Open files in editor windows
#
edit:
${GUIEDITOR} Makefile *.c *.h *.ld &
#
# Debug with gdb
#
gdb: ${OBJDIR}/${PROGNAME}.bin ${GDBINIT}
${GDB} ${GDBFLAGS} ${OBJDIR}/${PROGNAME}.axf
#
# Debug using gdb with tui (text user interface}
#
tui: ${OBJDIR}/${PROGNAME}.bin ${GDBINIT}
${GDB} --tui ${GDBFLAGS} ${OBJDIR}/${PROGNAME}.axf
#
# Debug using ddd
#
ddd: ${OBJDIR}/${PROGNAME}.bin ${GDBINIT}
${DDD} ${DDDFLAGS} --debugger "${GDB} ${GDBFLAGS}" ${OBJDIR}/${PROGNAME}.axf
#
# Debug using nemiver
#
nemiver: ${OBJDIR}/${PROGNAME}.bin ${GDBINIT}
${NEMIVER} ${NEMIVERFLAGS} --remote=localhost:2331 --gdb-binary=`which ${GDB}` ${OBJDIR}/${PROGNAME}.axf
#
# Debug using cgdb GUI
#
cgdb: ${OBJDIR}/${PROGNAME}.bin ${GDBINIT}
${CGDB} -d `which ${GDB}` -x ${OBJDIR}/gdbinit ${OBJDIR}/${PROGNAME}.axf
#
# Debug using kdbg GUI
#
kdbg: ${OBJDIR}/${PROGNAME}.bin ${GDBINIT}
${KDBG} -r localhost:2331 ${OBJDIR}/${PROGNAME}.axf
endif
#
# Start GDB proxy
#
ifeq (${USE_JLINK},yes)
proxy: gdbproxy
gdbproxy:
echo "Starting GDB Proxy"; \
echo sh -c \" ${GDBPROXY} ${JLINKPARMS} \" ; \
${TERMAPP} -- ${GDBPROXY} ${JLINKPARMS} ; \
#
# Create gdbinit
#
${GDBINIT}: FORCE
echo # Run this script using gdb source command > ${GDBINIT}
echo target remote localhost:2331 >> ${GDBINIT}
echo monitor halt >> ${GDBINIT}
echo load ${OBJDIR}/${PROGNAME}.axf >> ${GDBINIT}
echo monitor reset >> ${GDBINIT}
echo break main >> ${GDBINIT}
echo monitor go >> ${GDBINIT}
endif
ifeq (${USE_OPENOCD},yes)
proxy: gdbproxy
gdbproxy:
if [ -c ${TTYTERM} ] ; then echo "Starting OpenOCD"; \
${TERMAPP} -- ${GDBPROXY} -f ${OPENOCDBOARD} ; \
else echo "Could not open ${GDBPROXY}"; fi
#
# Create gdbinit
#
${GDBINIT}:
echo # Run this script using gdb source command > ${GDBINIT}
echo target remote localhost:3333 >> ${GDBINIT}
echo break main >> ${GDBINIT}
echo continue >> ${GDBINIT}
endif
#
# Open a terminal windows
# OBS: Remove or disable modemmanager in case of busy device
#
terminal: term
term:
if [ -c ${TTYTERM} ] ; then echo Starting terminal; \
${TERMAPP} -- ${TTYPROG} ${TTYPARMS} ; \
else echo "Could not open ${TTYTERM}"; fi
#
# Generate documentation using doxygen
#
docs: doxygen
doxygen: ${DOXYGENCFG}
${DOXYGEN} ${DOXYGENCFG}
echo Done.
SEDSCRIPT=dox.sed
${DOXYGENCFG}:
${DOXYGEN} -g ${DOXYGENCFG}
echo /^PROJECT_NAME/cPROJECT_NAME = \"${PROJNAME}\" > ${SEDSCRIPT}
echo /^FULL_PATH_NAMES/cFULL_PATH_NAMES = NO >> ${SEDSCRIPT}
echo /^OPTIMIZE_OUTPUT_FOR_C/cOPTIMIZE_OUTPUT_FOR_C = YES >> ${SEDSCRIPT}
echo /^DISTRIBUTE_GROUP_DOC/cDISTRIBUTE_GROUP_DOC = YES >> ${SEDSCRIPT}
echo /^EXTRACT_STATIC/cEXTRACT_STATIC = YES >> ${SEDSCRIPT}
sed -i -f ${SEDSCRIPT} ${DOXYGENCFG}
-${RM} ${SEDSCRIPT}
#
# Clean the generated documentation
#
docs-clean:
-${RM} html latex && echo Done.
#
# Clean out all the generated files
#
clean:
-$(RM) ${OBJDIR} ${wildcard *~} html latex docs NOOUT
-$(RM) .vscode/*.log NOOUT
echo Done
#
# Copy the SVD to OBJDIR folder
#
ifeq (${INSIDEVSCODE},yes)
svd: ${OBJDIR} ${OBJDIR}/${PART}.svd
else
svd:
endif
${OBJDIR}/${PART}.svd: FORCE
-${CP} - ${SVCDIR}/${PART}.svd ${OBJDIR}
#
# generates a call graph
#
cflow:
${CFLOW} ${CFLOWFLAGS} -D${PART} ${addprefix -I ,${INCLUDEPATH}} ${SRCFILES} 2>&1 \
| egrep -v "^cflow"
#
# Generates the stack usage report
#
puncover: ${OBJDIR}/${PROGNAME}.axf
${PUNCOVER} --elf-file ${OBJDIR}/${PROGNAME}.axf
@echo "Open http://localhost:5000"
stack-usage: ${OBJDIR}/${PROGNAME}.axf
cd ${OBJDIR} && \
find . -name '*.cgraph' | grep -v stack-usage-log | xargs cat > stack-usage-log.cgraph && \
find . -name '*.su' | grep -v stack-usage-log | xargs cat > stack-usage-log.su && \
${STACKUSAGE} --csv stack-usage.csv --json stack-usage.json
#
# Touch: Force compilation of all C modules
#
touch:
@touch *.c *.h && echo Done.
# These symbols are not files (or directories}
.PHONY: nm edit debug terminal term doxygen docs docs-clean cflow touch puncover stack-usage
.PHONY: all burn clean debug default deploy deploy dis disassembly
.PHONY: docs docs-clean doxygen dump edit flash gdbproxy proxy
.PHONY: help imagedump nm size term terminal usage svd
#
# Dependencies
#
-include ${OBJFILES:%.o=%.d}