飞思卡尔处理器K60学习笔记(三)---------DSP扩展的使用(CMSIS库的应用)
来源:互联网 发布:印象笔记软件下载 编辑:程序博客网 时间:2024/05/19 11:45
很意外,由于系统原因,Codewarrior103.的软件被卸载了,估计将来很长的时间内都不会在用Codewarrior做开发。所以也就不再安装它了,具体内容也就只能转载别人的,不做详细使用指导了。
但本章节的内容,个人认为还是很重要的,就做下简单的记录,提供几个参考教程。方便后来人学习使用。
准备工作:1、有一个CMSIS库,个人认为还是下一个最新的吧。ARM官方网站可以下到(需要注册一个账号,免费)点击进入下载界面。
参考1:http://mcuoneclipse.com/2013/02/14/tutorial-using-the-arm-cmsis-library/,这篇文章写得很详细,可以就是图片全挂了,但还是有一定指导作用的。
为了方便本人将全文COPY下来作为备份
Installing CMSIS
To simplify things, I have the CMSIS zip file unpacked inside my workspace. It creates the folders ‘Device’, ‘CMSIS’ and a file with the version number:
Creating a Project
Inside the workspace, I create a project for my board using the File > New > Barboard Project wizard to create a GNU gcc project. This creates a default project for me:
ARM provides many such examples. They are a great way to verify that they work properly in my application. One consideration with using the libraries is their stack consumption. If they work as the simple example, but not within my application, then typically I have not reserved enough stack space. At least worth a try.
An easy way to add this file to my project is to drag&drop it into my project Sources folder. As the example comes with a main(), I can remove the original main.c from my project:
Creating a Build Variable
We need to reference the CMSIS installation path in the next steps several times. To make things easier and more portable, I’m going to add a Build variable. For this I press ‘Add’ in the project properties > C/C++ Build > Build Variables:
In the following dialog I define my variable and press OK:
Of course you should use a path pointing to to where you have CMSIS installed. For me, it is is “c:\tmp\wsp_cmsis\CMSIS” in this tutorial, so you need to use the path which you have on your system.
With this, I can always use
${CMSIS_LOC}
instead of a hard-coded path.
Using CMSIS
The above project will not compile and link. I need to tell the compiler where to are the CMSIS header files, and what library to link.
Header File Include
The CMSIS header files are in CMSIS\Include, so I add this to my compiler include paths:
I’m using here the CMSIS library inside my workspace. Change the path if you have the CMSIS installed somewhere else.
Architecture Define
The other important thing is: I need to set a define which tells the CMSIS library which ARM Cortex core I’m using. For the ARM Cortex-M0+ this isARM_MATH_CM0. I add this define to the project properties of the ARM gcc preprocessor settings.
If using an ARM Cortex-M4 (like for the Kinetis K family), then the define would beARM_MATH_CM4
Library
CMSIS already comes with pre-built libraries. So all what I need to do for gcc is to link the correct libraries with my application. The libraries are inside CMSIS\Lib\GCC:
The M denotes the ARM core, while the ‘l’ means ‘little endian’. The ‘f’ means an ARM core with Harware Floating Point Unit (e.g. Cortex-M4F).
With this information, I add the library name and the library search path to my linker settings:
Important: the library name is *without* the ‘lib’ prefix and *without* the ‘.a’ suffix! SeeCreating and using Libraries with ARM gcc and Eclipse.
Build and Debug
With this, everything should be in place to compile, link and download without errors. But if I step into the CMSIS functions, I get a message from the debugger that it cannot find the source file:
The reason is that I’m using the precompiled libraries from ARM, and obviously that person was using a different path to the CMSIS library.
To help the debugger to find the source, I’m going to add a path mapping. I press the ‘Edit Source Lookup Path’ button:
Then I select Path Mapping:
Then I specify that ‘c:\working\CMSIS_Setup\CMSIS shall be replace with the path on my machine:
I would love to use my ${CMSIS_LOC} variable in that dialog, but this is not supported in this Eclipse version? That would be a great feature extension.
Now it shows the source properly:
参考2:http://blog.sina.com.cn/s/blog_9ca04b1901014tdo.html1. Install “KINETIS_SMSIS_2.10”. Install CW10.2 Update1.0.0.
2. Unzipped the attached zip file.
3. Copy “CWCC” folder to “KINETIS_CMSIS_2.10\Examples\”folder.
4. Replace the existed “core_cm4.h” file, which islocated
5. Copy “twrk60n512_blinky” folder to“KINETIS_CMSIS_2.10\Examples\twrk60n512_blinky” folder, and renamethe folder name from “twrk60n512_blinky” to “CodeWarrior”.
6. Copy “twrk40x256_blinky” folder to“KINETIS_CMSIS_2.10\Examples\twrk40x256_blinky” folder, and renamethe folder name from “twrk40x256_blinky” to “CodeWarrior”.
7. Create a empty folder named “CodeWarrior” in“KINETIS_CMSIS_2.10\Examples\sin_cos_example” folder.
8. Copy “twrk40x256_sin_cos_example” folder and“twrk60n512_sin_cos_example”
9. Rename the “twrk40x256_sin_cos_example” folder to“twrk40x256”.
10. Rename the “twrk60n512_sin_cos_example” folder to“twrk60n512”.
参考3:http://www.freescaleic.org/bbs/article_891_299345.html
按照野火团队,官方CMISI的库有问题,存在BUG,然后他们做了修改。版本是2.1的。现在最新的是3.1的好像。大家可以看看,并且,野火提供了完整的M4的底层库,想玩的可以好好利用下。
说句真心的,飞思卡尔的底层支持真心给跪。推荐还是用MDK或者IAR,还有官方库(CMSIS)支持。
- 飞思卡尔处理器K60学习笔记(三)---------DSP扩展的使用(CMSIS库的应用)
- 飞思卡尔处理器K60学习笔记(一)---------M4内核概要
- 飞思卡尔处理器K60学习笔记(二)---------Cortex-M内核比较
- 如何灵活使用飞思卡尔i.MX应用处理器的GPIO
- 开源飞控OpenPilot的扩展卡尔曼滤波EKF学习笔记(三)
- Feescale K60开发笔记5: K60 Bootloader++的使用
- 飞思卡尔K60系列的UART的波特率设置问题
- 如何在Keil uVision5建立飞思卡尔K60开发板的工程
- ARM CMSIS DSP库函数arm_sin_cos_f32的BUG
- 轻松玩转K60--飞思卡尔
- 飞思卡尔k60从零开始之PLL
- 开源飞控OpenPilot的扩展卡尔曼滤波(EKF)学习笔记
- 飞思卡尔(三)测速测正反转(K60 欧姆龙500线编码器DMA测速)
- CMSIS-RTOS2 应用笔记 三 功能概述
- 卡尔曼/扩展卡尔曼滤波器的原理及应用
- 卡尔曼/扩展卡尔曼滤波器的原理及应用
- 飞思卡尔推出四款脚位相容的64位处理器
- 飞思卡尔IMX6处理器的GPIO配置方式
- win2003 ISAPI_Rewrite使用安装不能加载所有ISAPI
- openstack安装(包含swift)在vmware上的ubuntu
- 黑马程序员——Ⅲjava基础加强之动态代理(15)
- u-boot移植五部曲之第二步
- java编程学习之事物管理(一)
- 飞思卡尔处理器K60学习笔记(三)---------DSP扩展的使用(CMSIS库的应用)
- 黑马程序员——高薪面试题之交通灯管理系统(16)
- 关于导入MYSQL的提示(自娱自乐)
- [每日一题] OCP1z0-047 :2013-08-25 正则表达式REGEXP_LIKE-----‘harddisks’.................108
- 黑马程序员--09.动态与代理AOP--07【InvocationHandler使用的注意事项】【Proxy类II】
- 根据输入的数据,建立二叉排序树,并求先、中、后序遍历
- 黑马程序员——高薪面试题之银行调度系统(17)
- HDU 4493 Tutor
- 论明天