亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? main.c

?? STM32F4-Discovery FLASH-Program keil&iar例程
?? C
字號:
/**
  ******************************************************************************
  * @file    FLASH_Program/main.c 
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    19-September-2011
  * @brief   Main program body
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */ 

/* Includes ------------------------------------------------------------------*/
#include "stm32f4_discovery.h"


/** @addtogroup STM32F4_Discovery_Peripheral_Examples
  * @{
  */

/** @addtogroup FLASH_Program
  * @{
  */ 

/* Private typedef -----------------------------------------------------------*/
typedef enum {FAILED = 0, PASSED = !FAILED} TestStatus;

/* Private define ------------------------------------------------------------*/

#define FLASH_USER_START_ADDR   ADDR_FLASH_SECTOR_2   /* Start @ of user Flash area */
#define FLASH_USER_END_ADDR     ADDR_FLASH_SECTOR_5   /* End @ of user Flash area */

/* Base address of the Flash sectors */
#define ADDR_FLASH_SECTOR_0     ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */
#define ADDR_FLASH_SECTOR_1     ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */
#define ADDR_FLASH_SECTOR_2     ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */
#define ADDR_FLASH_SECTOR_3     ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */
#define ADDR_FLASH_SECTOR_4     ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */
#define ADDR_FLASH_SECTOR_5     ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */
#define ADDR_FLASH_SECTOR_6     ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */
#define ADDR_FLASH_SECTOR_7     ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */
#define ADDR_FLASH_SECTOR_8     ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbytes */
#define ADDR_FLASH_SECTOR_9     ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbytes */
#define ADDR_FLASH_SECTOR_10    ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbytes */
#define ADDR_FLASH_SECTOR_11    ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbytes */

#define DATA_32                 ((uint32_t)0x12345678)

/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
uint32_t StartSector = 0, EndSector = 0, Address = 0, i = 0 ;
__IO uint32_t data32 = 0 , MemoryProgramStatus = 0 ;
  
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
uint32_t GetSector(uint32_t Address);

/**
  * @brief   Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */
  
  /* Unlock the Flash to enable the flash control register access *************/ 
  FLASH_Unlock();
    
  /* Erase the user Flash area
    (area defined by FLASH_USER_START_ADDR and FLASH_USER_END_ADDR) ***********/

  /* Clear pending flags (if any) */  
  FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | 
                  FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR); 

  /* Get the number of the start and end sectors */
  StartSector = GetSector(FLASH_USER_START_ADDR);
  EndSector = GetSector(FLASH_USER_END_ADDR);

  for (i = StartSector; i < EndSector; i += 8)
  {
    /* Device voltage range supposed to be [2.7V to 3.6V], the operation will
       be done by word */ 
    if (FLASH_EraseSector(i, VoltageRange_3) != FLASH_COMPLETE)
    { 
      /* Error occurred while sector erase. 
         User can add here some code to deal with this error  */
      while (1)
      {
      }
    }
  }

  /* Program the user Flash area word by word
    (area defined by FLASH_USER_START_ADDR and FLASH_USER_END_ADDR) ***********/

  Address = FLASH_USER_START_ADDR;

  while (Address < FLASH_USER_END_ADDR)
  {
    if (FLASH_ProgramWord(Address, DATA_32) == FLASH_COMPLETE)
    {
      Address = Address + 4;
    }
    else
    { 
      /* Error occurred while writing data in Flash memory. 
         User can add here some code to deal with this error */
      while (1)
      {
      }
    }
  }

  /* Lock the Flash to disable the flash control register access (recommended
     to protect the FLASH memory against possible unwanted operation) *********/
  FLASH_Lock(); 

  /* Check if the programmed data is OK 
      MemoryProgramStatus = 0: data programmed correctly
      MemoryProgramStatus != 0: number of words not programmed correctly ******/
  Address = FLASH_USER_START_ADDR;
  MemoryProgramStatus = 0x0;
  
  while (Address < FLASH_USER_END_ADDR)
  {
    data32 = *(__IO uint32_t*)Address;

    if (data32 != DATA_32)
    {
      MemoryProgramStatus++;  
    }

    Address = Address + 4;
  }  
 
  while (1)
  {
  }
}

/**
  * @brief  Gets the sector of a given address
  * @param  None
  * @retval The sector of a given address
  */
uint32_t GetSector(uint32_t Address)
{
  uint32_t sector = 0;
  
  if((Address < ADDR_FLASH_SECTOR_1) && (Address >= ADDR_FLASH_SECTOR_0))
  {
    sector = FLASH_Sector_0;  
  }
  else if((Address < ADDR_FLASH_SECTOR_2) && (Address >= ADDR_FLASH_SECTOR_1))
  {
    sector = FLASH_Sector_1;  
  }
  else if((Address < ADDR_FLASH_SECTOR_3) && (Address >= ADDR_FLASH_SECTOR_2))
  {
    sector = FLASH_Sector_2;  
  }
  else if((Address < ADDR_FLASH_SECTOR_4) && (Address >= ADDR_FLASH_SECTOR_3))
  {
    sector = FLASH_Sector_3;  
  }
  else if((Address < ADDR_FLASH_SECTOR_5) && (Address >= ADDR_FLASH_SECTOR_4))
  {
    sector = FLASH_Sector_4;  
  }
  else if((Address < ADDR_FLASH_SECTOR_6) && (Address >= ADDR_FLASH_SECTOR_5))
  {
    sector = FLASH_Sector_5;  
  }
  else if((Address < ADDR_FLASH_SECTOR_7) && (Address >= ADDR_FLASH_SECTOR_6))
  {
    sector = FLASH_Sector_6;  
  }
  else if((Address < ADDR_FLASH_SECTOR_8) && (Address >= ADDR_FLASH_SECTOR_7))
  {
    sector = FLASH_Sector_7;  
  }
  else if((Address < ADDR_FLASH_SECTOR_9) && (Address >= ADDR_FLASH_SECTOR_8))
  {
    sector = FLASH_Sector_8;  
  }
  else if((Address < ADDR_FLASH_SECTOR_10) && (Address >= ADDR_FLASH_SECTOR_9))
  {
    sector = FLASH_Sector_9;  
  }
  else if((Address < ADDR_FLASH_SECTOR_11) && (Address >= ADDR_FLASH_SECTOR_10))
  {
    sector = FLASH_Sector_10;  
  }
  else/*(Address < FLASH_END_ADDR) && (Address >= ADDR_FLASH_SECTOR_11))*/
  {
    sector = FLASH_Sector_11;  
  }

  return sector;
}

#ifdef  USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)
{ 
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

/**
  * @}
  */ 

/**
  * @}
  */ 

/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久精品app| 中文字幕一区二区三区四区不卡| 久久久噜噜噜久久人人看| 国产精品对白交换视频| 婷婷国产在线综合| 成人精品视频一区二区三区尤物| 欧美日本一区二区三区| 亚洲天堂免费看| 精品无人码麻豆乱码1区2区| 欧美日韩一区小说| 国产精品成人一区二区艾草| 久久99精品久久久久久| 欧美视频在线一区| 亚洲欧洲99久久| 狠狠色狠狠色合久久伊人| 欧美日韩电影在线| 一区二区激情视频| 成人av网址在线| 久久亚洲一区二区三区明星换脸| 日韩一区精品视频| 欧美亚洲高清一区| 亚洲精品视频在线观看免费| 成人午夜激情片| 亚洲国产精品99久久久久久久久| 激情综合色播五月| 日韩欧美中文字幕公布| 午夜电影一区二区| 欧美日韩五月天| 三级欧美韩日大片在线看| 欧美性大战久久久| 亚洲一区二区三区在线播放| 91高清在线观看| 亚洲在线视频免费观看| 在线观看av一区二区| 亚洲日本va午夜在线影院| 9i看片成人免费高清| 国产精品三级av在线播放| 不卡的电影网站| 国产精品乱码一区二区三区软件| 高清国产午夜精品久久久久久| 久久一区二区三区国产精品| 国产伦精品一区二区三区免费迷 | 国产日韩精品一区二区三区在线| 麻豆91在线看| 久久只精品国产| 国产suv一区二区三区88区| 国产精品美女www爽爽爽| 99久久99久久久精品齐齐| 亚洲精品中文在线影院| 欧美自拍偷拍午夜视频| 婷婷综合另类小说色区| 欧美电影在线免费观看| 久草热8精品视频在线观看| 久久综合久久鬼色中文字| 成人午夜视频网站| 亚洲精品国产品国语在线app| 欧美日韩另类国产亚洲欧美一级| 日韩精品久久理论片| 26uuu久久天堂性欧美| 成人免费毛片嘿嘿连载视频| 中文字幕永久在线不卡| 欧美美女视频在线观看| 黄色精品一二区| 亚洲欧洲精品一区二区三区| 欧美午夜一区二区三区免费大片| 久久精品久久综合| 中文字幕佐山爱一区二区免费| 欧美日韩国产影片| 国产福利视频一区二区三区| 亚洲柠檬福利资源导航| 精品国产髙清在线看国产毛片 | 韩国一区二区三区| 亚洲四区在线观看| 日韩一级高清毛片| 99免费精品在线观看| 蜜臀av一区二区在线观看| 欧美亚洲日本一区| 欧美影视一区二区三区| 成人丝袜高跟foot| 99这里只有久久精品视频| 色94色欧美sute亚洲13| 国产午夜三级一区二区三| 9i在线看片成人免费| 亚洲电影在线免费观看| 在线观看日韩电影| 国产麻豆精品久久一二三| 最新久久zyz资源站| 91精品免费观看| 成人一二三区视频| 日韩中文字幕不卡| 国产精品麻豆久久久| 欧美日韩视频在线一区二区| eeuss鲁一区二区三区| 视频精品一区二区| 成人欧美一区二区三区1314| 欧美精品乱码久久久久久按摩| 国产成人精品一区二区三区四区| 一二三区精品福利视频| 久久久久久久综合| 91国偷自产一区二区三区观看| 国精产品一区一区三区mba桃花 | 色一区在线观看| 久久国产视频网| 日韩精品免费视频人成| 日韩伦理免费电影| 国产视频一区在线观看| 777午夜精品免费视频| 99久久亚洲一区二区三区青草| 人人爽香蕉精品| 亚洲综合免费观看高清完整版在线 | 久久激情五月婷婷| 亚洲小说欧美激情另类| 日本一区二区三区久久久久久久久不 | 亚洲成人一二三| 国产精品白丝在线| 国产调教视频一区| 欧美成人性战久久| 日韩女优av电影在线观看| 欧美日韩精品高清| 色偷偷88欧美精品久久久| 懂色av一区二区三区蜜臀| 激情小说欧美图片| 美女视频网站久久| 视频一区二区三区在线| 亚洲国产欧美一区二区三区丁香婷| 亚洲国产成人一区二区三区| 久久精品一区四区| 久久久三级国产网站| 精品欧美一区二区在线观看| 欧美一区二区三区在线观看视频| 色偷偷久久人人79超碰人人澡| 狠狠v欧美v日韩v亚洲ⅴ| 国产99一区视频免费| 国产九色精品成人porny| 国模少妇一区二区三区| 国产精品一区免费在线观看| 国产露脸91国语对白| 丁香婷婷综合网| 9人人澡人人爽人人精品| 91色综合久久久久婷婷| 色婷婷亚洲一区二区三区| 色吊一区二区三区| 欧美日韩中文另类| 精品免费99久久| 久久久久国产一区二区三区四区| 精品欧美一区二区三区精品久久| 精品国产伦理网| 精品国产免费视频| 国产精品私人影院| 亚洲色图在线看| 麻豆高清免费国产一区| 国产91精品露脸国语对白| 99久久国产综合色|国产精品| 色综合中文字幕国产 | 91美女在线观看| 91精品福利视频| 7777精品伊人久久久大香线蕉最新版| 欧美丰满一区二区免费视频| 欧美性生交片4| 欧美精品一级二级| 久久人人超碰精品| 亚洲欧美色图小说| 蜜臀国产一区二区三区在线播放| 国产精品资源在线| 在线一区二区视频| 欧美大片顶级少妇| 国产精品精品国产色婷婷| 国产精品久久99| 亚洲bt欧美bt精品| 国产传媒日韩欧美成人| 欧美在线观看一区| 精品国产一区二区在线观看| 国产精品久久久久国产精品日日| 亚洲午夜一二三区视频| 七七婷婷婷婷精品国产| 日本国产一区二区| 久久尤物电影视频在线观看| 亚洲精品菠萝久久久久久久| 麻豆精品新av中文字幕| 99久久久国产精品| 精品欧美一区二区三区精品久久| 最近日韩中文字幕| 久久97超碰国产精品超碰| 色婷婷综合久久久| 欧美精品一区在线观看| 亚洲成人一区在线| 欧美在线高清视频| 国产精品污网站| 精品一区二区三区蜜桃| 欧美性感一类影片在线播放| 国产精品女同互慰在线看| 亚洲成人一区在线| 欧美色综合网站| 亚洲视频一二三区| 岛国av在线一区| 2024国产精品| 人禽交欧美网站| 制服丝袜一区二区三区| 亚洲高清在线视频| 色哟哟亚洲精品|