Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·90 lines (72 loc) · 3.34 KB
/
Copy pathMakefile
File metadata and controls
executable file
·90 lines (72 loc) · 3.34 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#################################################################
# AUTO GENERATE AT 2026-01-10 11:52:47 BY unify_builder v3.10.4.0
#################################################################
# Usage:
# - Build: make prebuild && make COMPILER_DIR=<dir path>
# - Clean: make clean
# Targets Dependences Chain:
# prebuild
# all -> postbuild -> bin -> elf -> *.o
# Use 'make V=1' to see the full commands
ifdef V
Q =
else
Q = @
endif
COMPILER_DIR ?= /usr
ifneq ($(COMPILER_DIR),)
_PATH_TMP:=$(COMPILER_DIR)/bin:$(PATH)
export PATH=$(_PATH_TMP)
endif
EXE?=
CC=$(COMPILER_DIR)/bin/arm-none-eabi-gcc
AS=$(COMPILER_DIR)/bin/arm-none-eabi-gcc
CXX=$(COMPILER_DIR)/bin/arm-none-eabi-g++
LD=$(COMPILER_DIR)/bin/arm-none-eabi-gcc
AR=$(COMPILER_DIR)/bin/arm-none-eabi-ar
###########################
# targets
###########################
COLOR_END=\033[0m
COLOR_ERR=\033[31;1m
COLOR_WRN=\033[33;1m
COLOR_SUC=\033[32;1m
COLOR_INF=\033[34;1m
.PHONY : all postbuild bin elf prebuild clean
all: postbuild
@echo ==========
@printf "$(COLOR_SUC)ALL DONE.$(COLOR_END)\n"
@echo ==========
clean:
-rm -fv ./build/Debug/*.elf ./build/Debug/*.axf ./build/Debug/*.out
-rm -fv ./build/Debug/*.hex ./build/Debug/*.bin ./build/Debug/*.s19
-rm -rfv ./build/Debug/.obj
prebuild:
@printf "$(COLOR_INF)prebuild ...$(COLOR_END)\n"
@echo nothing to prebuild.
./build/Debug/.obj/src:
$(Q)mkdir -p $@
-include ./build/Debug/.obj/src/main.d
./build/Debug/.obj/src/main.o: ./src/main.c Makefile | ./build/Debug/.obj/src
@echo compiling $< ...
$(Q)$(CC) -c -xc -std=c11 -mcpu=cortex-m3 -mthumb -Og -Wall -g -ffunction-sections -fdata-sections -funsigned-char --specs=nano.specs --specs=nosys.specs -o ./build/Debug/.obj/src/main.o -MMD ./src/main.c
./build/Debug/.obj/start:
$(Q)mkdir -p $@
-include ./build/Debug/.obj/start/startup_stm32f10x_md.d
./build/Debug/.obj/start/startup_stm32f10x_md.o: ./start/startup_stm32f10x_md.s Makefile | ./build/Debug/.obj/start
@echo assembling $< ...
$(Q)$(CC) -c -x assembler-with-cpp -mcpu=cortex-m3 -mthumb -g --specs=nano.specs --specs=nosys.specs -o ./build/Debug/.obj/start/startup_stm32f10x_md.o -MMD ./start/startup_stm32f10x_md.s
-include ./build/Debug/.obj/start/system_stm32f10x.d
./build/Debug/.obj/start/system_stm32f10x.o: ./start/system_stm32f10x.c Makefile | ./build/Debug/.obj/start
@echo compiling $< ...
$(Q)$(CC) -c -xc -std=c11 -mcpu=cortex-m3 -mthumb -Og -Wall -g -ffunction-sections -fdata-sections -funsigned-char --specs=nano.specs --specs=nosys.specs -o ./build/Debug/.obj/start/system_stm32f10x.o -MMD ./start/system_stm32f10x.c
objs = ./build/Debug/.obj/src/main.o ./build/Debug/.obj/start/startup_stm32f10x_md.o ./build/Debug/.obj/start/system_stm32f10x.o
elf: $(objs) Makefile
@printf "$(COLOR_INF)linking ./build/Debug/test.elf ...$(COLOR_END)\n"
$(CC) -mcpu=cortex-m3 -mthumb -T STM32F103C8Tx_FLASH.ld -Wl,--gc-sections -Wl,--print-memory-usage --specs=nano.specs --specs=nosys.specs -Wl,-Map=./build/Debug/test.map -o ./build/Debug/test.elf ./build/Debug/.obj/src/main.o ./build/Debug/.obj/start/startup_stm32f10x_md.o ./build/Debug/.obj/start/system_stm32f10x.o -lm
bin: elf Makefile
@printf "$(COLOR_INF)output binary files ...$(COLOR_END)\n"
$(COMPILER_DIR)/bin/arm-none-eabi-objcopy -O ihex ./build/Debug/test.elf ./build/Debug/test.hex
postbuild: bin
@printf "$(COLOR_INF)postbuild ...$(COLOR_END)\n"
@echo nothing to postbuild.