加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Keil IAR - Cortex M3 调试问题及解决方法(2)

发布时间:2020-12-15 06:19:44 所属栏目:百科 来源:网络整理
导读:最近又用stm32 和 ?lm3s 做点协议栈等,把一些调试心得写出来吧,本文可是原创,转载请注明出处。 芯片是stm32f103 stm32f107 lm3s9790 lm3s9b90,开发环境是 keil mdk 4.22 ?iar arm 6.30. 1 stm32 官方库的更新 并不向下完全兼容,其中有他们家的新的芯片不

最近又用stm32 和 ?lm3s 做点协议栈等,把一些调试心得写出来吧,本文可是原创,转载请注明出处。

芯片是stm32f103 stm32f107 lm3s9790 lm3s9b90,开发环境是 keil mdk 4.22 ?iar arm 6.30.

1 stm32 官方库的更新 并不向下完全兼容,其中有他们家的新的芯片不断推出有关。

使用库,本人想做了个模板, 可以使用keil 和iar 使用,像官方库一样,只是它文件管理不方便。


项目的配置可以抄袭官方的配置,就行了。

注意: c 语言代码文件可以完全移植,但是汇编文件如 启动文件却不同,因为编译器不同,

而且,官方库升级后,启动文件和底层文件发生了很大的变化,

要注意的是flash 的容量: low density,low density value line,medium density,medium density value line,?Connectivity?line,high density,High Density Value Line,??xl density,分别对应STM32F10x_StdPeriph_Lib_V3.5.0LibrariesCMSISCM3DeviceSupportSTSTM32F10xstartuparm启动文件。

具体的对应关系为

  • Low-density Value line devices are STM32F100xx microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes.
  • Low-density devices are STM32F101xx,STM32F102xx and STM32F103xx microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes.
  • Medium-density Value line devices are STM32F100xx microcontrollers where the Flash memory density ranges between 32 and 128 Kbytes.
  • Medium-density devices are STM32F101xx,STM32F102xx and STM32F103xx microcontrollers where the Flash memory density ranges between 32 and 128 Kbytes.
  • High-density Value line devices are STM32F100xx microcontrollers where the Flash memory density ranges between 256 and 512 Kbytes.
  • High-density devices are STM32F101xx and STM32F103xx microcontrollers where the Flash memory density ranges between 256 and 512 Kbytes.
  • XL-density devices are STM32F101xx and STM32F103xx microcontrollers where the Flash memory density ranges between 512 and 1024 Kbytes.
  • Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers. ?


使用的时候,

启动文件要加载正确,



project ?的 options 里的C/C++ 编译选项要 有?STM32F10X_CL (对于stm32f107)等,

(错误的配置,也会工作,但不准确)

2 stm 调用prinf 的用法 ? usart?

官方库里有print 的用法,就是把stdio.h 里的fputc 函数用usart 的函数写一遍。


3 下载文件大小的问题

*.map mdk 和ewarm 都有这个文件,里面的含义不赘述了

?4 通用的调试经验

(1)build

这一步是生成*.o 文件

观察build output 窗口, 看是否通过build 不通过就是文件管理如*.h *c 文件的路径等,函数,变量,定义没设定好

(2)link

build 完成后是link,不通过的话看具体.o 文件,错误就在里面,如a.c 调用的一个函数只有声明,没有实体,但是会通过build

(3)simulation

可以用IDE里的软件仿真,测试,用好里面的寄存器,watch,serial windows,analogical windows,的功能ide 提供的工具。


优秀的代码要模仿,之后学为己用; 用好IDE,形成自己的代码。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读