keil 新建stm32工程

本文介绍了如何使用Keil新建STM32工程,包括创建工程文件夹结构,导入固件库,选择芯片类型和加载启动文件。在实际操作中,可能会遇到编译错误,如L6218E错误,提示undefined symbol assert_param,这通常与标准外设驱动有关。
摘要由CSDN通过智能技术生成

准备工作,根据习惯建立工程文件夹user,lib,project,start。user用来存放用户自己的文件可以将config文件放在此文件夹,将固件库里的inc、src文件夹复制到lib文件夹,将system_stm32fxxx.c复制到start文件夹。

新建工程,选择驱动芯片类型,加载对应启动文件,将准备工作里的文件按目录添加到工程里。编译,仿真。

遇到的问题:

1、使用标准外设驱动问题

编译错误提示:.\JJT.axf: Error: L6218E: Undefined symbol assert_param (referred from stm32f37x_adc.o).

如果不使用stm32标准外设库,仅仅是自己编写一些简单的程序则不需要此操作。
2、启动文件的问题
仅仅使用keil生成的启动文件system_stm32fxxx.s需要将system_stm32fxxx.c文件手动添加到工程文件中否则会报错
.\JJT.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_stm32f37x.o).
3、仿真问题
做好前面的工作之后,编译不再出错,进入仿真,发现进不了主函数,程序一直在系统启动准备阶段,且出现不能读写的错误提示*** error 65: access violation at 0x40021000 : no 'read' permission。此时需要修改Debug的设置。
将Debug的Dialog.DLL和Parameter的默认设置DCM.DLL和-pCM4改为
接下来仿真,正常进入main函数断点。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Version: 2.5.0 (2020-10-21) Keil.STM32L4xx_DFP.2.5.0.pack Updated Pack to STM32Cube_FW_L4 Firmware Package version V1.16.0 using HAL Drivers V1.12.0 Package Description (pdsc): Added global define USE_HAL_DRIVER to the component ::Device:STM32Cube HAL:Common. Device support: Aligned devices with CubeMX DB. CMSIS Flash Algorithm: Removed targets (STM32L4xx_512, STM32L4xx_256) from STM32L4Rx Flash Algorithm project. Added source code for: STM32L476G-Disco QSPI, STM32L4P5G-DK OSPI, STM32L4P5G-DK PSRAM STM32L4R9I-DK PSRAM, STM32L4R9I-DK OSPI1 and STM32L4R9I-EVAL OSPI. Added PSRAM external Loader support for STM32L4R9I-Disco. Fixed STM32L4P5 1M internal flash Loader sector erase with DBANK mode. Fixed STM32L4xx 512K and 128K internal flash Loader sector erase. CMSIS-Driver: MCI: Replaced empty delay loops with _NOP(). Added handling for separate SD and MMC HAL layers. Added busy signal handling after CMDREND interrupt. 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. Corrected Uninitialize function (to power off the peripheral if it is powered). USART: Added Driver_USART6 (uses LPUART1). Corrected GetTxCount/GetRxCount implementation. USBD: Removed include of stm32l4xx_hal_pcd.h header. Corrected documentation of STM32CubeMx configuration. Updated Boards Examples: Migrated CubeMX projects to V6.0.1. Changed variant selection to "MDK-Plus" where possible. Updated all USB Host/Device examples with user templates from MDK-Middleware v7.11.1.
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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值