📄 flash.c
字号:
/*********************************************************************
Author : ADI - Apps www.analog.com/MicroConverter
Date : Sept. 2005
File : Flash.c , RAM.c
Hardware : Applicable to ADuC702x rev H or I silicon
Currently targetting ADuC7026.
Description : This example demonstrate how to place functions in RAM.
The UART is configured, the current PC location printed
to a termainl ( 9600-8-N-1 ), the program then jumps to
the RAM function and prints the current PC location to
the termainl.
Note : The files syscalls.c and serial.c are required.
*********************************************************************/
#include <ADuC7026.h>
#include<stdio.h>
// Program Counter Defintion. Allows us to access R15.
register unsigned int R15 asm ("pc");
// Function Prototype with required function attribute.
extern void Ram_Function(void) __attribute__ ((section (".ram_func")));
int main(void)
{
// Setup tx & rx pins on P1.0 and P1.1
GP1CON = 0x011;
// Set UART to 9600bps 8-N-1
COMCON0 = 0x80; // Setting DLAB
COMDIV0 = 0x88;
COMDIV1 = 0x00;
COMCON0 = 0x07; // Clearing DLAB
//Print current program counter address ... currently executing from FLASH!!
printf("This is the main Flash Function.\n");
printf("The Current location of the Program Counter is : 0x%08X\n",R15);
Ram_Function();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -