【Keil 5】STM32F401CCU6 固件库配置(超详细教程)

目录

一、材料提供

二、固件库移植

1、固件库结构

2、移植步骤


一、材料提供

        keil 5软件:keil 5.36

        固件库:官方下载地址1.8版本

        

        STM32F4芯片包:官方下载地址2.7版本

       

        移植好的空白工程文件:STM32F401CCU6空白工程-单片机文档类资源-CSDN下载

二、固件库移植

1、固件库结构

        以下是 STM32F4xx_DSP_StdPeriph_Lib_V1.8.0 文件夹下的目录结构:

         其中我们要移植的固件库就处于 Libraries 文件夹下。同时 库使用帮助文档 也非常重要,我们可以借助这个文档快速查阅想要使用到的目标函数功能。

        以下是 STM32F4xx_DSP_StdPeriph_Lib_V1.8.0\Libraries\CMSIS 文件夹下的目录结构:

        我们目前只需要用到其中的 DeviceInclude 就可以了。

2、移植步骤

2.1 新建一个文件夹,在里面新建如下四个文件夹。

         

 2.2 将 STM32F4xx_DSP_StdPeriph_Lib_V1.8.0\Libraries 下的所有文件复制到 新创建文件夹下的 Libraries 目录下。

 2.3 只保留图中的 DeviceInclude 目录即可,其余的全部删除。

 2.4 进入到 Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates 目录下,因为我们使用的 MDK 启动文件在 arm 文件夹中,所以只需保留这一个文件夹即可。

 

 2.5 进入 STM32F4xx_DSP_StdPeriph_Lib_V1.8.0\Project\STM32F4xx_StdPeriph_Templates 目录下,直接使用官方提供的例子即可。注意:如果不习惯使用 main.h 的话要在main.c 和 stm32f4xx_it.c 中将 #include "main.h" 剔除!!!

 2.6 创建 keil 5 工程,把该工程保存到 Project 文件夹下即可。然后选择ccu6的芯片即可(在这之前要先把前面提供的 stm32f4 芯片包安装好)

 2.7 添加固件库等文件。

  2.8 修改ARM 编译器版本。(keil 5 较高版本默认版本是6,要改为5,不然就是全部配置好了,运行起来还有几十个错误和警告)

  2.9 添加声明和头文件路径。

// 声明部分
USE_STDPERIPH_DRIVER,STM32F401xx,

// 头文件部分(此路径要与上面的结构完全一致才可使用),直接复制粘贴即可,不用选择了
..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include
..\..\Libraries\CMSIS\Include
..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc
..\..\User

  2.10 屏蔽掉一些文件。因为有些固件库中的文件是F401中没有这个功能的,所以要将其屏蔽掉。

        至此,该工程文件就已经全部配置完成了。

  • 16
    点赞
  • 98
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论
Version: 2.15.0 (2020-09-28) Keil.STM32F4xx_DFP.2.15.0.pack Download Updated Pack to STM32Cube_FW_F4 Firmware Package version V1.25.1 using HAL Drivers V1.7.9. STM32CubeMX integration (Version 6.0.1): Added support for Timebase Source TIMx (FrameworkCubeMX_gpdsc.ftl). Removed non-existent include path. CMSIS Flash Algorithm: Corrected STM32F42xxx_43xxx_OPT Algorithm. CMSIS SVD: Updated STM32F42*.svd, STM32F43*.svd files. CMSIS-Driver: I2C: Corrected 2 byte reception in master mode. MCI: Replaced empty delay loops with _NOP(). SPI: Corrected PowerControl function (to return error if Initialize was not called, to abort active transfer if power off was requested). Updated GetDataCount function to give accurate count in DMA mode. Corrected Control function (abort in DMA mode, software controlled slave select in slave mode, TI Frame Format selection, ignore bus speed for slave mode). Corrected Uninitialize function (to power off the peripheral if it is powered). Corrected SPI3_SCK pin configuration. Corrected DMA MemDataAlignment configuration. USART: Corrected DMA MemDataAlignment configuration. USBD_HS/USBH_HS: OTG_HS ULPI clock disabled in low power if internal PHY is used to enable proper operation of OTG_HS port in FS mode during CPU sleep. CAN/EMAC/USBD/USBH: Removed macros already provided by cmsis_compiler.h. Updated Boards Examples: Migrated CubeMX projects to V6.0.1 and updated config files. Changed variant selection to "MDK-Plus" where possible. Updated all USB Host/Device examples with user templates from MDK-Middleware v7.11.1. Terminating app_main thread with osThreadExit() to avoid endless loop Updated MS Windows UBS driver files.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谢老板不用蟹

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值