forked from SKyletoft/mop_templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
49 lines (44 loc) · 2.36 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
# Add files here and remember the backslash on all but the last line
# Yes, startup.c is missing
FILES := \
src/main.c \
src/debug.c
# +---------------------------------------------------------------------------+
# | |
# | If you're just using the templates, there's nothing to look at below this |
# | |
# +---------------------------------------------------------------------------+
# Yes, this is hacky and doesn't allow anything to be cached. I'm not gonna do the research to figure that one out for programs of this scale.
# Merge requests welcome though
build:
-mkdir debug
arm-none-eabi-gcc -c $(FILES) -g -O0 \
-Wall -Wextra -Wpedantic \
-mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft \
-std=gnu17 -I. -I ./inc
arm-none-eabi-g++ -o debug/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -nostartfiles\
-L 'C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v6-m/nofp' \
-L /usr/include/newlib/c++/9.2.1/arm-none-eabi/thumb/v6-m/nofp -L/usr/lib/arm-none-eabi/newlib/thumb/v6-m/nofp \
-L /usr/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp
arm-none-eabi-objcopy -S -O srec debug/MOP debug/MOP.s19
arm-none-eabi-objdump -D -S debug/MOP > debug/MOP.dass
-mv *.o debug # Unix
-move *.o debug # Windows
build-release:
-mkdir release
arm-none-eabi-gcc -c src/startup.c -g -Os \
-w \
-mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft \
-std=gnu17 -I. -I ./inc
arm-none-eabi-gcc -c $(FILES) -g -Os \
-Wall -Wextra -Werror \
-mthumb -march=armv6-m -mno-unaligned-access -mfloat-abi=soft \
-std=gnu17 -I. -I ./inc
arm-none-eabi-g++ -o release/MOP -L. *.o -lgcc -lc_nano -Tmd407-ram.x -nostartfiles\
-L 'C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.10/lib/gcc/arm-none-eabi/10.3.1/thumb/v6-m/nofp' \
-L /usr/include/newlib/c++/9.2.1/arm-none-eabi/thumb/v6-m/nofp -L/usr/lib/arm-none-eabi/newlib/thumb/v6-m/nofp \
-L /usr/lib/gcc/arm-none-eabi/9.2.1/thumb/v6-m/nofp
arm-none-eabi-objcopy -S -O srec release/MOP release/MOP.s19
arm-none-eabi-objdump -D -S release/MOP > release/MOP.dass
-mv *.o release # Unix
-move *.o release # Windows