设置芯片时钟
2010-10-08 15:29
274 查看
//=====================================================================
//TITLE:
// 设置芯片时钟
//AUTHOR:
// norains
//DATE:
// Friday 8-October-2010
//Environment:
// KEIL MDK 4.0
// .NET Micro Framework Porting 4.1
// RedCow Board
//=====================================================================
叶帆在《【.Net Micro Framework PortingKit - 06】设置芯片时钟》(http://blog.csdn.net/yefanqiu/archive/2010/01/03/5125786.aspx)一文已经有对芯片设置的详细方式,只不过没有用上ST给的Library库,觉得使用上有点不方便。所以,本文以另一种方式,直接调用ST的STM32F10x_StdPeriph_Driver代码,以达到设置芯片时钟的目的。
1.依次建立如下文件夹:./Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap。
2.将./DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap的所有文件拷贝到./Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap文件夹中。
3. 打开./Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/dotNetMF.proj文件,并进行修改。
原语句:
<ProjectPath>$(SPOCLIENT)/DeviceCode/drivers/stubs/processor/stubs_bootstrap/dotNetMF.proj</ProjectPath>
更改为:
<ProjectPath>$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/dotNetMF.proj</ProjectPath>
原语句:
<Directory>DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap</Directory>
更改为:
<Directory>Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap</Directory>
然后在</Project>之前增加如下内容:
<ItemGroup>
<DriverLibs Include="STM32F10x_StdPeriph_Driver.$(LIB_EXT)" />
<RequiredProjects Include="$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/Libraries.proj" />
</ItemGroup>
<ItemGroup>
<IncludePaths Include="Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/Configure" />
<IncludePaths Include="Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/STM32F10x_StdPeriph_Driver/inc" />
<IncludePaths Include="Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/CMSIS/Core/CM3/" />
</ItemGroup>
4.接下来就是修改C++代码了,在这里需要对时钟进行初始化。打开./ Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/ stubs_functions_bootstrap.cpp文件,输入如下内容:
5.打开./Solutions/STM32F103ZE_RedCow/NativeSample/NativeSample.proj文件,对依赖的stubs_bootstrap工程需要进行相应的更改。
原语句:
Include="$(SPOCLIENT)/DeviceCode/drivers/stubs/processor/stubs_bootstrap/dotNetMF.proj" />
更改为:
<RequiredProjects Include="$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/dotNetMF.proj" />
6.对NativeSample进行重新编译,如果没有错误,那将编译好的程序下载到开发板中,会发现LED的闪烁会明显加快,也就意味着大功告成。
//TITLE:
// 设置芯片时钟
//AUTHOR:
// norains
//DATE:
// Friday 8-October-2010
//Environment:
// KEIL MDK 4.0
// .NET Micro Framework Porting 4.1
// RedCow Board
//=====================================================================
叶帆在《【.Net Micro Framework PortingKit - 06】设置芯片时钟》(http://blog.csdn.net/yefanqiu/archive/2010/01/03/5125786.aspx)一文已经有对芯片设置的详细方式,只不过没有用上ST给的Library库,觉得使用上有点不方便。所以,本文以另一种方式,直接调用ST的STM32F10x_StdPeriph_Driver代码,以达到设置芯片时钟的目的。
1.依次建立如下文件夹:./Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap。
2.将./DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap的所有文件拷贝到./Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap文件夹中。
3. 打开./Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/dotNetMF.proj文件,并进行修改。
原语句:
<ProjectPath>$(SPOCLIENT)/DeviceCode/drivers/stubs/processor/stubs_bootstrap/dotNetMF.proj</ProjectPath>
更改为:
<ProjectPath>$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/dotNetMF.proj</ProjectPath>
原语句:
<Directory>DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap</Directory>
更改为:
<Directory>Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap</Directory>
然后在</Project>之前增加如下内容:
<ItemGroup>
<DriverLibs Include="STM32F10x_StdPeriph_Driver.$(LIB_EXT)" />
<RequiredProjects Include="$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/Libraries.proj" />
</ItemGroup>
<ItemGroup>
<IncludePaths Include="Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/Configure" />
<IncludePaths Include="Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/STM32F10x_StdPeriph_Driver/inc" />
<IncludePaths Include="Solutions/STM32F103ZE_RedCow/DeviceCode/Libraries/CMSIS/Core/CM3/" />
</ItemGroup>
4.接下来就是修改C++代码了,在这里需要对时钟进行初始化。打开./ Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/ stubs_functions_bootstrap.cpp文件,输入如下内容:
#include "stm32f10x_conf.h" void BootstrapCode() { SystemInit(); }
5.打开./Solutions/STM32F103ZE_RedCow/NativeSample/NativeSample.proj文件,对依赖的stubs_bootstrap工程需要进行相应的更改。
原语句:
Include="$(SPOCLIENT)/DeviceCode/drivers/stubs/processor/stubs_bootstrap/dotNetMF.proj" />
更改为:
<RequiredProjects Include="$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_bootstrap/dotNetMF.proj" />
6.对NativeSample进行重新编译,如果没有错误,那将编译好的程序下载到开发板中,会发现LED的闪烁会明显加快,也就意味着大功告成。
相关文章推荐
- 【.Net Micro Framework PortingKit - 06】设置芯片时钟
- 设置芯片时钟
- 【.Net Micro Framework PortingKit - 06】设置芯片时钟
- Android世界时钟-时间1970-1-1 0:0无法设置的代码调用和原因
- linux引导流程(开机过程)和时钟设置
- linux下的i2c与时钟芯片pcf8563通信
- linux系统时间同步,硬件时钟和系统时间同步,时区的设置
- 第三章、Tiny4412 U-BOOT移植三 时钟设置【转】
- STM32时钟设置
- 树莓派hwclock命令参数及用法详解--linux显示/设置硬件时钟命令
- STM32F107的时钟设置由25M修改成8M
- PIC单片机之时钟设置
- Linux硬件时钟和系统时钟设置
- HFC-S mini芯片时隙设置
- uboot中串口时钟频率及波特率的设置
- [smart210] 通过PLL设置各时钟频率的方法以及代码注释
- STM32F4如何设置系统时钟,非常重要
- 将Raspberry Pi设置为无线路由器(WiFi热点AP,RTL8188CUS芯片)
- 单片机控制SPI协议时钟芯片DS1302之模块化编程及待解决的问题(持续更新中)
- 关于S3C2440时钟设置的理解