?? flash.lst
字號:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.40A/W32 17/Jan/2007 16:16:24 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Stack alignment = 4 #
# Source file = D:\lilian\STR71X\application note\IAP using #
# UART\an2078_IAR(forum)\an2078\IAP_V2.0\source\flash. #
# c #
# Command line = "D:\lilian\STR71X\application note\IAP using #
# UART\an2078_IAR(forum)\an2078\IAP_V2.0\source\flash. #
# c" -lC "D:\lilian\STR71X\application note\IAP using #
# UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\Debug\Li #
# st\" -lA "D:\lilian\STR71X\application note\IAP #
# using UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\De #
# bug\List\" -o "D:\lilian\STR71X\application #
# note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2. #
# 0\user\Debug\Obj\" -z2 --no_cse --no_unroll #
# --no_inline --no_code_motion --no_tbaa #
# --no_clustering --no_scheduling --debug --cpu_mode #
# arm --endian little --cpu ARM7TDMI --stack_align 4 #
# -e --fpu None --dlib_config "C:\Program Files\IAR #
# Systems\Embedded Workbench #
# 4.0\arm\LIB\dl4tpannl8n.h" --segment #
# code=CODE_Flash -I "D:\lilian\STR71X\application #
# note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2. #
# 0\user\..\include\" -I "D:\lilian\STR71X\application #
# note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2 #
# .0\user\..\common\" -I "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0\arm\INC\" #
# List file = D:\lilian\STR71X\application note\IAP using #
# UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\Debug\Li #
# st\flash.lst #
# Object file = D:\lilian\STR71X\application note\IAP using #
# UART\an2078_IAR(forum)\an2078\IAP_V2.0\user\Debug\Ob #
# j\flash.r79 #
# #
# #
##############################################################################
D:\lilian\STR71X\application note\IAP using UART\an2078_IAR(forum)\an2078\IAP_V2.0\source\flash.c
1 /******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2 * File Name : flash.c
3 * Author : MCD Application Team
4 * Date First Issued : 07/28/2003
5 * Description : This file provides all the Flash software functions.
6 ********************************************************************************
7 * History:
8 * 02/01/2006 : IAP Version 2.0
9 * 11/24/2004 : IAP Version 1.0
10 *******************************************************************************
11 THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
12 CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
13 AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
14 OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
15 OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
16 CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 *******************************************************************************/
18
19 #include "flash.h"
20
21 /*******************************************************************************
22 * Function Name : FLASH_Init
23 * Description : Initialise the Flash registers to their default values.
24 * Input : None.
25 * Return : None.
26 *******************************************************************************/
\ In segment CODE_Flash, align 4, keep-with-next
27 void FLASH_Init(void)
28 {
29 /* Reset Flash Control Registers */
30 FLASHR->CR0 = 0x00000000;
\ FLASH_Init:
\ 00000000 4004A0E3 MOV R0,#+1073741824
\ 00000004 400980E3 ORR R0,R0,#0x100000
\ 00000008 0010A0E3 MOV R1,#+0
\ 0000000C 001080E5 STR R1,[R0, #+0]
31 FLASHR->CR1 = 0x00000000;
\ 00000010 4402A0E3 MOV R0,#+1073741828
\ 00000014 400980E3 ORR R0,R0,#0x100000
\ 00000018 0010A0E3 MOV R1,#+0
\ 0000001C 001080E5 STR R1,[R0, #+0]
32 /* Reset Flash Data Registers */
33 FLASHR->DR0 = 0xFFFFFFFF;
\ 00000020 8402A0E3 MOV R0,#+1073741832
\ 00000024 400980E3 ORR R0,R0,#0x100000
\ 00000028 0010E0E3 MVN R1,#+0
\ 0000002C 001080E5 STR R1,[R0, #+0]
34 FLASHR->DR1 = 0xFFFFFFFF;
\ 00000030 C402A0E3 MOV R0,#+1073741836
\ 00000034 400980E3 ORR R0,R0,#0x100000
\ 00000038 0010E0E3 MVN R1,#+0
\ 0000003C 001080E5 STR R1,[R0, #+0]
35 /* Reset Flash Error Register */
36 FLASHR->ER = 0x00000000;
\ 00000040 5101A0E3 MOV R0,#+1073741844
\ 00000044 400980E3 ORR R0,R0,#0x100000
\ 00000048 0010A0E3 MOV R1,#+0
\ 0000004C 001080E5 STR R1,[R0, #+0]
37 }
\ 00000050 0EF0A0E1 MOV PC,LR ;; return
38
39 /*******************************************************************************
40 * Function Name : FLASH_WordWrite
41 * Description : Writes a Word in the Flash.
42 * Input 1 : Address of the Destination.
43 * Input 2 : Word to program at Address.
44 * Return : None.
45 *******************************************************************************/
\ In segment CODE_Flash, align 4, keep-with-next
46 void FLASH_WordWrite(u32 XtargetAdd, u32 Xdata)
47 {
\ FLASH_WordWrite:
\ 00000000 30402DE9 PUSH {R4,R5,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
48 /* Wait until another operation going on is completed */
49 FLASH_WaitForLastTask();
\ 0000000C ........ BL FLASH_WaitForLastTask
50 /* Set the Word Programming bit 'WPG' in the CR0 Reg */
51 FLASHR->CR0 |= FLASH_WPG_Mask;
\ 00000010 4004A0E3 MOV R0,#+1073741824
\ 00000014 400980E3 ORR R0,R0,#0x100000
\ 00000018 4014A0E3 MOV R1,#+1073741824
\ 0000001C 401981E3 ORR R1,R1,#0x100000
\ 00000020 001091E5 LDR R1,[R1, #+0]
\ 00000024 801591E3 ORRS R1,R1,#0x20000000
\ 00000028 001080E5 STR R1,[R0, #+0]
52 /* Load the destination address in AR */
53 FLASHR->AR = XtargetAdd;
\ 0000002C 4101A0E3 MOV R0,#+1073741840
\ 00000030 400980E3 ORR R0,R0,#0x100000
\ 00000034 004080E5 STR R4,[R0, #+0]
54 /* Load DATA to be programmed in DR0 */
55 FLASHR->DR0 = Xdata;
\ 00000038 8402A0E3 MOV R0,#+1073741832
\ 0000003C 400980E3 ORR R0,R0,#0x100000
\ 00000040 005080E5 STR R5,[R0, #+0]
56 /* Set the Write Mode Start bit 'WMS' in the CR0 Reg to Start Write Operation */
57 FLASHR->CR0 |= FLASH_WMS_Mask;
\ 00000044 4004A0E3 MOV R0,#+1073741824
\ 00000048 400980E3 ORR R0,R0,#0x100000
\ 0000004C 4014A0E3 MOV R1,#+1073741824
\ 00000050 401981E3 ORR R1,R1,#0x100000
\ 00000054 001091E5 LDR R1,[R1, #+0]
\ 00000058 801491E3 ORRS R1,R1,#0x80000000
\ 0000005C 001080E5 STR R1,[R0, #+0]
58 /* Wait until the write operation is completed */
59 FLASH_WaitForLastTask();
\ 00000060 ........ BL FLASH_WaitForLastTask
60 }
\ 00000064 3080BDE8 POP {R4,R5,PC} ;; return
61
62 /*******************************************************************************
63 * Function Name : FLASH_SectorErase
64 * Description : Erases a Flash sector.
65 * Input 1 : Sectors to be Erased.
66 * Return : None.
67 *******************************************************************************/
\ In segment CODE_Flash, align 4, keep-with-next
68 void FLASH_SectorErase(u32 Xsectors)
69 {
\ FLASH_SectorErase:
\ 00000000 10402DE9 PUSH {R4,LR}
\ 00000004 0040B0E1 MOVS R4,R0
70 /* Wait until another operation going on is completed */
71 FLASH_WaitForLastTask();
\ 00000008 ........ BL FLASH_WaitForLastTask
72 /* Set the Sector Erase flag 'SER' in the CRO reg */
73 FLASHR->CR0 |= FLASH_SER_Mask;
\ 0000000C 4004A0E3 MOV R0,#+1073741824
\ 00000010 400980E3 ORR R0,R0,#0x100000
\ 00000014 4014A0E3 MOV R1,#+1073741824
\ 00000018 401981E3 ORR R1,R1,#0x100000
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -