資源簡(jiǎn)介
《玩轉(zhuǎn).NET Micro Framework 移植-基于STM32F10x處理器》一書所有的源代碼。其它更多的資源可以訪問我的blog:http://blog.csdn.net/norains
謝謝!
代碼片段和文件信息
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//?Copyright?(c)?Microsoft?Corporation.??All?rights?reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include?
#include?“stm32f10x_conf.h“
#include?“INTC_Adapter.h“
//--//
extern?uint32_t?ARM_Vectors;
//--//
//?this?is?the?first?C?function?called?after?bootstrapping?ourselves?into?ram
//?these?define?the?region?to?zero?initialize
extern?UINT32?Image$$ER_RAM_RW$$ZI$$base;
extern?UINT32?Image$$ER_RAM_RW$$ZI$$Length;
//?here?is?the?execution?address/length?of?code?to?move?from?FLASH?to?RAM
#define?IMAGE_RAM_RO_base???Image$$ER_RAM_RO$$base
#define?IMAGE_RAM_RO_LENGTH?Image$$ER_RAM_RO$$Length
extern?UINT32?IMAGE_RAM_RO_base;
extern?UINT32?IMAGE_RAM_RO_LENGTH;
//?here?is?the?execution?address/length?of?data?to?move?from?FLASH?to?RAM
extern?UINT32?Image$$ER_RAM_RW$$base;
extern?UINT32?Image$$ER_RAM_RW$$Length;
//?here?is?the?load?address?of?the?RAM?code/data
#define?LOAD_RAM_RO_base?Load$$ER_RAM_RO$$base
extern?UINT32?LOAD_RAM_RO_base;
extern?UINT32?Load$$ER_RAM_RW$$base;
//--//
void?InitVectorTab()
{
//Set?the?vector?table?address?to?the?NVIC_VT0?register??which?is?definition?in?the?xml?setting?file
volatile?UINT32?*pNVIC?=?&SCB->VTOR;
*pNVIC?=?reinterpret_cast(&ARM_Vectors);
//Initialize?the?INTC?which?is?connected?with?the?vector?table
INTC_Initialize();
//Ensure?completion?of?memory?access
__DSB();
}
#pragma?arm?section?code?=?“SectionForBootstrapOperations“?//Begin
static?void?__section(SectionForBootstrapOperations)Prepare_Copy(?UINT16*?src?UINT16*?dst?UINT32?len?)
{
if(dst?!=?src)
{
while(len)
{
*dst++?=?*src++;
len?-=?2;
}
}
}
static?void?__section(SectionForBootstrapOperations)Prepare_Zero(?UINT16*?dst?UINT32?len?)
{
while(len)
{
*dst++?=?0;
len?-=?2;
}
}
//---------------------------------------------------------------------------------
//Description
// The?length?in?the?original?PrepareImageRegions?function?must?be?mulriple?of?4
//or?the?code?would?be?crashed?and?the?IMAGE_RAM_RO_LENGTH?sometimes?is?not?mulriple?of?4
//so?I?rewrite?the?function?to?copy?data.?I?copy?the?data?2-Byte?by?2-Byte.?If?copy
//as?Byte?uintit?also?crash.
//------------------------------------------------------------------------------------
void?__section(SectionForBootstrapOperations)?PrepareImageRegionsEx()
{
???//
????//?Copy?RAM?RO?regions?into?proper?location.
????//
????{
????????UINT16*?src?=?(UINT16*)&LOAD_RAM_RO_base;?
????????UINT16*?dst?=?(UINT16*)&IMAGE_RAM_RO_base;
????????UINT32??len?=?(UINT32?)&IMAGE_RAM_RO_LENGTH;?
??????
評(píng)論
共有 條評(píng)論