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.

修改F28035的cmd文件后关于启动过程的问题

Other Parts Discussed in Thread: C2000WARE

最近在做IAP,然后应用程序要更改cmd不是么。

然后我就从新分配了一下flash, 8个扇区主要分成2部分。一个给Boot程序,一个给用户程序。

boot程序 Begin起始地址仍然是 0x3F7FF6 ,长度为2  。这是默认的。

BEGIN        : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */

用户程序Begin起始地址为0x3E8000,长度为2。自己更改的

BEGIN       : origin = 0x3E8000, length = 0x000002

然后紧接着就是应用程序的flash地址和长度分配:

FLASH_App    : origin = 0x3E8002, length = 0x009FFE

我之所以觉得有问题是:单独讲应用程序下载到开发板,居然能正常运行。

我一直理解的F28035的启动过程是这样的,上电后/复位后,PC指针指向复位向量-->复位向量里指向InitBoot,然后判断启动方式-->codestart(0x3F7FF6)-->_c_int00初始化运行环境-->跳到main()。 意思就是codestart(0x3F7FF6)地址处包含了一个跳转指令。

但是我的用户程序改了cmd的code为0x3E8000,这是我自己分配的2个指针位的flash,不可能有跳转指令,也就不可能跳转到_c_int00,最后也执行不到main,结果却是我 main里的led按照我做的那样点亮了。

  • 你是在线调试的吧 是不是在RAM中运行的
    上电后芯片固化代码会去获得BOOT模式 然后进行存储程序的入口处执行程序
  • 可以参考:\C2000Ware_X_XX_XX_XX\device_support\f2803x\common\source\DSP2803x_CodeStartBranch.asm

    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

    在code_start中的_c_int00发生跳转