本帖最后由 jgphu 于 2012-6-18 16:18 编辑
下面这个函数是将底层初始化,描述上说是在启动代码调用。
一般STM32的启动的硬件初始化和向量地址入口都在.S文件下初始化。就不需要这个__low_level_init()函数了。但现在的工程有这个函数没有.S文件了,我想问一下,它描述说在启动代码调用,但启动代码道底在什么地方?
/*
*********************************************************************************************************
* __low_level_init()
*
* Description : Perform low-level initialization.
*
* Argument(s) : none.
*
* Return(s) : none.
*
* Caller(s) : IAR startup code.
*
* Note(s) : none.
*********************************************************************************************************
*/
#ifdef STM32_EXT_SRAM
#pragma location="ICODE"
__interwork int __low_level_init(void)
{
/* FSMC Bank1 NOR/SRAM3 is used for the STM3210E-EVAL */
/* if another Bank is req'd, adjust the Reg Addrs */
*(volatile CPU_INT32U *)0x40021014 = 0x00000114; /* Enable FSMC clock */
*(volatile CPU_INT32U *)0x40021018 = 0x000001E0; /* Enable GPIOD, GPIOE, GPIOF and GPIOG clocks */
/* --------------------- CFG GPIO --------------------- */
/* SRAM Data lines, NOE and NWE configuration */
/* SRAM Address lines configuration */
/* NOE and NWE configuration */
/* NE3 configuration */
/* NBL0, NBL1 configuration */
*(volatile CPU_INT32U *)0x40011400 = 0x44BB44BB;
*(volatile CPU_INT32U *)0x40011404 = 0xBBBBBBBB;
*(volatile CPU_INT32U *)0x40011800 = 0xB44444BB;
*(volatile CPU_INT32U *)0x40011804 = 0xBBBBBBBB;
*(volatile CPU_INT32U *)0x40011C00 = 0x44BBBBBB;
*(volatile CPU_INT32U *)0x40011C04 = 0xBBBB4444;
*(volatile CPU_INT32U *)0x40012000 = 0x44BBBBBB;
*(volatile CPU_INT32U *)0x40012004 = 0x44444B44;
/* --------------------- CFG FSMC --------------------- */
*(volatile CPU_INT32U *)0xA0000010 = 0x00001011; /* Enable FSMC Bank1_SRAM Bank */
*(volatile CPU_INT32U *)0xA0000014 = 0x00000200;
return (1);
}
#endif |