-
Notifications
You must be signed in to change notification settings - Fork 55
/
Makefile
62 lines (54 loc) · 1.85 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
CROSS_COMPILE = arm-none-eabi-
QEMU_STM32 ?= ../qemu_stm32/arm-softmmu/qemu-system-arm
ARCH = CM3
VENDOR = ST
PLAT = STM32F10x
LIB_PATH = ../freertos-basic/freertos/libraries
CMSIS_LIB = $(LIB_PATH)/CMSIS/$(ARCH)
STM32_LIB = $(LIB_PATH)/STM32F10x_StdPeriph_Driver
CMSIS_PLAT_SRC = $(CMSIS_LIB)/DeviceSupport/$(VENDOR)/$(PLAT)
FREERTOS_SRC = $(LIB_PATH)/FreeRTOS
FREERTOS_INC = $(FREERTOS_SRC)/include/
FREERTOS_PORT_INC = $(FREERTOS_SRC)/portable/GCC/ARM_$(ARCH)/
all: out/main.bin
out/main.bin: main.c stm32_p103.c stm32_p103.h FreeRTOSConfig.h stm32f10x_conf.h
mkdir -p out
$(CROSS_COMPILE)gcc \
-Wl,-Tmain.ld -nostartfiles \
-I. -I$(FREERTOS_INC) -I$(FREERTOS_PORT_INC) \
-I$(LIB_PATH)/CMSIS/CM3/CoreSupport \
-I$(LIB_PATH)/CMSIS/CM3/DeviceSupport/ST/STM32F10x \
-I$(LIB_PATH)/STM32F10x_StdPeriph_Driver/inc \
-fno-common -O0 \
-gdwarf-2 -g3 \
-mcpu=cortex-m3 -mthumb \
-o out/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 \
\
$(FREERTOS_SRC)/croutine.c \
$(FREERTOS_SRC)/list.c \
$(FREERTOS_SRC)/queue.c \
$(FREERTOS_SRC)/tasks.c \
$(FREERTOS_SRC)/portable/GCC/ARM_CM3/port.c \
$(FREERTOS_SRC)/portable/MemMang/heap_1.c \
\
stm32_p103.c \
main.c
$(CROSS_COMPILE)objcopy -Obinary out/main.elf out/main.bin
$(CROSS_COMPILE)objdump -S out/main.elf > out/main.list
qemu: out/main.bin $(QEMU_STM32)
$(QEMU_STM32) -M stm32-p103 -kernel main.bin -semihosting
qemuauto: out/main.bin gdbscript
bash emulate.sh out/main.bin
python log2grasp.py
../grasp_linux/grasp sched.grasp
clean:
rm -rf out log sched.grasp