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.

DSP 28335 在外部RAM中运行不正常问题



你好,

我现在想让我的代码全部在外部ram中运行,外部的ram使用的Zone7,CMD文件划分如下:

MEMORY
{
PAGE 0 :
   /* BEGIN is used for the "boot to SARAM" bootloader mode      */

   BEGIN      : origin = 0x200000, length = 0x000002     /* Boot to M0 will go here                      */
   RAMM0      : origin = 0x000050, length = 0x0003B0
   RAML0      : origin = 0x008000, length = 0x001000
   RAML1      : origin = 0x009000, length = 0x001000
   RAML2      : origin = 0x00A000, length = 0x001000
   RAML3      : origin = 0x00B000, length = 0x001000
   ZONE7A     : origin = 0x200002, length = 0x018000    /* XINTF zone 7 - program space */
   CSM_RSVD   : origin = 0x33FF80, length = 0x000076     /* Part of FLASHA.  Program with all 0x0000 when CSM is in use. */
   CSM_PWL    : origin = 0x33FFF8, length = 0x000008     /* Part of FLASHA.  CSM password locations in FLASHA            */
   ADC_CAL    : origin = 0x380080, length = 0x000009
   RESET      : origin = 0x3FFFC0, length = 0x000002
   IQTABLES   : origin = 0x3FE000, length = 0x000b50
   IQTABLES2  : origin = 0x3FEB50, length = 0x00008c
   FPUTABLES  : origin = 0x3FEBDC, length = 0x0006A0
   BOOTROM    : origin = 0x3FF27C, length = 0x000D44


PAGE 1 :


   BOOT_RSVD  : origin = 0x000002, length = 0x00004E     /* Part of M0, BOOT rom will use this for stack */
   RAMM1      : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
   RAML4      : origin = 0x00C000, length = 0x001000
   RAML5      : origin = 0x00D000, length = 0x001000
   RAML6      : origin = 0x00E000, length = 0x001000
   RAML7      : origin = 0x00F000, length = 0x001000
   ZONE7B     : origin = 0x218002, length = 0x007FFE     /* XINTF zone 7 - data space */
}


SECTIONS
{
   /* Setup for "boot to SARAM" mode:
      The codestart section (found in DSP28_CodeStartBranch.asm)
      re-directs execution to the start of user code.  */
   codestart        : > BEGIN,     PAGE = 0
   ramfuncs         : > ZONE7A,     PAGE = 0   
   .text            : > ZONE7A,     PAGE = 0
   .cinit           : > ZONE7A,     PAGE = 0
   .pinit           : > ZONE7A,     PAGE = 0
   .switch          : > ZONE7A,     PAGE = 0

   .stack           : > ZONE7B,     PAGE = 1
   .ebss            : > ZONE7B,     PAGE = 1
   .econst          : > ZONE7B,     PAGE = 1
   .esysmem         : > ZONE7B,     PAGE = 1

   IQmath           : > ZONE7A,     PAGE = 0
   IQmathTables     : > IQTABLES,  PAGE = 0, TYPE = NOLOAD

 

   FPUmathTables    : > FPUTABLES, PAGE = 0, TYPE = NOLOAD

   DMARAML4         : > ZONE7B,     PAGE = 1
   DMARAML5         : > ZONE7B,     PAGE = 1
   DMARAML6         : > ZONE7B,     PAGE = 1
   DMARAML7         : > ZONE7B,     PAGE = 1

   ZONE7DATA        : > ZONE7B,    PAGE = 1

   .reset           : > RESET,     PAGE = 0, TYPE = DSECT /* not used                    */
   csm_rsvd         : > CSM_RSVD   PAGE = 0, TYPE = DSECT /* not used for SARAM examples */
   csmpasswds       : > CSM_PWL    PAGE = 0, TYPE = DSECT /* not used for SARAM examples */

   /* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
   .adc_cal     : load = ADC_CAL,   PAGE = 0, TYPE = NOLOAD

}

在外部sram中仿真,测试下面程序 运行正常

void SendData(void)
{
	int i =0;
	
	unsigned char str1[3] ={0xaa,0xbb,0xcc};
	
	for(i=0; i<3; i++)
	{
		SendBSC0(str1[i]);
	}
	
	SendBSC0(0xdd);
	SendBSC0(0xee);
	SendBSC0(0xff);
}

串口助手能够正常输出 aa,bb,cc,dd,ee,ff.

但是,在正常使用过程中,通过自己编写的引导程序将代码搬移到外部sram中,然后跳转到程序运行,串口助手输出就不正常了,输出 08 20 a0 dd ee ff。

好像在外部sram中运行SendBSC0(str1[i]);会有问题,str'1[i]中的值并不是数组中的值。

求大神帮忙看一下,谢谢。