STM32环境配置和下载方式

本文详细介绍了STM32的开发环境配置,包括MDK的安装、芯片支持包的选择,以及USB串口CH340的使用。STM32的下载方式涉及ST-LINK、J-Link,还特别提到ISP程序下载不适用于M7系列。同时,文章提供了硬件设置、一键下载环境的准备步骤,并详细说明了STM32的启动模式和不同下载工具的设置方法。
摘要由CSDN通过智能技术生成


以正点原子阿波罗F767为例

MDK

Keil for ARM
http://www.keil.com/download/product/

芯片支持包
http://www.keil.com/dd2/pack
stm32F767需要Keil.STM32F7xx_DFP

正点原子给的资料的 \6,软件资料\1,软件\MDK5 也有

USB串口CH340

可以当串口使用
如果USB串口连接STM32的串口1(STM32ISP下载只能是串口1)的话,那么可以用来串口下载程序
连接USB同时也可以供电

USB串口驱动芯片型号CH340
串口下载工具:FlyMcu(McuISP)
USB串口驱动目录
一般在店家资料的 \6,软件资料\1,软件\CH340驱动(USB串口驱动)_XP_WIN7共用 文件夹中

必须用开发版下面的USB口

ST-LINK

【正点原子】阿波罗STM32F767开发板\6,软件资料\1,软件\ST LINK驱动及教程 目录下

J-Link

ISP程序下载(M7不支持)

硬件设置

在这里插入图片描述

USB232口,只有串口1可作下载,引脚PA9和PA10

一键下载环境准备

\6

Version: 2.12.0 (2019-07-17) Keil.STM32F7xx_DFP.2.12.0.pack Download Updated Pack to include subset of STM32Cube_FW_F7 Firmware Package version V1.15.0 using HAL Drivers V1.2.7 Added support for Low Level (LL) drivers. Corrected RTE_Device.h file (I2C3_SDA) Corrected condition for selecting HAL RCC MX_Device_h.ftl: Updated parsing of USART virtual mode Updated generation of macros: Added handling for '(' and ')' symbols Corrected launching STM32CubeMX via "play" button for existing projects overwrites with a new STM32CubeMX project file instead of loading existing. Updated Board Examples: graphics examples use Segger emWin version 5.50.0. examples enable Event Recorder in debug targets Updated LCDConf.c (ready for GUI_USE_ARGD = 1) CMSIS-Driver: CAN: Corrected SetBitrate function to leave Silent and Loopback mode as they were. Corrected SetMode function to clear Silent and Loopback mode when NORMAL mode is activated. Corrected MessageSend function to only access required data for sending. EMAC: Corrected __MEMORY_AT(x) define to be compliant with Arm Compiler 6. Corrected: ETH DMA initialization moved to enable of MAC transmitter or receiver solving netInitialize/netUnnitialize/netInitialize sequence. I2C: Corrected transfers for data sizes greater than 255 (Complete Reload handling). Corrected I2C_SlaveReceive functionality. Corrected code alignment. MCI: Added data cache handling. USART: Added check for valid pointer to USART_PIN prior to use. Corrected POWER_OFF sequence. DMA is DeInitialized after it is aborted. USB Device: Updated USBD_EndpointConfigure function to check that maximum packet size requested fits into configured FIFO (compile time configured). I/O output speed is configurable SPI: Updated SPI_TRANSFER_INFO structure - tx_buf type changed from uint8_t * to const uint8_t *. Added check for valid pointer to SPI_PIN prior to use.
MDK程序下载 程序下载----FLM⽂件 ⽂件 MDK编程算法 编程算法   ⽤过MDK下载程序的⼩伙伴可能都知道,在下载程序之前需要都在Debug设置的Flash Download⼦选项卡选择编程算法。⼤多数时 候, 我们只要安装了芯⽚包之后,就可以直接得到对应的编程算法,并不需要我们去修改它。但是,当你是⼀个芯⽚包的开发者,或者你有独特 的下载需求(⽐如在你的程序⾥加⼊⼀些校验信息),这个时候你就需要去了解它了!   编程算法呢,说⽩就其实也就是⼀段程序,主要功能就是擦除相应的内存块,并将我们的程序写⼊到相应的内存区域上去。 在你点击下载按钮的时候,这段程序会被先下载到RAM上(RAM for Algorithm上的设置),然后才会通过它,将你的程序写⼊到 指定的内存区域内。 实现⼀个⾃⼰的编程算法 实现⼀个⾃⼰的编程算法   怎么去实现⼀个⾃⼰的编程算法?⾸先我们找到⾃⼰的MDK的安装路径,进⼊到ARM\Flash⽂件夹下(例如: D:\Keil_v5\ARM\Flash)。 这⾥有个编程算法的⼯程模板,复制这个⼯程到你的⼯程⽂件夹下,重命名你⾃⼰的想要的名字。   打开⼯程,⾥⾯主要有两个⽂件 FlashPrg.c 和 FlashDev.c:   FlashDev.c主要实现了⼀个设备相关的结构体(根据⾃⼰的Flash情况去实现)      ⽐如STM32L051实现如下:   FlashPrg.c实现了⼏个Flash编程相关的函数:   根据⾃⼰的需要去实现,STM32L051实现如下: 1 /* ----------------------------------------------------------------------------- 2 * Copyright (c) 2014 ARM Ltd. 3 * 4 * This software is provided 'as-is', without any express or implied warranty. 5 * In no event will the authors be held liable for any damages arising from 6 * the use of this software. Permission is granted to anyone to use this 7 * software for any purpose, including commercial applications, and to alter 8 * it and redistribute it freely, subject to the following restrictions: 9 * 10 * 1. The origin of this software must not be misrepresented; you must not 11 * claim that you wrote the original software. If you use this software in 12 * a product, an acknowledgment in the product documentation would be 13 * appreciated but is not required. 14 * 15 * 2. Altered source versions must be plainly marked as such, and must not be 16 * misrepresented as being the original software. 17 * 18 * 3. This notice may not be removed or altered from any source distribution. 19 * 20 * 21 * $Date: 18. November 2014 22 * $Revision: V1.00 23 * 24 * Project: Flash Programming Functions for ST STM32L0xx Flash 25 * --------------------------------------------------------------------------- */ 26 27 /* History: 28 * Version 1.00 29 * Initial release 30 */ 31 32 #include "FlashOS.H" // FlashOS Structures 33 34 typedef volat
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值