我的程序在ram调试的时候用的是rts2800_ml.lib库,而想要往Flash里固化则必须改成rts2800n.lib这个库,可更改成这个库后在线调试条用的一些字符串函数就不能用了,请问想Flash里固化的库是固定的么 和什么有关系 怎么更改
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.
我的程序在ram调试的时候用的是rts2800_ml.lib库,而想要往Flash里固化则必须改成rts2800n.lib这个库,可更改成这个库后在线调试条用的一些字符串函数就不能用了,请问想Flash里固化的库是固定的么 和什么有关系 怎么更改
MEMORY
{
PAGE 0 :
OTP : origin = 0x3D7800, length = 0x000800
FLASHJ : origin = 0x3D8000, length = 0x002000
FLASHI : origin = 0x3DA000, length = 0x002000
FLASHH : origin = 0x3DC000, length = 0x006000
/*
FLASHH : origin = 0x3DC000, length = 0x004000
FLASHG : origin = 0x3E0000, length = 0x004000
*/
FLASHP : origin = 0x3E4000, length = 0x013FF6
/*
FLASHF : origin = 0x3E4000, length = 0x004000
FLASHE : origin = 0x3E8000, length = 0x004000
FLASHD : origin = 0x3EC000, length = 0x004000
FLASHC : origin = 0x3F0000, length = 0x004000
FLASHB : origin = 0x3F4000, length = 0x002000
FLASHA : origin = 0x3F6000, length = 0x001FF6 */
BEGIN : origin = 0x3F7FF6, length = 0x000002
PASSWDS : origin = 0x3F7FF8, length = 0x000008
ROM : origin = 0x3FF000, length = 0x000FC0
VECTORS : origin = 0x3FFFC2, length = 0x00003E
PAGE 1 :
/* SARAM */
RAMM0 : origin = 0x000000, length = 0x000400
RAMM1 : origin = 0x000400, length = 0x000400
/* Peripheral Frame 0: */
DEV_EMU : origin = 0x000880, length = 0x000180
FLASH_REGS : origin = 0x000A80, length = 0x000060
CSM : origin = 0x000AE0, length = 0x000010
XINTF : origin = 0x000B20, length = 0x000020
CPU_TIMER0 : origin = 0x000C00, length = 0x000008
CPU_TIMER1 : origin = 0x000C08, length = 0x000008
CPU_TIMER2 : origin = 0x000C10, length = 0x000008
PIE_CTRL : origin = 0x000CE0, length = 0x000020
PIE_VECT : origin = 0x000D00, length = 0x000100
/* Peripheral Frame 1: */
ECAN_A : origin = 0x006000, length = 0x000100
ECAN_AMBOX : origin = 0x006100, length = 0x000100
/* Peripheral Frame 2: */
SYSTEM : origin = 0x007010, length = 0x000020
SPI_A : origin = 0x007040, length = 0x000010
SCI_A : origin = 0x007050, length = 0x000010
XINTRUPT : origin = 0x007070, length = 0x000010
GPIOMUX : origin = 0x0070C0, length = 0x000020
GPIODAT : origin = 0x0070E0, length = 0x000020
ADC : origin = 0x007100, length = 0x000020
EV_A : origin = 0x007400, length = 0x000040
EV_B : origin = 0x007500, length = 0x000040
SPI_B : origin = 0x007740, length = 0x000010
SCI_B : origin = 0x007750, length = 0x000010
MCBSP_A : origin = 0x007800, length = 0x000040
/* CSM Password Locations */
CSM_PWL : origin = 0x3F7FF8, length = 0x000008
/* SARAM */
DRAMH0 : origin = 0x3f8000, length = 0x002000
RAML0L1 : origin = 0x008000, length = 0x002000
ZONE2tf : origin = 0x084000, length = 0x001FFF
}
SECTIONS
{
/* Allocate program areas: */
.reset : > BEGIN PAGE = 0
vectors : > VECTORS PAGE = 0
.cinit : > FLASHJ PAGE = 0
.text : > FLASHP PAGE = 0
/* Allocate data areas: */
.stack : > RAMM1 PAGE = 1
.ebss : > RAML0L1 PAGE = 1
.econst : > FLASHH PAGE = 0
.esysmem : > RAML0L1 PAGE = 1
/* Allocate IQ math areas: */
IQmath : > FLASHI PAGE = 0 /* Math Code flashi*/
IQmathFastTables : > FLASHI PAGE = 0 /* Math Tables in fast memory flashi*/
IQmathTables : > OTP PAGE = 0 /* Math Tables In ROM */
/* Allocate Peripheral Frame 0 Register Structures: */
DevEmuRegsFile : > DEV_EMU, PAGE = 1
FlashRegsFile : > FLASH_REGS, PAGE = 1
CsmRegsFile : > CSM, PAGE = 1
XintfRegsFile : > XINTF, PAGE = 1
CpuTimer0RegsFile : > CPU_TIMER0, PAGE = 1
CpuTimer1RegsFile : > CPU_TIMER1, PAGE = 1
CpuTimer2RegsFile : > CPU_TIMER2, PAGE = 1
PieCtrlRegsFile : > PIE_CTRL, PAGE = 1
PieVectTable : > PIE_VECT, PAGE = 1
/* Allocate Peripheral Frame 2 Register Structures: */
ECanaRegsFile : > ECAN_A, PAGE = 1
ECanaMboxesFile : > ECAN_AMBOX PAGE = 1
/* Allocate Peripheral Frame 1 Register Structures: */
SysCtrlRegsFile : > SYSTEM, PAGE = 1
SpiaRegsFile : > SPI_A, PAGE = 1
SciaRegsFile : > SCI_A, PAGE = 1
XIntruptRegsFile : > XINTRUPT, PAGE = 1
GpioMuxRegsFile : > GPIOMUX, PAGE = 1
GpioDataRegsFile : > GPIODAT PAGE = 1
AdcRegsFile : > ADC, PAGE = 1
EvaRegsFile : > EV_A, PAGE = 1
EvbRegsFile : > EV_B, PAGE = 1
ScibRegsFile : > SCI_B, PAGE = 1
McbspaRegsFile : > MCBSP_A, PAGE = 1
/* CSM Password Locations */
CsmPwlFile : > CSM_PWL, PAGE = 1
FFTipcb3 ALIGN(256) : {} > DRAMH0 PAGE=1
FFTipcb4 ALIGN(256) : {} > DRAMH0 PAGE=1
FFTmag : > DRAMH0 PAGE=1
FFTtf : > ZONE2tf PAGE=1
}
MEMORY
{
PAGE 0 :
OTP : origin = 0x3D7800, length = 0x000800
FLASHJ : origin = 0x3D8000, length = 0x002000
FLASHI : origin = 0x3DA000, length = 0x002000
FLASHH : origin = 0x3DC000, length = 0x006000
/*
FLASHH : origin = 0x3DC000, length = 0x004000
FLASHG : origin = 0x3E0000, length = 0x004000
*/
FLASHP : origin = 0x3E4000, length = 0x013FF6
/*
FLASHF : origin = 0x3E4000, length = 0x004000
FLASHE : origin = 0x3E8000, length = 0x004000
FLASHD : origin = 0x3EC000, length = 0x004000
FLASHC : origin = 0x3F0000, length = 0x004000
FLASHB : origin = 0x3F4000, length = 0x002000
FLASHA : origin = 0x3F6000, length = 0x001FF6 */
BEGIN : origin = 0x3F7FF6, length = 0x000002
PASSWDS : origin = 0x3F7FF8, length = 0x000008
ROM : origin = 0x3FF000, length = 0x000FC0
VECTORS : origin = 0x3FFFC2, length = 0x00003E
PAGE 1 :
/* SARAM */
RAMM0 : origin = 0x000000, length = 0x000400
RAMM1 : origin = 0x000400, length = 0x000400
/* Peripheral Frame 0: */
DEV_EMU : origin = 0x000880, length = 0x000180
FLASH_REGS : origin = 0x000A80, length = 0x000060
CSM : origin = 0x000AE0, length = 0x000010
XINTF : origin = 0x000B20, length = 0x000020
CPU_TIMER0 : origin = 0x000C00, length = 0x000008
CPU_TIMER1 : origin = 0x000C08, length = 0x000008
CPU_TIMER2 : origin = 0x000C10, length = 0x000008
PIE_CTRL : origin = 0x000CE0, length = 0x000020
PIE_VECT : origin = 0x000D00, length = 0x000100
/* Peripheral Frame 1: */
ECAN_A : origin = 0x006000, length = 0x000100
ECAN_AMBOX : origin = 0x006100, length = 0x000100
/* Peripheral Frame 2: */
SYSTEM : origin = 0x007010, length = 0x000020
SPI_A : origin = 0x007040, length = 0x000010
SCI_A : origin = 0x007050, length = 0x000010
XINTRUPT : origin = 0x007070, length = 0x000010
GPIOMUX : origin = 0x0070C0, length = 0x000020
GPIODAT : origin = 0x0070E0, length = 0x000020
ADC : origin = 0x007100, length = 0x000020
EV_A : origin = 0x007400, length = 0x000040
EV_B : origin = 0x007500, length = 0x000040
SPI_B : origin = 0x007740, length = 0x000010
SCI_B : origin = 0x007750, length = 0x000010
MCBSP_A : origin = 0x007800, length = 0x000040
/* CSM Password Locations */
CSM_PWL : origin = 0x3F7FF8, length = 0x000008
/* SARAM */
DRAMH0 : origin = 0x3f8000, length = 0x002000
RAML0L1 : origin = 0x008000, length = 0x002000
ZONE2tf : origin = 0x084000, length = 0x001FFF
}
SECTIONS
{
/* Allocate program areas: */
.reset : > BEGIN PAGE = 0
vectors : > VECTORS PAGE = 0
.cinit : > FLASHJ PAGE = 0
.text : > FLASHP PAGE = 0
/* Allocate data areas: */
.stack : > RAMM1 PAGE = 1
.ebss : > RAML0L1 PAGE = 1
.econst : > FLASHH PAGE = 0
.esysmem : > RAML0L1 PAGE = 1
/* Allocate Peripheral Frame 0 Register Structures: */
DevEmuRegsFile : > DEV_EMU, PAGE = 1
FlashRegsFile : > FLASH_REGS, PAGE = 1
CsmRegsFile : > CSM, PAGE = 1
XintfRegsFile : > XINTF, PAGE = 1
CpuTimer0RegsFile : > CPU_TIMER0, PAGE = 1
CpuTimer1RegsFile : > CPU_TIMER1, PAGE = 1
CpuTimer2RegsFile : > CPU_TIMER2, PAGE = 1
PieCtrlRegsFile : > PIE_CTRL, PAGE = 1
PieVectTable : > PIE_VECT, PAGE = 1
/* Allocate Peripheral Frame 2 Register Structures: */
ECanaRegsFile : > ECAN_A, PAGE = 1
ECanaMboxesFile : > ECAN_AMBOX PAGE = 1
/* Allocate Peripheral Frame 1 Register Structures: */
SysCtrlRegsFile : > SYSTEM, PAGE = 1
SpiaRegsFile : > SPI_A, PAGE = 1
SciaRegsFile : > SCI_A, PAGE = 1
XIntruptRegsFile : > XINTRUPT, PAGE = 1
GpioMuxRegsFile : > GPIOMUX, PAGE = 1
GpioDataRegsFile : > GPIODAT PAGE = 1
AdcRegsFile : > ADC, PAGE = 1
EvaRegsFile : > EV_A, PAGE = 1
EvbRegsFile : > EV_B, PAGE = 1
ScibRegsFile : > SCI_B, PAGE = 1
McbspaRegsFile : > MCBSP_A, PAGE = 1
/* CSM Password Locations */
CsmPwlFile : > CSM_PWL, PAGE = 1
FFTipcb3 ALIGN(256) : {} > DRAMH0 PAGE=1
FFTipcb4 ALIGN(256) : {} > DRAMH0 PAGE=1
FFTmag : > DRAMH0 PAGE=1
FFTtf : > ZONE2tf PAGE=1
}
添加的.asm文件
***********************************************************************
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref _c_int00
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.text
wd_disable:
SETC OBJMODE ;Set OBJMODE for 28x object code
EALLOW ;Enable EALLOW protected register access
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
EDIS ;Disable EALLOW protected register access
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end wd_disable
.end
; end of file CodeStartBranch.asm
;// TI File $Revision: /main/2 $
;// Checkin $Date: April 29, 2005 11:11:32 $
;//###########################################################################
;//
;// FILE: DSP281x_CodeStartBranch.asm
;//
;// TITLE: Branch for redirecting code execution after boot.
;//
;//###########################################################################
;// $TI Release: DSP281x Header Files V1.11 $
;// $Release Date: September 26, 2007 $
;//###########################################################################
***********************************************************************
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref _c_int00
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.text
wd_disable:
SETC OBJMODE ;Set OBJMODE for 28x object code
EALLOW ;Enable EALLOW protected register access
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
EDIS ;Disable EALLOW protected register access
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end wd_disable
.end
; end of file CodeStartBranch.asm
只添加了这个和修改了你所说的CMD文件
;// TI File $Revision: /main/2 $
;// Checkin $Date: April 29, 2005 11:11:32 $
;//###########################################################################
;//
;// FILE: DSP281x_CodeStartBranch.asm
;//
;// TITLE: Branch for redirecting code execution after boot.
;//
;//###########################################################################
;// $TI Release: DSP281x Header Files V1.11 $
;// $Release Date: September 26, 2007 $
;//###########################################################################
***********************************************************************
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
.ref _c_int00
***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************
.sect "codestart"
code_start:
.if WD_DISABLE == 1
LB wd_disable ;Branch to watchdog disable code
.else
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end codestart section
***********************************************************************
* Function: wd_disable
*
* Description: Disables the watchdog timer
***********************************************************************
.if WD_DISABLE == 1
.text
wd_disable:
SETC OBJMODE ;Set OBJMODE for 28x object code
EALLOW ;Enable EALLOW protected register access
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
EDIS ;Disable EALLOW protected register access
LB _c_int00 ;Branch to start of boot.asm in RTS library
.endif
;end wd_disable
.end
; end of file CodeStartBranch.asm
只加了这个文件
查内存3f7ff8到3f7fff全是0
如果芯片被锁,所有地址都会显示为0。试试这种方法: Try holding the processor in reset state (if you have a "reset" button for example) while you are connecting to it with the JTAG. After you have been connected, leave the "reset" button and program the flash as general。
是不是加了DSP281x_CSMPasswords.asm这个文件,仿真的时候view memory里都是FFFF,不加的话就全是0,哪个对
cmd文件里有把flash里的载入到ram里运行,我参照官网的例程改了,还加了DSP281x_Headers_nonBIOS.cmd这个文件
#include "DSP28_Device.h"
#pragma CODE_SECTION(ISRTimer0, "ramfuncs");
unsigned int *LedADDR = (unsigned int *) 0x2800; //8个发光二极管寄存器地址
unsigned int Count,Flag;
/////////////////对应位低电平点亮该位发光二极管
const Uint16 LedCode[9]={0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0xFE,0xFF};
interrupt void ISRTimer0(void);
void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)
{
while(SourceAddr < SourceEndAddr)
{
*DestAddr++ = *SourceAddr++;
}
return;
}
void main(void)
{
InitSysCtrl(); //初始化系统
DINT; //关中断
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl(); //初始化PIE
InitPieVectTable(); //初始化PIE中断矢量表
InitPeripherals(); //初始化外设
InitGpio();
EALLOW;
PieVectTable.TINT0 = &ISRTimer0;
EDIS;
Count = 0; //初始化变量
Flag=0;
ConfigCpuTimer(&CpuTimer0, 10, 1000000); //设置CPU
StartCpuTimer0();
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
InitFlash();
IER |= M_INT1; //开中断
PieCtrl.PIEIER1.bit.INTx7=1;
EINT; // 允许INTM
ERTM; // 允许DBGM
*LedADDR = 0x00; // 点亮全部8个LED灯
for(;;)
{ ; }
}
interrupt void ISRTimer0(void)
{
PieCtrl.PIEACK.bit.ACK7=1;
*LedADDR = LedCode[Count]; //依次点亮灯,置相应位低电平
if (Flag==0) Count++; else Count--;
if (Count>=8)//循环
{
Flag=1; }
if (Count<=0)//循环
{
Flag=0;
}
}
好了 谢谢你,如果我把整个程序都放到RAM里运行,是不是把所有的函数
#pragma CODE_SECTION(Ifunctionname, "ramfuncs");就可以了
我把自己写的函数都加载到RAM里运行没问题吧
#include "DSP28_Device.h" #include "fft.h" #include "math.h" #pragma CODE_SECTION(fft_init, "ramfuncs"); #pragma CODE_SECTION(fft_subroutine, "ramfuncs"); #pragma CODE_SECTION(Print_Str, "ramfuncs"); #pragma CODE_SECTION(Uarta_PutChar, "ramfuncs"); #pragma CODE_SECTION(send_message, "ramfuncs"); #pragma CODE_SECTION(usart_receive, "ramfuncs"); #pragma CODE_SECTION(wave_judge, "ramfuncs"); #pragma CODE_SECTION(wave_choose, "ramfuncs"); #pragma CODE_SECTION(warn_test, "ramfuncs"); #pragma CODE_SECTION(wave_send, "ramfuncs"); #pragma CODE_SECTION(ad, "ramfuncs"); #pragma CODE_SECTION(scia_receive, "ramfuncs"); #pragma CODE_SECTION(eva_timer1_isr, "ramfuncs"); #pragma CODE_SECTION(eva_timer2_isr, "ramfuncs"); #pragma CODE_SECTION(evb_timer3_isr, "ramfuncs"); #pragma CODE_SECTION(ISRTimer0, "ramfuncs");
从信息提示来看,好像要需要将某一部分数据也搬移到RAM中。如果程序不是太大的话,也可以将整个程序都搬移到RAM中,可以通过MemCopy .text段实现,具体操作方法请参考以下内容:http://www.ti.com/mcu/docs/litabsmultiplefilelist.tsp?sectionId=96&tabId=1502&literatureNumber=spraau8&docCategoryId=1&familyId=4 。
我原来在RAM里调试的时候CMD文件做了修改,添加了下面自己定义分配的段都是在RAM里,现在是把它们都放到FLASH里搬移还是和原来的一样就放在RAM里就可以
MEMORY
{
PAGE 0 :
ZONE2 : origin = 0x080000, length = 0x03ffff
PAGE 1 :
/* ..... */
DRAMH0 : origin = 0x3f9800, length = 0x000700
ZONE2ipcb : origin = 0x080000, length = 0x001FFF
ZONE2mag : origin = 0x082000, length = 0x001FFF
ZONE2tf : origin = 0x084000, length = 0x001FFF
ZONE2 : origin = 0x0C0000, length = 0x03ffff
}
SECTIONS
{
/*......*/
FFTipcb1 ALIGN(2048) : {} > ZONE2ipcb PAGE=1
FFTipcb2 ALIGN(2048) : {} > ZONE2ipcb PAGE=1
FFTipcb3 ALIGN(256) : {} > DRAMH0 PAGE=1
FFTipcb4 ALIGN(256) : {} > DRAMH0 PAGE=1
FFTmag : > DRAMH0 PAGE=1
FFTtf : > ZONE2tf PAGE=1
}
那是不是还需要要修改一些asm文件,和配置.cinit一样,它的_cinit_loadstart,_cinit_runstart,_cinit_size都在汇编文件里。
.cinit : LOAD = FLASH_AB, PAGE = 0 /* Load section to Flash */
RUN = RAM_H0, PAGE = 0 /* Run section from RAM */
LOAD_START(_cinit_loadstart),
RUN_START(_cinit_runstart),
SIZE(_cinit_size)
RAMCMD:
FFTipcb3 ALIGN(256) : {} > RAM_H0 PAGE=1
FFTipcb4 ALIGN(256) : {} > RAM_H0 PAGE=1
FFTmag : > RAM_H0 PAGE=1
FFTipcb3 ALIGN(256) : {} LOAD = FLASH_AB, PAGE = 0 /* Load section to Flash */
RUN = RAM_H0, PAGE = 0 /* Run section from RAM */
LOAD_START(_fftipcb3_loadstart),
RUN_START(_ftipcb3_runstart),
SIZE(_ftipcb3_size)
FFTipcb4 ALIGN(256) : {} LOAD = FLASH_AB, PAGE = 0 /* Load section to Flash */
RUN = RAM_H0, PAGE = 0 /* Run section from RAM */
LOAD_START(_fftipcb4_loadstart),
RUN_START(_ftipcb4_runstart),
SIZE(_ftipcb4_size)
FFTmag : LOAD = FLASH_AB, PAGE = 0 /* Load section to Flash */
RUN = RAM_H0, PAGE = 0 /* Run section from RAM */
LOAD_START(_fftmag_loadstart),
RUN_START(_fftmag_runstart),
SIZE(_fftmag_size)
DSP28xxx_SectionCopy_nonBIOS.asm里添加
.global _fftipcb3_loadstart, _fftipcb3runstart, _pfftipcb3_size
.global _sfftipcb4loadstart, _fftipcb4_runstart, _fftipcb4_size
.global _fftmag_loadstart, _fftmag_runstart, _fftmag_size
是这么改的吗?
MOVL XAR5,#_fftipcb3_size ; Store Section Size in XAR5
MOVL ACC,@XAR5 ; Move Section Size to ACC
MOVL XAR6,#_fftipcb3_loadstart ; Store Load Starting Address in XAR6
MOVL XAR7,#_fftipcb3_runstart ; Store Run Address in XAR7
LCR copy
把FFT的相关部分全部去掉,CMD和程序里用到的
fft.ipcbptr = ipcb;
fft.magptr = mag;
fft.init(&fft);
RFFT32_brev(ipcb,ipcb,N);
fft.calc(&fft);
fft.split(&fft);
fft.mag(&fft);都去掉
其他的都可以正常运行
我直接使用的F281x_nonBIOS_flash.cmd没改动,编译不过去,我不明白,不给FFT分配空间,FFT就不能使用啊,我使用的是官网的FFT库
>> warning: creating output section FFTtf without SECTIONS specification