最近碰到一个问题,具体是用CCS5烧写DSP2812后,DSP没有正常的运行,奇怪的地方是我用仿真器SEED510挂DSP调试FLASH时正常,甚至可以设置硬件断点调试,单步也没有问题。我查阅大量资料,肯定一下几点:(1)FLASh初始化程序拷贝在RAM中,我看了map文件;(2)memcpy这个函数调用了**2800.lib,应该没问题;(3)CMD文件中有ramfunc这段代码;(4)标准的codestart.asm文件。硬件请别人用CCS3.3烧写成功了。所以郁闷了,不知道问题在哪了。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
最近碰到一个问题,具体是用CCS5烧写DSP2812后,DSP没有正常的运行,奇怪的地方是我用仿真器SEED510挂DSP调试FLASH时正常,甚至可以设置硬件断点调试,单步也没有问题。我查阅大量资料,肯定一下几点:(1)FLASh初始化程序拷贝在RAM中,我看了map文件;(2)memcpy这个函数调用了**2800.lib,应该没问题;(3)CMD文件中有ramfunc这段代码;(4)标准的codestart.asm文件。硬件请别人用CCS3.3烧写成功了。所以郁闷了,不知道问题在哪了。
首先感谢您的回复。挂着仿真器SEED510是能够正常调试的,用的是烧写FLASH的CMD文件,然后断电脱开仿真器后重新上电不能正常运行。连接仿真器是可以看到内存空间中FLASH初始化明显在RAM里面:
0x3F9F00 ramfuncs_runstart, InitFlash
0x3F9F00 2538 EC60 E26D E2B6 A347 5895 523A 7BBE CB32
0x3F9F09 B812 742C 2021 75AD 55DC 40B9 AC4E 6D1A A0F1
0x3F9F12 7AAA B838 747B
(1)附CMD文件中的拷贝代码:
ramfuncs: LOAD = FLASHAB, PAGE = 0 /*RAML1*/
RUN = SECURE_RAM, PAGE = 0
RUN_START(_ramfuncs_runstart),
LOAD_START(_ramfuncs_loadstart),
LOAD_END(_ramfuncs_loadend)
(2)主函数中关于memcpy调用
//======内存Flash初始化,调用memcpy=============================//
memcpy(&ramfuncs_runstart,&ramfuncs_loadstart,&ramfuncs_loadend-&ramfuncs_loadstart);
InitFlash();
(2)附源文件列表:
(3)挂仿真器调试后的正常运行的图片
(4)on-chip FLASh的设置
(5)脱开仿真器,应该FLASH中有程序了,应该能够正常的启动,但是没有运行,串口没有数据出来,所以郁闷了。有几个警告,但是好像是兼容性问题,应该没事。
您说的这段代码肯定有,不然挂仿真器调试时,看不到FALSH初始化程序在RAM里面。
附FLASH初始化程序:
void InitFlash(void)
{
EALLOW;
//Enable Flash Pipeline mode to improve performance
//of code executed from Flash.
FlashRegs.FOPT.bit.ENPIPE = 1;
// CAUTION
//Minimum waitstates required for the flash operating
//at a given CPU rate must be characterized by TI.
//Refer to the datasheet for the latest information.
//Set the Random Waitstate for the Flash
FlashRegs.FBANKWAIT.bit.RANDWAIT = 3;//最小值
//Set the Paged Waitstate for the Flash
FlashRegs.FBANKWAIT.bit.PAGEWAIT = 3;//最小值
// CAUTION
//Minimum cycles required to move between power states
//at a given CPU rate must be characterized by TI.
//Refer to the datasheet for the latest information.
//For now use the default count
//Set number of cycles to transition from sleep to standby
FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;
//Set number of cycles to transition from standby to active
FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;
EDIS;
}
感谢您的回答,由于之前用CCS3.3和一样的程序烧写成功了,所以应该不会是硬件的问题,此外还换了一个一模一样的电路板试了一下,也不行。
附启动文件,看有没有问题:
(1)启动文件:DSP28_CodeStartBranch.asm
;//
;// TMDX ALPHA RELEASE
;// Intended for product evaluation purposes
;//
;//###########################################################################
;//
;// FILE: DSP28_CodeStartBranch.asm
;//
;// TITLE: DSP28 Branch to code start.
;//
;//###########################################################################
;//
;// Ver | dd mmm yyyy | Who | Description of changes
;// =====|=============|======|===============================================
;// 0.58| 29 Jun 2002 | L.H. | Original Release
;//###########################################################################
; Typically this section will be used to redirect code execution when using
; the boot mode "jump to Flash". It can also be used for "jump to H0" or
; "jump to OTP" modes.
; In this case, code needs to be re-directed to the C initilization routine
; called _c_int00.
; If code execution should begin at a different location (for example in
; assembly code) then modify the branch to location and .ref statement for
; the new location
.ref _c_int00
.sect "codestart"
LB _c_int00
(2)附加系统初始化文件:
//
// TMDX ALPHA RELEASE
// Intended for product evaluation purposes
//
//###########################################################################
//
// FILE: DSP28_SysCtrl.c
//
// TITLE: DSP28 Device System Control Initialization & Support Functions.
//
//###########################################################################
//
// Ver | dd mmm yyyy | Who | Description of changes
// =====|=============|======|===============================================
// 0.55| 06 May 2002 | L.H. | EzDSP Alpha Release
// 0.56| 20 May 2002 | L.H. | No change
// 0.57| 24 May 2002 | L.H. | Added initialization of RAM control registers
// | | | for TMX samples.
// 0.58| 29 Jun 2002 | L.H. | Added InitFlash function. Must be run from RAM
//###########################################################################
#include "DSP28_Device.h"
// Functions that will be run from RAM need to be assigned to
// a different section. This section will then be mapped using
// the linker cmd file.
#pragma CODE_SECTION(InitFlash, "ramfuncs");
//---------------------------------------------------------------------------
// InitSysCtrl:
//---------------------------------------------------------------------------
// This function initializes the System Control registers to a known state.
//
void InitSysCtrl(void)
{
Uint16 i;
EALLOW;
//======用于TMX系列产品,对于TMS320F2812来说,无用================//
DevEmuRegs.M0RAMDFT = 0x0300;
DevEmuRegs.M1RAMDFT = 0x0300;
DevEmuRegs.L0RAMDFT = 0x0300;
DevEmuRegs.L1RAMDFT = 0x0300;
DevEmuRegs.H0RAMDFT = 0x0300;
//======禁看门狗=============================================//
SysCtrlRegs.WDCR= 0x0068; //0x00AF;
//======晶振20MHz,PLL倍频10/2=5倍,系统时钟100MHz===============//
SysCtrlRegs.PLLCR = 0xa;
for(i= 0; i< 5000; i++){}
//======高速外设100MHz,低速外设25MHz============================//
SysCtrlRegs.HISPCP.all = 0x0000;
SysCtrlRegs.LOSPCP.all = 0x0002;
//======对相关外设时钟使能,事件管理器A和B,SCIA,CAN通讯,AD采样======//
SysCtrlRegs.PCLKCR.bit.EVAENCLK=1;
SysCtrlRegs.PCLKCR.bit.EVBENCLK=1;
SysCtrlRegs.PCLKCR.bit.SCIENCLKA=1;
SysCtrlRegs.PCLKCR.bit.SCIENCLKB=0;
SysCtrlRegs.PCLKCR.bit.MCBSPENCLK=0;
SysCtrlRegs.PCLKCR.bit.SPIENCLK=0;
SysCtrlRegs.PCLKCR.bit.ECANENCLK=1;
SysCtrlRegs.PCLKCR.bit.ADCENCLK=1;
EDIS;
}
// This function initializes the Flash Control registers
// CAUTION
// This function MUST be executed out of RAM. Executing it
// out of OTP/Flash will yield unpredictable results
void InitFlash(void)
{
EALLOW;
//Enable Flash Pipeline mode to improve performance
//of code executed from Flash.
FlashRegs.FOPT.bit.ENPIPE = 1;
// CAUTION
//Minimum waitstates required for the flash operating
//at a given CPU rate must be characterized by TI.
//Refer to the datasheet for the latest information.
//Set the Random Waitstate for the Flash
FlashRegs.FBANKWAIT.bit.RANDWAIT = 3;//最小值
//Set the Paged Waitstate for the Flash
FlashRegs.FBANKWAIT.bit.PAGEWAIT = 3;//最小值
// CAUTION
//Minimum cycles required to move between power states
//at a given CPU rate must be characterized by TI.
//Refer to the datasheet for the latest information.
//For now use the default count
//Set number of cycles to transition from sleep to standby
FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;
//Set number of cycles to transition from standby to active
FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;
EDIS;
}