STM32F10x_StdPeriph_Examples/FSMC/NOR_CodeExecute/main.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    FSMC/NOR_CodeExecute/main.c 
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   Main program body.
00008   ******************************************************************************
00009   * @copy
00010   *
00011   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00012   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00013   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00014   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00015   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00016   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00017   *
00018   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00019   */ 
00020 
00021 /* Includes ------------------------------------------------------------------*/
00022 #include "stm3210e_eval_fsmc_nor.h"
00023 
00024 /** @addtogroup STM32F10x_StdPeriph_Examples
00025   * @{
00026   */
00027 
00028 /** @addtogroup FSMC_NOR_CodeExecute
00029   * @{
00030   */ 
00031 
00032 /* Private typedef -----------------------------------------------------------*/
00033 typedef  void (*pFunction)(void);
00034 
00035 /* Private define ------------------------------------------------------------*/
00036 #define ApplicationAddress       ((uint32_t)0x64000000)
00037 
00038 /* Private macro -------------------------------------------------------------*/
00039 /* Private variables ---------------------------------------------------------*/
00040 pFunction Jump_To_Application;
00041 __IO uint32_t JumpAddress;
00042 
00043 /* Private function prototypes -----------------------------------------------*/
00044 /* Private functions ---------------------------------------------------------*/
00045 
00046 /**
00047   * @brief   Main program.
00048   * @param  None
00049   * @retval None
00050   */
00051 int main(void)
00052 {
00053   /*!< At this stage the microcontroller clock setting is already configured, 
00054        this is done through SystemInit() function which is called from startup
00055        file (startup_stm32f10x_xx.s) before to branch to application main.
00056        To reconfigure the default setting of SystemInit() function, refer to
00057        system_stm32f10x.c file
00058      */     
00059 
00060   /* FSMC nOR configuration  **************************************************/
00061   /* Enable the FSMC Clock */
00062   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
00063 
00064   /* Configure FSMC Bank1 NOR/SRAM2 */
00065   NOR_Init();
00066 
00067   /* Jump to code loaded in NOR memory and execute it *************************/
00068   JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
00069   Jump_To_Application = (pFunction) JumpAddress;
00070 
00071   /* Initialize user application's Stack Pointer */
00072   __set_MSP(*(__IO uint32_t*) ApplicationAddress); 
00073 
00074   Jump_To_Application();
00075 
00076   while (1)
00077   {
00078   }
00079 }
00080 
00081 #ifdef  USE_FULL_ASSERT
00082 
00083 /**
00084   * @brief  Reports the name of the source file and the source line number
00085   *         where the assert_param error has occurred.
00086   * @param  file: pointer to the source file name
00087   * @param  line: assert_param error line source number
00088   * @retval None
00089   */
00090 void assert_failed(uint8_t* file, uint32_t line)
00091 { 
00092   /* User can add his own implementation to report the file name and line number,
00093      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
00094 
00095   /* Infinite loop */
00096   while (1)
00097   {
00098   }
00099 }
00100 #endif
00101 
00102 /**
00103   * @}
00104   */ 
00105 
00106 /**
00107   * @}
00108   */ 
00109 
00110 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32