📄 flash.lst
字号:
ARM COMPILER V2.42, Flash 09/01/06 14:42:16 PAGE 1
ARM COMPILER V2.42, COMPILATION OF MODULE Flash
OBJECT MODULE PLACED IN Flash.OBJ
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe Flash.c THUMB DEBUG TABS(4)
stmt level source
1 /*********************************************************************
2
3 Author : ADI - Apps www.analog.com/MicroConverter
4
5 Date : Sept. 2005
6
7 File : Flash.c , RAM.c
8
9 Hardware : Applicable to ADuC702x rev H or I silicon
10 Currently targetting ADuC7026.
11
12 Description : This example demonstrate how to place functions in RAM.
13 The UART is configured, the current PC location printed
14 to a termainl ( 9600-8-N-1 ), the program then jumps to
15 the RAM function and prints the current PC location to
16 the termainl. The example includes a function that has
17 code written in assembly that allows us access the
18 Program Counter
19
20 Note : The files syscalls.c and serial.c are required.
21
22 *********************************************************************/
23
24
25 #include <ADuC7026.h>
26 #include<stdio.h>
27
28 // Function Prototypes
29 extern void Ram_Function(void);
30 int getPC (void);
31
32
33 int main(void)
34 {
35 1 register unsigned int PC;
36 1
37 1 GP1CON = 0x011; // Setup tx & rx pins on P1.0 and P1.1
38 1
39 1 // Set UART to 9600bps 8-N-1 (CD=0)
40 1 COMCON0 = 0x80; // Setting DLAB
41 1 COMDIV0 = 0x88;
42 1 COMDIV1 = 0x00;
43 1 COMCON0 = 0x07; // Clearing DLAB
44 1
45 1
46 1 //Print current program counter address ... currently executing from FLASH!!
47 1 printf("This is the main Flash Function.\n");
48 1 PC = getPC(); // Getting current locatin of Program Counter (Register R15)
49 1 printf("The Current location of the Program Counter is : 0x%08X\n",PC);
50 1
51 1 Ram_Function();
52 1
53 1 return 0;
54 1 }
55
56
57
58 int getPC (void) { // Function to return the current location of the Program Counter
59 1
ARM COMPILER V2.42, Flash 09/01/06 14:42:16 PAGE 2
60 1 int RetVal;
61 1 __asm { // __asm attribute defines code as assembly code
62 1 MOV R0,LR
63 1 STAV R0,R1,RetVal
64 1 }
65 1 return (RetVal);
66 1 }
ARM COMPILER V2.42, Flash 09/01/06 14:42:16 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN CODE16 (printf?T)
EXTERN CODE16 (Ram_Function?T)
EXTERN NUMBER (__startup)
*** PUBLICS:
PUBLIC getPC?T
PUBLIC main
*** DATA SEGMENT '?CON?Flash':
00000000 ??S_2:
00000000 DB 'The Current location of the Program Co'
00000026 DB 'unter is : 0x%08X',0x0A,0x00
00000039 ??S_1:
00000039 DB 'This is the main Flash Function.',0x0A
0000005A DB 0x00
*** CODE SEGMENT '?PR?main?Flash':
33: int main(void)
00000000 B500 PUSH {LR}
34: {
00000002 ; SCOPE-START
37: GP1CON = 0x011; // Setup tx & rx pins on P1.0 and P1.1
00000002 2111 MOV R1,#0x11
00000004 4800 LDR R0,=0xFFFFF404
00000006 6001 STR R1,[R0,#0x0]
40: COMCON0 = 0x80; // Setting DLAB
00000008 2180 MOV R1,#0x80
0000000A 4800 LDR R0,=0xFFFF070C
0000000C 6001 STR R1,[R0,#0x0]
41: COMDIV0 = 0x88;
0000000E 2188 MOV R1,#0x88
00000010 4800 LDR R0,=0xFFFF0700
00000012 6001 STR R1,[R0,#0x0]
42: COMDIV1 = 0x00;
00000014 2100 MOV R1,#0x0
00000016 4800 LDR R0,=0xFFFF0704
00000018 6001 STR R1,[R0,#0x0]
43: COMCON0 = 0x07; // Clearing DLAB
0000001A 2107 MOV R1,#0x7
0000001C 4800 LDR R0,=0xFFFF070C
0000001E 6001 STR R1,[R0,#0x0]
47: printf("This is the main Flash Function.\n");
00000020 4800 LDR R0,=??S_1 ; ??S_1
00000022 F7FF BL printf?T ; T=0x0001 (1)
00000024 FFED BL printf?T ; T=0x0001 (2)
48: PC = getPC(); // Getting current locatin of Program Counter (Register R15)
00000026 F7FF BL getPC?T ; T=0x0001 (1)
00000028 FFEB BL getPC?T ; T=0x0001 (2)
0000002A 1C02 MOV R2,R0 ; PC
0000002C ---- Variable 'PC' assigned to Register 'R2' ----
49: printf("The Current location of the Program Counter is : 0x%08X\n",PC);
0000002C 4800 LDR R0,=??S_2 ; ??S_2
0000002E 1C11 MOV R1,R2 ; PC
00000030 F7FF BL printf?T ; T=0x0001 (1)
00000032 FFE6 BL printf?T ; T=0x0001 (2)
51: Ram_Function();
00000034 F7FF BL Ram_Function?T ; T=0x0001 (1)
00000036 FFE4 BL Ram_Function?T ; T=0x0001 (2)
53: return 0;
00000038 2000 MOV R0,#0x0
0000003A ; SCOPE-END
54: }
0000003A BC08 POP {R3}
ARM COMPILER V2.42, Flash 09/01/06 14:42:16 PAGE 4
0000003C 4718 BX R3
0000003E ENDP ; 'main'
*** CODE SEGMENT '?PR?getPC?T?Flash':
58: int getPC (void) { // Function to return the current location of the Program Counter
00000000 B500 PUSH {LR}
00000002 B081 SUB R13,#0x4
00000004 ; SCOPE-START
62: MOV R0,LR
00000004 4670 MOV R0,R14
63: STAV R0,R1,RetVal
00000006 9000 STR R0,[R13,#0x0] ; RetVal
65: return (RetVal);
00000008 9800 LDR R0,[R13,#0x0] ; RetVal
0000000A ; SCOPE-END
66: }
0000000A B001 ADD R13,#0x4
0000000C BC08 POP {R3}
0000000E 4718 BX R3
00000010 ENDP ; 'getPC?T'
Module Information Static
----------------------------------
code size = ------
data size = ------
const size = 91
End of Module Information.
ARM COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -