TI中文支持网
TI专业的中文技术问题搜集分享网站

28355 在外部SRAM中运行程序问题

你好,

我现在想让我的代码全部在外部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 = 0x0003B0RAML0: origin = 0x008000, length = 0x001000RAML1: origin = 0x009000, length = 0x001000RAML2: origin = 0x00A000, length = 0x001000RAML3: origin = 0x00B000, length = 0x001000ZONE7A: 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 = 0x000009RESET: origin = 0x3FFFC0, length = 0x000002IQTABLES: origin = 0x3FE000, length = 0x000b50IQTABLES2  : origin = 0x3FEB50, length = 0x00008cFPUTABLES  : origin = 0x3FEBDC, length = 0x0006A0BOOTROM: 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 = 0x001000RAML5: origin = 0x00D000, length = 0x001000RAML6: origin = 0x00E000, length = 0x001000RAML7: origin = 0x00F000, length = 0x001000ZONE7B: 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 = 0ramfuncs: > 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 = 1IQmath: > ZONE7A,PAGE = 0IQmathTables: > IQTABLES,  PAGE = 0, TYPE = NOLOADFPUmathTables: > FPUTABLES, PAGE = 0, TYPE = NOLOADDMARAML4: > ZONE7B,PAGE = 1DMARAML5: > ZONE7B,PAGE = 1DMARAML6: > ZONE7B,PAGE = 1DMARAML7: > ZONE7B,PAGE = 1ZONE7DATA: > ZONE7B,PAGE = 1.reset: > RESET,PAGE = 0, TYPE = DSECT /* not used*/csm_rsvd: > CSM_RSVDPAGE = 0, TYPE = DSECT /* not used for SARAM examples */csmpasswds: > CSM_PWLPAGE = 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仿真运行,下面的 程序,能够正常运行。通过串口能够输出 aa,bb,cc,dd,ee,ff.。

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);
}

但是,我实际使用时,通过一个自己写的boot程序,讲上边仿真时生成的hex文件,搬移到外部sram中,然后跳转到0x200000去执行程序,发现程序运行部正常

,串口输出结果为08 20 a0 dd ee ff。

实验了多次,问题出现在

SendBSC0(str1[i]);

代码上,好像在外部sram中运行时 获取str1数组中的数据有问题。为什么会出现这种现象?

麻烦大神帮忙看下,万分感谢!!!

Susan Yang:

请问您现在的boot模式是什么?和SRAM通信使用的是XINTF?

若是将

SendBSC0(str1[i]);

改为类似SendBSC0(0xdd); 这种方式的话,是否可以成功输出?

有一些分享,您可以先看一下:

blog.csdn.net/…/78320741

,

Jent:

boot模式还是从flash启动,流程如下,从flash中启动自己写的引导程序,通过自己写的引导程序将存储的应用程序搬移到外部sram,然后跳转到外部sram执行。将其改为SendBSC0(0xdd)是可以正常运行的。能够输出0x dd。

和外部sram运行使用的是xintf

,

Susan Yang:

谢谢您的反馈,建议您反汇编看一下 SendData 在执行时是否都是正常的。若是可以的话,也可以将反汇编截图一下,我们具体看一下,谢谢

,

Jent:

我好像找到原因了,之前的代码编译时会提示waring :Data is being written to auto-generated file Dsp28335-app. i10。因此,推断我生成的hex文件,有问题。然后我将cmd文件修改了一下。
ZONE7A :origin=0x200002,length=0x9FF0
FLASHA :origin=0x209FF2,length=0x8000
然后在section中将text cinit pinit econst switch段放到 FLASHA. 再次进行编写就不会提示waring。将生成的hex文件搬移到外部sram中运行就正常了。
现在的问题是waring :Data is being written to auto-generated file Dsp28335-app. i10是什么意思?他是如何引起的?
为什么生成hex文件中必须要有FLASH区域(该区域实际我给他放到了外部sram中0x209FF2-0x211FF1)并将程序存储在FLASH区域中,才能生成正常的hex文件?

赞(0)
未经允许不得转载:TI中文支持网 » 28355 在外部SRAM中运行程序问题
分享到: 更多 (0)