你好,
我现在想让我的代码全部在外部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仿真运行,下面的 程序,能够正常运行。通过串口能够输出 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数组中的数据有问题。为什么会出现这种现象?
麻烦大神帮忙看下,万分感谢!!!