设置芯片时钟

//=====================================================================
//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的闪烁会明显加快,也就意味着大功告成。

你可能感兴趣的:(c,.net,ext,include,library,2010)