-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatformio.ini
More file actions
186 lines (150 loc) · 5.61 KB
/
Copy pathplatformio.ini
File metadata and controls
186 lines (150 loc) · 5.61 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
;在配置文件中分号开头为注释
[platformio]
;指定源文件夹
src_dir = ./
;指定库文件夹'
lib_dir = ./
;指定编译板卡
;default_envs = genericSTM32F411CE
;board_dir = boards
[env]
;build_type = release
;release_build_flags = Og -g0
build_type = debug
debug_build_flags = -Og -g3 -ggdb
;选择下载的仿真器,这里是选择的jlink,如果不设置默认stlink
;upload_protocol = stlink
upload_protocol = jlink
;Debug tool
;debug_tool = stlink
debug_tool = jlink
;指定库的版本
platform = ststm32
platform_packages =
;toolchain-gccarmnoneeabi @ 1.110301
toolchain-gccarmnoneeabi @ 1.100301
;-------------------------------STM32F411CE--------------------------------
[STM32F411CE_DEFINE]
board_name = genericSTM32F411CE
startup = BSP/startup_stm32f411xe.s
linker_script = BSP/STM32F411CEUx_FLASH.ld
MCU = STM32F411xE
bsp_dir = BSP
usb_dir = USB_HID_DRIVER_F411
freertos_dir = D:/github/FreeRTOS/Source
hal_dir = D:/github/STM32Cube_FW/STM32CubeF4/Drivers/STM32F4xx_HAL_Driver
cmsis_dir = D:/github/STM32Cube_FW/STM32CubeF4/Drivers/CMSIS
[env:genericSTM32F411CE]
;配置平台和板子
board = ${STM32F411CE_DEFINE.board_name}
debug_tool = jlink
;选择编译文件的所在路径,这里包含了源文件路径,启动文件,驱动库和rtos路径。如果+<*>便是路径下的所以文件,-<.git/>便是忽略.git路径下的文件
;----------------------------------------------------------------
; Startupup File
;----------------------------------------------------------------
build_src_filter = +<${STM32F411CE_DEFINE.startup}>
;----------------------------------------------------------------
; Source files
;----------------------------------------------------------------
+<${STM32F411CE_DEFINE.bsp_dir}/Core/>
; HAL driver
; Please delete STM32CubeF1\Drivers\STM32F4xx_HAL_Driver\Src\*_template.c
+<${STM32F411CE_DEFINE.hal_dir}/>
; USB Driver
+<${STM32F411CE_DEFINE.usb_dir}/Middlewares/ST/STM32_USB_Device_Library/>
+<${STM32F411CE_DEFINE.usb_dir}/USB_DEVICE/>
;FreeRTOS common
+<${STM32F411CE_DEFINE.freertos_dir}/tasks.c>
+<${STM32F411CE_DEFINE.freertos_dir}/list.c>
+<${STM32F411CE_DEFINE.freertos_dir}/continue.c>
+<${STM32F411CE_DEFINE.freertos_dir}/event_groups.c>
+<${STM32F411CE_DEFINE.freertos_dir}/queue.c>
+<${STM32F411CE_DEFINE.freertos_dir}/stream_buffer.c>
+<${STM32F411CE_DEFINE.freertos_dir}/timers.c>
; FreeRTOS device dependencies
+<${STM32F411CE_DEFINE.freertos_dir}/portable/MemMang/heap_4.c>
+<${STM32F411CE_DEFINE.freertos_dir}/portable/GCC/ARM_CM4F>
; source
+<Src/>
;----------------------------------------------------------------
; Linker File
;----------------------------------------------------------------
;选择链接文件
board_build.ldscript = ${STM32F411CE_DEFINE.linker_script}
;framework = stm32cube(不用framework了)
;编译配置-D是宏定义,-Idir是include文件目录,读者可按自己项目结构更改
;build_unflags = -std=gnu++11
build_flags =
;-std=c++17
;配置全局宏
-D ${STM32F411CE_DEFINE.MCU}
-D USE_HAL_DRIVER
-D DEBUG
;配置头文件路径
-I${STM32F411CE_DEFINE.bsp_dir}/Core/Inc
;----------------------------------------------------------------
; HAL Drivers
;----------------------------------------------------------------
-I${STM32F411CE_DEFINE.hal_dir}/Inc
-I${STM32F411CE_DEFINE.hal_dir}/Inc/Legacy
-I${STM32F411CE_DEFINE.cmsis_dir}/Device/ST/STM32F4xx/Include
-I${STM32F411CE_DEFINE.cmsis_dir}/Include
;----------------------------------------------------------------
; USB Drivers
;----------------------------------------------------------------
-I${STM32F411CE_DEFINE.usb_dir}/Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Inc
-I${STM32F411CE_DEFINE.usb_dir}/Middlewares/ST/STM32_USB_Device_Library/Core/Inc
-I${STM32F411CE_DEFINE.usb_dir}/USB_DEVICE/App
-I${STM32F411CE_DEFINE.usb_dir}/USB_DEVICE/Target
;----------------------------------------------------------------
; FreeRTOS Drivers
;----------------------------------------------------------------
-I${STM32F411CE_DEFINE.freertos_dir}/include
-I${STM32F411CE_DEFINE.freertos_dir}/portable/GCC/ARM_CM4F
;----------------------------------------------------------------
; User Files
;----------------------------------------------------------------
; -IMyLib/Inc
; Core MCU flags, CPU, instruction set and FPU setup Needs to be set properly
; for your MCU
-mthumb
; This needs attention to properly set for used MCU
-mcpu=cortex-m4
-mfpu=fpv4-sp-d16 ; 指定FPU
-mfloat-abi=hard ; 指示gcc編譯器生成浮點指令
-Wno-deprecated
-Wall
; -Wextra
;-Wpedantic
-Wno-unused-parameter
; $<$<CONFIG:Debug>:-Og -g3 -ggdb> $<$<CONFIG:Release>:-Og -g0>
;输出map
-Wl,-Map,output.map
; link flags
--specs=nosys.specs
-Wl,--start-group
-lc
-lm
-lstdc++
-lsupc++
-Wl,--end-group
-Wl,--print-memory-usage
-Wl,-u_printf_float ;STDIO float formatting support
;----------------------------------------------------------------
; set link flags which platformio not supported
;----------------------------------------------------------------
extra_scripts =
pre:rename_firmware.py
update_link_flags_stm32f411.py
; set firmware name and version
custom_option1 = motor_testkit
custom_prog_version = 1.0.1.0