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.

F280049中代码无法运行的问题

Other Parts Discussed in Thread: C2000WARE

专家,您好:

我最近在往我的工程中加入一些代码,发现加入后代码无法运行(我在main初始化IO口,加入IO翻转测试波形)。

我做了一下实验:

1.在定义2个变量,且赋初值之后,代码无法运行,看不到IIO口翻转。此时的map文件见附件error.map

例如

int32 test=0;

int32 tes1t=0;

2.在定义了2个变量,但是没有赋初值之后,代码都是可以正常运行的。

例如

int32 test;

int32 tes1t;

能否提点建议,问题可能出在哪里?

/* ----------------------------------------------------------------------------

参考Datasheet page164 "6.3.1 C28x Memory Map"

CLA可访问的RAM:
LS0~LS7: 2KW*8 = 16KW

MSG RAM: 128W*2 = 256W

仅CPU可访问的RAM:
M0~M1: 1KW*2 = 2KW
GS0~GS3: 8KW*4 = 32KW

Flash:
Bank0 4KW*16 = 64KW
Bank1 4KW*16 = 64KW
---------------------------------------------------------------------------- */

/* ============================================================================
本cmd文件memory分配:
CPU_STACK M0~M1 1KW*2 = 2KW
CPU_DATA_RAM GS0~2 8KW*3 = 24KW
CPU_PROG_RAM GS3 8KW

CLA_PROG_RAM LS0~3 2KW*4 = 8KW
CLA_DATA_RAM LS4~7 2KW*4 = 8KW

BOOTLOADER_FLASH BANK0 SECTOR0~1 4KW*2 = 8KW
EEPROM BANK0 SECTOR2~3 4KW*2 = 8KW
APP_PROG_FLASH BANK0 SECTOR4~15 4KW*12 = 48KW
============================================================================ */

_Cla1Prog_Start = _Cla1funcsRunStart;
//-heap 0x200
//-stack 0x200

// Define a size for the CLA scratchpad area that will be used
// by the CLA compiler for local symbols and temps
// Also force references to the special symbols that mark the
// scratchpad are.
CLA_SCRATCHPAD_SIZE = 256;
//--undef_sym=__cla_scratchpad_end
//--undef_sym=__cla_scratchpad_start


MEMORY
{
PAGE 0 :
CLA_PROG_RAM : origin = 0x008000, length = 0x002000 // LS0~3: 8KW
CPU_PROG_RAM : origin = 0x012000, length = 0x002000 // GS3: 8KW

/* BEGIN is used for the "boot to Flash" bootloader mode */
BEGIN : origin = 0x080000, length = 0x000002
BOOTLOADER_FLASH : origin = 0x080002, length = 0x001FFD // BANK0 SECTOR0~1
BOOTLOADER_VER : origin = 0x081FFF, length = 0x000001
DATA_FLASH : origin = 0x082000, length = 0x002000
APP_BEGIN : origin = 0x084000, length = 0x000002
// APP_PROG_FLASH : origin = 0x084002, length = 0x00BFB5
APP_PROG_FLASH : origin = 0x084002, length = 0x007000
CINIT_FLASH : origin = 0x08B002, length = 0x001900
INIT_FLASH : origin = 0x08C902, length = 0x0036B5
APP_CRC16 : origin = 0x08FFB7, length = 0x000001
// INIT_FLASH : origin = 0x08C902, length = 0x003000
// APP_CRC16 : origin = 0x08F902, length = 0x000001

RESET : origin = 0x3FFFC0, length = 0x00002

PAGE 1 :
BOOT_RSVD : origin = 0x000002, length = 0x0000F3 // Part of M0, BOOT rom will use this for stack
CPU_STACK : origin = 0x0000F5, length = 0x00070B // M0~M1 0x70b W
CLA_DATA_RAM : origin = 0x00A000, length = 0x002000 // LS4~7: 8KW
CPU_DATA_RAM : origin = 0x00C000, length = 0x002000 // GS0~2 24KW


CLA1_MSGRAMLOW : origin = 0x001480, length = 0x000080
CLA1_MSGRAMHIGH : origin = 0x001500, length = 0x000080
}


SECTIONS
{
// CLA Sections
Cla1Prog : LOAD = APP_PROG_FLASH,
RUN = CLA_PROG_RAM,
LOAD_START(_Cla1funcsLoadStart),
LOAD_END (_Cla1funcsLoadEnd),
RUN_START (_Cla1funcsRunStart),
LOAD_SIZE (_Cla1funcsLoadSize),
PAGE = 0

CLA1mathTables : > CLA_DATA_RAM,
LOAD_START(_Cla1mathTablesLoadStart),
LOAD_END(_Cla1mathTablesLoadEnd),
LOAD_SIZE(_Cla1mathTablesLoadSize),
RUN_START(_Cla1mathTablesRunStart),
PAGE = 1


ClaDataRam : > CLA_DATA_RAM, PAGE = 1
ClaToCpuMsgRam : > CLA1_MSGRAMLOW, PAGE = 1
CpuToClaMsgRam : > CLA1_MSGRAMHIGH, PAGE = 1

CLAscratch :{ *.obj(CLAscratch)
. += CLA_SCRATCHPAD_SIZE;
*.obj(CLAscratch_end) } > CLA_DATA_RAM,
PAGE = 1

.scratchpad : > CLA_DATA_RAM, PAGE = 1

.bss_cla : > CLA_DATA_RAM, PAGE = 1
.const_cla : > CLA_DATA_RAM, PAGE = 1


// CPU sections:
codestart : > BEGIN, PAGE = 0, ALIGN(4)
bootloader_ver : > BOOTLOADER_VER, PAGE = 0, ALIGN(1)
data_flash : > DATA_FLASH, PAGE = 0, ALIGN(4)
app_codestart : > APP_BEGIN, PAGE = 0, ALIGN(4)
.text : > APP_PROG_FLASH, PAGE = 0, ALIGN(4)
// .cinit : > APP_PROG_FLASH, PAGE = 0, ALIGN(4)
// .pinit : > APP_PROG_FLASH, PAGE = 0, ALIGN(4)
// .switch : > APP_PROG_FLASH, PAGE = 0, ALIGN(4)

.cinit : > CINIT_FLASH, PAGE = 0//, ALIGN(4)
.pinit : > INIT_FLASH, PAGE = 0//, ALIGN(4)
.switch : > INIT_FLASH, PAGE = 0//, ALIGN(4)

.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */

.stack : > CPU_STACK, PAGE = 1
.ebss : > CPU_DATA_RAM, PAGE = 1
.esysmem : > CPU_DATA_RAM, PAGE = 1
.econst : > APP_PROG_FLASH, PAGE = 0, ALIGN(4)

//ramgs0 : > RAMGS0, PAGE = 1
//ramgs1 : > RAMGS1, PAGE = 1

ramfuncs : LOAD = APP_PROG_FLASH,
RUN = CPU_PROG_RAM,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0, ALIGN(4)

#ifdef __TI_COMPILER_VERSION
#if __TI_COMPILER_VERSION >= 15009000
.TI.ramfunc : {} LOAD = APP_PROG_FLASH,
RUN = CPU_PROG_RAM,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0, ALIGN(4)
#endif
#endif
}

/*
//===========================================================================
// End of file.
//===========================================================================
*/

谢谢了!已经困惑好多天了

  • 顶,不能沉啊。

    再不给点建议,就要疯了

  • 把你的main文件传上来看看吧。或是把整个工程传上来。

    全局变量定义,就是多了一步上电引导时把这个初始值搬运到这个变量的RAM而已。

    你用CCS reset , restart是否可以运行?

    ERIC

  • 专家,您好:

    我的问题需要重新描述一下:

    1.我在正常的代码上加入了两个赋初值的变量后,仿真器连着在线调试,IO口的波是能发出来的,但是拔掉仿真器,单板上电IO口是出不了波的。此时map是error.map文件

    2.若我在正常的代码上加入了两个未赋初值的变量后,不管仿真器连着在线调试还是拔掉仿真器,单板上电,IO口的波都是能发出来的。此时map是del0.map文件

  • 看map文件没什么用。

    你程序里面有没有加code start代码。有memcpy函数吗?

    ERIC

  • 您好:

     1.    mem_copy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

    2. codestart代码:

    .ref _c_int00
    .global code_start


    .sect "codestart"

    code_start:
    LB _c_int00 ;Branch to start of boot._asm in RTS library


    .end

    cmd文件中:

    codestart        : > BEGIN,   PAGE = 0, ALIGN(4)

    BEGIN : origin = 0x080000, length = 0x000002

    另外,工程或者main不是不传,是因为工程包含文件比较多,没办法传。

    请见谅!

  • 你的code start看着也不像标准的。没有关掉看门狗的设置。

    .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

    我建议你用TI 官网的例程先对比测试一下,像没有跑进main函数的情况,要么code start 出问题,要么是flash 配置出问题,还有就是boot mode配置。

    C:\ti\c2000\C2000Ware_1_00_00_00\device_support\f28004x\examples\timer

    你用这个例程来对比,右键工程,设置 build configuration > set active > flash.

    Eric

  • 您好:

    CCS中选择FLASH的选项,我这边没有。。

  • 您好:

    按照示例的codestart,也没有用。。

    如何是好?

  • 您好:

    我试验过,

    如果我启动代码的时候直接跳转main,而不是跳转至_c_int00,是可以进main函数,IO口是能出波的。

    这个是不是说明_c_int_00里面出问题了,执行不到main()?

    谢谢

  • 顶一下~~遇到同样问题~~~希望大侠帮忙给点意见~~