1

they seems like startup and standard files of stm32 ,but i can not find them in "GCC offical refeence PDF" .

why can they be used directly

this is the flags of arm-none-eabi-gcc in makefile:

# specify compiler flags
CFLAGS  = -g -O2 -Wall
CFLAGS += -T$(STD_PERIPH_LIBS)/Project/STM32F10x_StdPeriph_Template/TrueSTUDIO/STM3210B-EVAL/stm32_flash.ld
CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
CFLAGS += -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER
CFLAGS += -Wl,--gc-sections
CFLAGS += -I.
CFLAGS += -I$(STD_PERIPH_LIBS)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/
CFLAGS += -I$(STD_PERIPH_LIBS)/Libraries/CMSIS/CM3/CoreSupport
CFLAGS += -I$(STD_PERIPH_LIBS)/Libraries/STM32F10x_StdPeriph_Driver/inc
4

3 回答 3

0

-Dsomething与源代码中的相同#define something

于 2019-11-26T16:32:54.517 回答
0

它是库特定标志(在本例中为 STM32F10x 标准外设库)

文档链接

或查找官方文档

于 2019-11-26T15:11:02.777 回答
0

-D是传递给 GCC的预处理器标志,用于在编译之前定义某些内容。它可用于启用库的某些功能甚至调试。

STM32F10X_MDUSE_STDPERIPH_DRIVER启用部分包含的库。它是用于中等密度设备的库的 STM32F10 部分,并支持使用标准外设库。

请注意,不再支持 SPL,您应该升级到 HAL 或 HAL LL。

于 2019-11-26T15:50:34.450 回答