//=====================================================================
//TITLE:
// SRAM初始化和设置NVIC中断表偏移
//AUTHOR:
// norains
//DATE:
// Friday 8-October-2010
//Environment:
// KEIL MDK 4.0
// .NET Micro Framework Porting 4.1
// RedCow Board
//=====================================================================
关于SRAM的初始化和NVIC的设置,其实在叶帆的《【.Net Micro Framework PortingKit - 05】SRAM初始化&设置NVIC中断表偏移》(http://blog.csdn.net/yefanqiu/archive/2010/01/03/5125786.aspx)已经有过详细的描述,只不过我并不太喜欢直接在微软的代码上直接修改,所以才有了本文的一系列繁琐的设置。两种方法各有利弊,大家可以随自己的喜好进行选择。另外,在此注明一下,本文所涉及到的所有代码部分,都来源于叶帆的文章。
1.在我们自己的Solution下以此路径建立一系列文件夹:./Solutions/[MySolution]/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit
2.将./Solution /DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/dotNetMF.proj拷贝到./Solutions/[MySolution]/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit,将dotNetMF.proj文件中相关联地路径改为绝对路径。可能修改有点麻烦,现在将完整的内容列举如下,需要注意的是STM32F103ZE_RedCow是我的Solution名字,请各位读者根据实际情况进行改写。完整内容如下:
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AssemblyName>cpu_prestackinit_stubs</AssemblyName>
<ProjectGuid>{19b183cc-474f-47ce-a544-390acc3e2b62}</ProjectGuid>
<Size>
</Size>
<Description>Pre stack initialization stub driver</Description>
<Level>HAL</Level>
<LibraryFile>cpu_prestackinit_stubs.$(LIB_EXT)</LibraryFile>
<ProjectPath>$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInitdotNetMF.proj</ProjectPath>
<ManifestFile>cpu_prestackinit_stubs.$(LIB_EXT).manifest</ManifestFile>
<Groups>Processor/stubs</Groups>
<LibraryCategory>
<MFComponent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="PreStackInit_HAL" Guid="{5A9E3217-7D6D-40de-A685-28BA44D31E9A}" ProjectPath="" Conditional="" xmlns="">
<VersionDependency xmlns="http://schemas.microsoft.com/netmf/InventoryFormat.xsd">
<Major>4</Major>
<Minor>0</Minor>
<Revision>0</Revision>
<Build>0</Build>
<Extra />
<Date>2009-04-30</Date>
<Author>Microsoft</Author>
</VersionDependency>
<ComponentType xmlns="http://schemas.microsoft.com/netmf/InventoryFormat.xsd">LibraryCategory</ComponentType>
</MFComponent>
</LibraryCategory>
<Documentation>
</Documentation>
<PlatformIndependent>False</PlatformIndependent>
<CustomFilter>
</CustomFilter>
<Required>False</Required>
<IgnoreDefaultLibPath>False</IgnoreDefaultLibPath>
<IsStub>True</IsStub>
<HasLibraryCategory>True</HasLibraryCategory>
<Directory>/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit</Directory>
<PlatformIndependentBuild>false</PlatformIndependentBuild>
<Version>4.0.0.0</Version>
</PropertyGroup>
<Import Project="$(SPOCLIENT)/tools/targets/Microsoft.SPOT.System.Settings" />
<PropertyGroup>
<OutputType >Library</OutputType>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(SPOCLIENT)/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/$(AS_SUBDIR)/PreStackInit_stub.s" />
</ItemGroup>
<ItemGroup />
<Import Project="$(SPOCLIENT)/tools/targets/Microsoft.SPOT.System.Targets" />
</Project>
3.打开NativeSample.proj文件,将依赖的工程做修改。
原语句:
<RequiredProjects Include="$(SPOCLIENT)/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/dotNetMF.proj" />
更改为:
<RequiredProjects Include="$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/dotNetMF.proj" />
修改完毕之后,最后调用msbuild命令来编译一次,以确定修改正确。当确定修改正确之后,我们就可以进入下一步了。
4.将./DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/RVD_S/PreStackInit_stub.S文件拷贝到./Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/RVDS路径。然后再次用文本编辑器打开之前我们修改好的./Solutions/[MySolution]/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/dotNetMF.proj文件,并做如下修改。
原语句:
<Compile Include="$(SPOCLIENT)/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/$(AS_SUBDIR)/PreStackInit_stub.s" />
修改为:
<Compile Include="$(SPOCLIENT)/Solutions/STM32F103ZE_RedCow/DeviceCode/Drivers/Stubs/Processor/stubs_PreStackInit/RVDS/PreStackInit_stub.s" />
修改完毕后,再一次编译NativeSample工程,以确保路径修改正确。当这一步也能够正常编译通过之后,那么接下来我们就可以着手修改PreStackInit_stub.s文件了。
5. 用文本编辑器打开拷贝过来的PreStackInit_stub.s文件,完善PreStackInit函数。为了简单起见,这里直接将所有的源代码贴出来:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Microsoft Corporation. All rights reserved.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EXPORT PreStackInit
IMPORT PreStackInit_Exit_Pointer
PRESERVE8
AREA SectionForBootstrapOperations, CODE, READONLY
ENTRY
; ARM directive is only valid for ARM/THUMB processor, but not CORTEX
IF :DEF:COMPILE_ARM :LOR: :DEF:COMPILE_THUMB
ARM
ENDIF
PreStackInit
;*************************************************************************
;
; TODO: Enter your pre stack initialization code here (if needed)
; e.g. SDRAM initialization if you don't have/use SRAM for the stack
;
;Initialize the SRAM
; Enable FSMC clock
LDR R0,= 0x00000114
LDR R1,= 0x40021014
STR R0,[R1]
; Enable GPIOD, GPIOE, GPIOF and GPIOG clocks
LDR R0,= 0x000001E0
LDR R1,= 0x40021018
STR R0,[R1]
; SRAM Data lines, NOE and NWE configuration
; SRAM Address lines configuration
; NOE and NWE configuration
; NE3 configuration
; NBL0, NBL1 configuration
LDR R0,= 0x44BB44BB
LDR R1,= 0x40011400
STR R0,[R1]
LDR R0,= 0xBBBBBBBB
LDR R1,= 0x40011404
STR R0,[R1]
LDR R0,= 0xB44444BB
LDR R1,= 0x40011800
STR R0,[R1]
LDR R0,= 0xBBBBBBBB
LDR R1,= 0x40011804
STR R0,[R1]
LDR R0,= 0x44BBBBBB
LDR R1,= 0x40011C00
STR R0,[R1]
LDR R0,= 0xBBBB4444
LDR R1,= 0x40011C04
STR R0,[R1]
LDR R0,= 0x44BBBBBB
LDR R1,= 0x40012000
STR R0,[R1]
LDR R0,= 0x44444B44
LDR R1,= 0x40012004
STR R0,[R1]
; FSMC Configuration
; Enable FSMC Bank1_SRAM Bank
LDR R0,= 0x00001000
LDR R1,= 0xA0000010
STR R0,[R1]
LDR R0,= 0x00000200
LDR R1,= 0xA0000014
STR R0,[R1]
LDR R0,= 0x0FFFFFFF
LDR R1,= 0xA0000114
STR R0,[R1]
LDR R0,= 0x00001001
LDR R1,= 0xA0000010
STR R0,[R1]
;Reset the vector list address to the begin of SRAM which is 0x20000000
IF TargetLocation="RAM"
LDR R0,= 0x20000000
LDR R1,= 0xE000ED08
STR R0,[R1]
ENDIF
;*************************************************************************
; DO NOT CHANGE THE FOLLOWING CODE! we can not use pop to return because we
; loaded the PC register to get here (since the stack has not been initialized).
; Make sure the PreStackInit_Exit_Pointer is within range and
; in the SectionForBootstrapOperations
; go back to the firstentry(_loader) code
;
;
PreStackEnd
B PreStackInit_Exit_Pointer
;
;**************************************************************************
IF :DEF:COMPILE_THUMB
THUMB
ENDIF
END
分享到:
相关推荐
在Keil为S3C2440A自动生成的代码上简单修改而来 功能:在片内SRAM中初始化片外SDRAM。bin文件目前只能在NandFlash模式下运行。若要在NorFlash模式下,需修改scatter文件。在keil下不知道怎么编译位置无关的代码。
LPC2478mdk例程SRAM.
本文将介绍有关从Flash和SRAM中触发中断的过程示例
//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级 uart_init(115200); //串口初始化为115200 usmart_dev.init(72); //初始化USMART LED_Init(); //初始化与LED连接的硬件接口 KEY_Init(); ...
//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级 uart_init(115200); //串口初始化为115200 usmart_dev.init(72); //初始化USMART LED_Init(); //初始化与LED连接的硬件接口 KEY_Init(); ...
从Flash和SRAM中触发中断的过程示例
//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级 uart_init(115200); //串口初始化为115200 usmart_dev.init(72); //初始化USMART LED_Init(); //初始化与LED连接的硬件接口 KEY_Init(); ...
这是一个非常好的xilinx_SRAM介绍的文档,里面介绍了双通道SRAM中需要避免哪些冲突。很不错
18nm SRAM 网表,自动求出SNM,包含仿真结果和报告
This document describes Altera TimeQuest timing constraints and analysis for synchronous and asynchronous interfaces, Including a sample project.
Ulink2在SRAM中调试的设置方法,避免每次差些Flash
sram在asic和fpga的模型verilog代码,可以通用
串口3空闲中断+DMA接收不定长度的数据,3.5TFTLCD显示接收数据内容与发送次数,并通过随机颜色增强观感。...2、LCD初始化程序中有厂商提供的根据不同的驱动芯片所对应的初始化序列,不用理会 3、一帧最大传输30字节
SRAM的读写控制模块,通过了综合和仿真,对于初学者很好用。
三菱64的维修技巧,作为平时维修或者提高技能时使用
100脚STM32+SRAM原理图和PCB附FSMC驱动代码
amba总线的ahb到sram的接口,Verilog代码,还算详细,算是不错的资料。
FSMC_SRAM FSMC SRAM example
SRAM读写测试实例,每秒钟进行一次单字节的SRAM 读和写操作,用chipscope查看时序波形。
ARM Sram Compiler 工具。