forked from embedded2013/gdb-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (47 loc) · 1.44 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
CROSS_COMPILE=arm-none-eabi-
QEMU_STM32 ?= ../qemu_stm32/arm-softmmu/qemu-system-arm
ARCH=CM3
VENDOR=ST
PLAT=STM32F10x
CMSIS_LIB=libraries/CMSIS/$(ARCH)
STM32_LIB=libraries/STM32F10x_StdPeriph_Driver
QLOG_FILE=qemu.log
GLOG_FILE=gdb.log
all: main.bin
main.bin: main.c
$(CROSS_COMPILE)gcc \
-DUSE_STDPERIPH_DRIVER \
-Wl,-Tmain.ld -nostartfiles \
-I. -Ilibraries/CMSIS/CM3/CoreSupport \
-Ilibraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x \
-Ilibraries/STM32F10x_StdPeriph_Driver/inc \
-fno-common -O0 \
-gdwarf-2 -g3 \
-mcpu=cortex-m3 -mthumb \
-o main.elf \
\
$(CMSIS_LIB)/CoreSupport/core_cm3.c \
$(CMSIS_LIB)/DeviceSupport/$(VENDOR)/$(PLAT)/system_stm32f10x.c \
$(CMSIS_LIB)/DeviceSupport/$(VENDOR)/$(PLAT)/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 \
\
main.c
$(CROSS_COMPILE)objcopy -Obinary main.elf main.bin
$(CROSS_COMPILE)objdump -S main.elf > main.list
qemu: main.bin
$(QEMU_STM32) -M stm32-p103 -kernel main.bin
qemudbg: main.bin
$(QEMU_STM32) -M stm32-p103 \
-gdb tcp::3333 -S \
-kernel main.bin
gdbauto: main.bin
rm -f $(QLOG_FILE) $(GLOG_FILE)
./start_and_log_qemu.sh $(QEMU_STM32) $(QLOG_FILE) &
sleep 1
$(CROSS_COMPILE)gdb -x gdb.in && ./check_result.sh $(QLOG_FILE) $(GLOG_FILE)
emu: main.bin
bash emulate.sh main.bin
clean:
rm -f *.elf *.bin *.list $(QLOG_FILE) $(GLOG_FILE) target_settings .check_target_settings