forked from embedded2014/rtenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (77 loc) · 2.21 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
CROSS_COMPILE ?= arm-none-eabi-
CC := $(CROSS_COMPILE)gcc
QEMU_STM32 ?= ../qemu_stm32/arm-softmmu/qemu-system-arm
ARCH = CM3
VENDOR = ST
PLAT = STM32F10x
LIBDIR = .
CMSIS_LIB=$(LIBDIR)/libraries/CMSIS/$(ARCH)
STM32_LIB=$(LIBDIR)/libraries/STM32F10x_StdPeriph_Driver
CMSIS_PLAT_SRC = $(CMSIS_LIB)/DeviceSupport/$(VENDOR)/$(PLAT)
all: main.bin
main.bin: kernel.c context_switch.s syscall.s syscall.h
$(CROSS_COMPILE)gcc \
-DUSER_NAME=\"$(USER)\" \
-Wl,-Tmain.ld -nostartfiles \
-I . \
-I$(LIBDIR)/libraries/CMSIS/CM3/CoreSupport \
-I$(LIBDIR)/libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x \
-I$(CMSIS_LIB)/CM3/DeviceSupport/ST/STM32F10x \
-I$(LIBDIR)/libraries/STM32F10x_StdPeriph_Driver/inc \
-fno-common -ffreestanding -O0 \
-gdwarf-2 -g3 \
-mcpu=cortex-m3 -mthumb \
-o main.elf \
\
$(CMSIS_LIB)/CoreSupport/core_cm3.c \
$(CMSIS_PLAT_SRC)/system_stm32f10x.c \
$(CMSIS_PLAT_SRC)/startup/gcc_ride7/startup_stm32f10x_md.s \
$(STM32_LIB)/src/stm32f10x_rcc.c \
$(STM32_LIB)/src/stm32f10x_gpio.c \
$(STM32_LIB)/src/stm32f10x_usart.c \
$(STM32_LIB)/src/stm32f10x_exti.c \
$(STM32_LIB)/src/misc.c \
\
context_switch.s \
syscall.s \
stm32_p103.c \
kernel.c \
memcpy.s
$(CROSS_COMPILE)objcopy -Obinary main.elf main.bin
$(CROSS_COMPILE)objdump -S main.elf > main.list
qemu: main.bin $(QEMU_STM32)
$(QEMU_STM32) -M stm32-p103 -kernel main.bin
qemudbg: main.bin $(QEMU_STM32)
$(QEMU_STM32) -M stm32-p103 \
-gdb tcp::3333 -S \
-kernel main.bin
qemu_remote: main.bin $(QEMU_STM32)
$(QEMU_STM32) -M stm32-p103 -kernel main.bin -vnc :1
qemudbg_remote: main.bin $(QEMU_STM32)
$(QEMU_STM32) -M stm32-p103 \
-gdb tcp::3333 -S \
-kernel main.bin \
-vnc :1
qemu_remote_bg: main.bin $(QEMU_STM32)
$(QEMU_STM32) -M stm32-p103 \
-kernel main.bin \
-vnc :1 &
qemudbg_remote_bg: main.bin $(QEMU_STM32)
$(QEMU_STM32) -M stm32-p103 \
-gdb tcp::3333 -S \
-kernel main.bin \
-vnc :1 &
emu: main.bin
bash emulate.sh main.bin
qemuauto: main.bin gdbscript
bash emulate.sh main.bin &
sleep 1
$(CROSS_COMPILE)gdb -x gdbscript&
sleep 5
qemuauto_remote: main.bin gdbscript
bash emulate_remote.sh main.bin &
sleep 1
$(CROSS_COMPILE)gdb -x gdbscript&
sleep 5
clean:
rm -f *.elf *.bin *.list