配置成FLASH 模式步骤

1、将工程目录“DSP2833x_Libraries”下的28335_RAM_lnk.cmd 删除,然后从TI 提供给我们的库文件中把“ F28335.cmd ” 拷贝到现在实验文件夹“DSP2833x_Libraries”目录下。该文件是对FLASH 模式的配置,TI 公司已经给我们配置好了,一般我们不需要更改。

2、在main 函数开始处添加FLASH 模式配置的必须代码,如下:
//复制对时间敏感代码和FLASH 配置代码到RAM 中
// 包括FLASH 初始化函数InitFlash();
// 链接后将产生RamfuncsLoadStart, RamfuncsLoadEnd, 和
RamfuncsRunStart
// 参数. 请参考F28335.cmd 文件
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
// 调用FLASH 初始化函数来设置flash 等待状态
// 这个函数必须在RAM 中运行
InitFlash();
上述两条语句是在使用FLASH 模式必要的,通过这两条语句以及F28335.cmd
文件即可将程序烧入到芯片的FLASH 中,这样程序断电后也不会丢失。

主函数

在main 函数开始处增加了FLASH 初始化代码,main 函数代码如下:

#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
#include "leds.h"
#include "time.h"
#include "uart.h"
#include "stdio.h"

void main()
{
Uint16 i=0;
InitSysCtrl();
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
//复制对时间敏感代码和FLASH 配置代码到RAM 中
// 包括FLASH 初始化函数InitFlash();
// 链接后将产生RamfuncsLoadStart, RamfuncsLoadEnd, 和
RamfuncsRunStart
// 参数. 请参考F28335.cmd 文件
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd,
&RamfuncsRunStart);
// 调用FLASH 初始化函数来设置flash 等待状态
// 这个函数必须在RAM 中运行
InitFlash();
LED_Init();
TIM0_Init(150,200000);//200ms

667
UARTa_Init(4800);
while(1)
{
}
}

更多推荐