标题:
Mac osX下STM32F10x的快速开发
[打印本页]
作者:
yuyang911220
时间:
2015-9-19 11:18
标题:
Mac osX下STM32F10x的快速开发
前一段搞低功耗产品用了STM8L,没有对应的gcc工具,只能在Windows中编译,很不习惯。最近又回来用STM32F103,用Aquamacs编辑、arm-eabi编译、Dfu-util下载,好多了。怕忘,暂记备查。
/*
* 第一步:下载Dfuse驻留程序
*/
1、下载ST公司的USB Full-speed固件库,展开;
2、在Projects/Dfuse下建GCC文件夹;
3、在GCC文件夹下建Makefile文件和stm32f10x.ld链接脚本;
4、Makefile文件参照
Versaloon
的Makefile修改,(在此向原作者致敬),Makefile内容如下:
#
options
and settings
PROJECT = dfuse
#
directory
define
PRJDIR = ..
SRCDIR = ..
OBJ_DIR = .
STM32_LIB_DIR = ../../..
#USR_LIBS
+
=
-I $(STM32_LIB_DIR)/Libraries
#
# available OPT
:
# 0 - 3
:
low optimization - high optimization
# s
:
size optimization
OPT = s
#_HARDWARE_VER = 0x15
FLASH_LOAD_OFFSET = 0x0000
HSE_VALUE = 8000000
LD_FILE = STM32F10x.ld
TARGET_STM32 = HighDensity
# set to yes to
include
USB library
INCLUDE_USB_LIB = yes
#
User
source
files
/
includes
/
macros
# add .c source
files
to USR_SRCS
# add .h
header
files
to USR_INCS
# add pre-defines to USR_DEFS
# add library
directory
to USR_LIBS
#
User
USR_SRCS
+
=
$(SRCDIR)/src/dfu_mal.c $(SRCDIR)/src/flash_if.c
###$(SRCDIR)/src/fsmc_nor.c
USR_SRCS
+
=
$(SRCDIR)/src/hw_config.c $(SRCDIR)/src/main.c
###$(SRCDIR)/src/nor_if.c
###USR_SRCS
+
=
$(SRCDIR)/src/spi_if.c $(SRCDIR)/src/spi_flash.c
USR_SRCS
+
=
$(SRCDIR)/src/stm32f10x_it.c
USR_SRCS
+
=
$(SRCDIR)/src/usb_desc.c $(SRCDIR)/src/usb_istr.c $(SRCDIR)/src/usb_prop.c
USR_SRCS
+
=
$(SRCDIR)/src/usb_pwr.c
USR_INCS
+
=
-I $(SRCDIR)/inc
# STM32_EVAL
# USR_SRCS
+
=
$(SRCDIR)/../../Utilities/STM32_EVAL/stm32_eval.c
# USR_INCS
+
=
-I $(SRCDIR)/../../Utilities/STM32_EVAL
# LIBSTM32_LIB
ifeq ($(TARGET_STM32)
,
LowDensity)
LIBSTM32_ASM_SRCS = \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_ld.s
LIBSTM32_DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_LD
else
ifeq ($(TARGET_STM32)
,
LowDensityValueLine)
LIBSTM32_ASM_SRCS = \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_ld_vl.s
LIBSTM32_DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_LD_VL
else
ifeq ($(TARGET_STM32)
,
MediumDensity)
LIBSTM32_ASM_SRCS = \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_md.s
LIBSTM32_DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD
else
ifeq ($(TARGET_STM32)
,
MediumDensityValueLine)
LIBSTM32_ASM_SRCS = \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_md_vl.s
LIBSTM32_DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD_VL
else
ifeq ($(TARGET_STM32)
,
HighDensity)
LIBSTM32_ASM_SRCS = \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_hd.s
LIBSTM32_DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_HD
else
ifeq ($(TARGET_STM32)
,
ConnectivityLine)
LIBSTM32_ASM_SRCS = \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_cl.s
LIBSTM32_DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_CL
else
Invalid STM32 Target
endif
endif
endif
endif
endif
endif
LIBSTM32_SRCS = \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/CoreSupport/core_cm3.c \
$(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/misc.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_fsmc.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_rcc.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_exti.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_dma.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_spi.c \
$(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_sdio.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_adc.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_bkp.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_can.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_cec.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_dac.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_dbgmcu.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_iwdg.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_pwr.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_rtc.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_tim.c \
# $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_wwdg.c
LIBSTM32_INCS = \
-I $(STM32_LIB_DIR)/Libraries/STM32F10x_StdPeriph_Driver/inc \
-I $(STM32_LIB_DIR)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x \
-I $(STM32_LIB_DIR)/Libraries/CMSIS/CM3/CoreSupport
# LIBSTM32_USB_LIB
ifeq (${INCLUDE_USB_LIB}
,
yes)
LIBSTM32_SRCS
+
=
\
$(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/usb_core.c \
$(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/usb_init.c \
$(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/usb_int.c \
$(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/usb_mem.c \
$(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/usb_regs.c \
$(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/usb_sil.c
# $(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/otgd_fs_cal.c \
# $(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/otgd_fs_dev.c \
# $(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/otgd_fs_int.c \
# $(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/src/otgd_fs_pcd.c
LIBSTM32_INCS
+
=
\
-I $(STM32_LIB_DIR)/Libraries/STM32_USB-FS-Device_Driver/inc
endif
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0