/**
  @page STM32L1xx_IAP AN3310 STM32L1xx in-application programming using the USART Readme file
  
  @verbatim
  ******************** (C) COPYRIGHT 2012 STMicroelectronics *******************
  * @file    STM32L1xx_IAP/readme.txt 
  * @author  MCD Application Team
  * @version V1.1.0
  * @date    24-January-2012
  * @brief   Description of the AN3310 "STM32L1xx in-application programming
  *          using the USART (IAP)".
  ******************************************************************************
  * 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.
  *
  * FOR MORE INFORMATION PLEASE READ CAREFULLY THE LICENSE AGREEMENT FILE
  * LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.
  *
  ******************************************************************************
   @endverbatim

@par Description

This directory contains a set of sources files and pre-configured projects that 
describes how to build an application to be loaded into Flash memory using
In-Application Programming (IAP, through USART).


@par Directory contents 

 - "STM32L1xx_IAP\inc": contains the IAP firmware header files 
    - STM32L1xx_IAP/inc/common.h            This file provides all the headers of the common functions.
    - STM32L1xx_IAP/inc/flash_if.h          This file provides all the firmware 
                                            function headers of the flash_if.c file.
    - STM32L1xx_IAP/inc/menu.h              This file provides all the firmware
                                            function headers of the menu.c file.
    - STM32L1xx_IAP/inc/ymodem.h            This file provides all the firmware
                                            function headers of the ymodem.c file.
    - STM32L1xx_IAP/inc/stm32l1xx_conf.h    Library Configuration file
    - STM32L1xx_IAP/inc/stm32l1xx_it.h      Header for stm32l1xx_it.c

 - "STM32L1xx_IAP\MDK-ARM": contains pre-configured project for MDK-ARM toolchain

 - "STM32L1xx_IAP\RIDE": contains pre-configured project for RIDE toolchain

 - "STM32L1xx_IAP\HiTOP": contains pre-configured project for HiTOP toolchain

 - "STM32L1xx_IAP\EWARM": contains pre-configured project for EWARM toolchain

 - "STM32L1xx_IAP\TrueSTUDIO": contains pre-configured project for TrueSTUDIO toolchain

 - "STM32L1xx_IAP\src": contains the IAP firmware source files
    - STM32L1xx_IAP/src/main.c              Main program
    - STM32L1xx_IAP/src/stm32l1xx_it.c      Interrupt handlers
    - STM32L1xx_IAP/src/flash_if.c          The file contains write, erase and disable
                                            write protection of the internal Flash
                                            memory.
    - STM32L1xx_IAP/src/menu.c              This file contains the menu to select
                                            downloading a new binary file, uploading
                                            internal Flash memory, executing the binary
                                            and disabling the write protection of
                                            write-protected pages
    - STM32L1xx_IAP/src/common.c            This file provides functions related to
                                            read/write from/to USART peripheral
    - STM32L1xx_IAP/src/ymodem.c            This file provides all the firmware functions
                                            related to the ymodem protocol.
    - STM32L1xx_IAP/src/system_stm32l1xx.c  STM32L1xx system source file

@note The "system_stm32l1xx.c" is generated by an automatic clock configuration 
      system and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32L1xx_Clock_Configuration_V1.1.0.xls" 
      provided with the AN3309 package available on <a href="http://www.st.com/internet/mcu/family/141.jsp">  ST Microcontrollers </a>
         
@par Hardware and Software environment

  - This example runs on STM32L1xx Ultra Low Power High- and Medium-Density Devices.
  
  - This example has been tested with STMicroelectronics STM32L152D-EVAL (STM32L1xx 
    Ultra Low Power High-Density) and STM32L152-EVAL (STM32L1xx Ultra Low 
    Power Medium-Density) evaluation board and can be easily tailored to any 
    other supported device and development board.

  - STM32L152-EVAL Set-up
    - Connect a null-modem female/female RS232 cable between the DB9 connector 
      CN2 (USART2) and PC serial port.
    - Use the Key push-button.
    
  - STM32L152D-EVAL Set-up
    - Connect a null-modem female/female RS232 cable between the DB9 connector 
      CN1 (USART3) and PC serial port.
    - Use the Key push-button.
    - Make sure that JP2 and JP4 are in position 2<->3

  - Hyperterminal configuration: 
    - Word Length = 8 Bits
    - One Stop Bit
    - No parity
    - BaudRate = 115200 baud
    - flow control: None 


@par How to use it ? 

In order to make the program work, you must do the following:

  1. Generate a binary image for the program provided in the 
     "Project\STM32L1xx_IAP\binary_template" directory. 
  2. Program the internal Flash with the IAP (see below) 
  3. Open HyperTerminal window using the settings already defined in section
     "Hardware and Software environment" 
  4. To run the IAP driver, keep the Key push-button pressed at Reset. 
     The IAP main menu is then displayed on the HyperTerminal window.
  5. To download an application, press 1 and use the Ymodem protocol


  In order to load the IAP code, you have do the following:
   - EWARM:
      - Open the IAP.eww workspace
      - In the workspace toolbar select the project config:
          - STM32L152-EVAL: to configure the project for STM32L Ultra Low Power Medium-density devices
          - STM32L152D-EVAL: to configure the project for STM32L Ultra Low Power High-density devices
      - Rebuild all files: Project->Rebuild all
      - Load project image: Project->Debug
      - Run program: Debug->Go(F5)

   - RIDE:
      - Open the IAP.rprj project
      - In the configuration toolbar(Project->properties) select the project config:
          - STM32L152-EVAL: to configure the project for STM32L Ultra Low Power Medium-density devices
          - STM32L152D-EVAL: to configure the project for STM32L Ultra Low Power High-density devices
      - Rebuild all files: Project->build project
      - Load project image: Debug->start(ctrl+D)
      - Run program: Debug->Run(ctrl+F9)

   - MDK-ARM:
      - Open the IAP.uvproj project
      - In the build toolbar select the project config:
          - STM32L152-EVAL: to configure the project for STM32L Ultra Low Power Medium-density devices
          - STM32L152D-EVAL: to configure the project for STM32L Ultra Low Power High-density devices
      - Rebuild all files: Project->Rebuild all target files
      - Load project image: Debug->Start/Stop Debug Session
      - Run program: Debug->Run (F5)

   - TASKING
      - Open TASKING toolchain.
      - Click on File->Import, select General->'Existing Projects into Workspace' 
        and then click "Next". 
      - Browse to TASKING workspace directory and select the project: 
          - STM32L152D-EVAL: to configure the project for STM32l152x devices.
      - Rebuild all project files: Select the project in the "Project explorer" 
        window then click on Project->build project menu.
      - Run program: Select the project in the "Project explorer" window then click 
        Run->Debug (F11)

   - TrueSTUDO:
      - Open the TrueSTUDIO toolchain.
      - Click on File->Switch Workspace->Other and browse to TrueSTUDIO workspace directory.
      - Click on File->Import, select General->'Existing Projects into Workspace' and then click "Next". 
      - Browse to the TrueSTUDIO workspace directory, select the project:
          - STM32L152-EVAL: to configure the project for STM32L Ultra Low Power Medium-density devices
          - STM32L152D-EVAL: to configure the project for STM32L Ultra Low Power High-density devices
      - Under Windows->Preferences->General->Workspace->Linked Resources, add 
        a variable path named "CurPath" which points to the folder containing
        "Libraries", "Project" and "Utilities" folders.
      - Rebuild all project files: Select the project in the "Project explorer" 
        window then click on Project->build project menu.
      - Run program: Run->Debug (F11)

@note
- Ultra Low Power Medium-density devices are STM32L151xx and STM32L152xx 
  microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes.
- Ultra Low Power Medium-density Plus devices are STM32L151xx, STM32L152xx and 
  STM32L162xx microcontrollers where the Flash memory density is 256 Kbytes.
- Ultra Low Power High-density devices are STM32L151xx, STM32L152xx and STM32L162xx 
  microcontrollers where the Flash memory density is 384 Kbytes.

 * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
 */
