1.This is an MDK version 4 project ,require Device support for Cortex-M based devices.

【STM32】MDK5打开MDK4项目工程时出现的不兼容及解决方法

最近在使用MDK5的时候发现了一个问题,先看一下现有的MDK的版本信息:

在用MDK5打开MDK4版本的项目工程的时候,通常会跳出一个窗口Using an MDK Version 4 Project:

This is an MDK version 4 project ,require Device support for Cortex-M based devices.

 

解决方式

在这个窗口中提示了两种解决方法:Migrate to Device Pack(迁移到设备包) 和 Install Legacy Support(安装遗留支持)

先尝试了第一种方式,进来之后,查看可以找的设备,但是一编译,就报好多错误。 

所以还是选择第二种方式安装Legacy support for ARM Cortex-M devices。

MDK Version 5 uses Software Packs to support a microcontroller device and to use middleware. To maintain backward compatibility with MDK Version 4 you may install Legacy Support. This might be necessary for two reasons:

  • To maintain projects created with MDK Version 4 without migrating to Software Packs.
  • To use older devices that are not supported by a Device Family Pack.

打开网页之后,点击左边的那个下载链接,如下图所示即可:

 

2.ST-Link下载出现 No target connected解决办法

注意:sys的debug一定选择Serial write

1.进入main()函数,找到HAL_Init()函数,并跳转到其实现处:

2.继续进入HAL_MspInit()函数,找到原因了吗,呵呵继续

3.点击__HAL_AFIO_REMAP_SWJ_DISABLE();进入

4.把JTAG和SW调试都关闭了,能下载才会见鬼呢,按需要把__HAL_AFIO_REMAP_SWJ_DISABLE();进行替换,我这里只用SW调试方式,所以替换为__HAL_AFIO_REMAP_SWJ_NOJTAG() ;(位置D:\stm32\cube\test\Core\Src\stm32f1xx_hal_msp.c)

5.替换函数,然后编译。注第一次还是要拉低复位脚才能下载,以后直接按download或是F8就可以了。

把复位脚拉低,然后点击Download图标或是F8进行下载,此时应立刻释放复位脚。(不能拉低不放,否则出现“Core is held in reset”错误),这下可以顺利下载了

那原因是什么呢,我们转到cubeMX来看看,是不是把sys忽略了呢,下次记得要选一下调试选项哦

3. 关于keil常见问题解决方法记录error: #268: declaration may not appear after executable statement in block

error: #268: declaration may not appear after executable statement in block

因为keil 默认编译标准是C89,解决方法:

c/c++→c99 mode(√)

4.main.c(19): warning:  #223-D: function NVIC_Configuration declared implicitly

这种错误是由于要么函数未声明要么没有调用什么头文件

解决方法:在子模块的头文件中extern声明一下这个函数就好

我没有声明这个导致得

#ifndef __SYS_H

void NVIC_Configuration(void);

#endif

5.NO Browser Information available......的解决方案

一、打开魔术棒

二、output→Browse Infoemation

三、重新编译就可以了

 

6.keil解决 error: #67: expected a }

一般情况下,这是宏定义的问题,检查C/C++选项卡,在C/C++选项卡里,把STM3210X_HD从prepocessor symbol define 里面删掉
对于stm32f103c8t6的prepocessor symbol define 为USE_STDPERIPH_DRIVER

用ch32f103编译报错,

先使用stm32编译,再选ch32编译

7.Default Compiler Version 5 which is not available

Build started: Project: gpio *** Target 'Target 1' uses ARM-Compiler 'Default Compiler Version 5' which is not available. *** Please review the installed ARM Compiler Versions: 'Manage Project Items - Folders/Extensions' to manage ARM Compiler Versions. 'Options for Target - Target' to select an ARM Compiler Version for the target. *** Build aborted. Build Time Elapsed: 00:00:00

解决方法