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.

CCS V5.4 simulator 复位地址疑问

Other Parts Discussed in Thread: CCSTUDIO

按照理解,simulator的时候,复位 应该从L2RAM 的 0x00800000 地址开始执行。

但是,

测试程序,调试的时候,

0x00800000 地址开始分配给了 stack。_c_int00 在0x801660开始,程序从此开始运行。

疑问:

1、复位的时候,PC是如何指向 0x801660的?

2、程序做调整,这个_c_int00会有所变化,但是复位都是从_c_int00开始。

信息:

.stack 0 00800000 00001200 UNINITIALIZED
00800000 00000008 rts64plus.lib : boot.obj (.stack)
00800008 000011f8 --HOLE--

00801200 00000140 main.obj (.text)
00801340 000000c0 rts64plus.lib : autoinit.obj (.text:__auto_init)
00801400 000000c0 : exit.obj (.text:_exit)
008014c0 000000a0 : cpy_tbl.obj (.text:_copy_in)
00801560 000000a0 : memcpy64.obj (.text:_memcpy)
00801600 00000060 : cpp_init.obj (.text:___TI_cpp_init)
00801660 00000060 : boot.obj (.text:_c_int00)
008016c0 00000040 : args_main.obj (.text:__args_main)
00801700 00000020 : exit.obj (.text:_abort)

  • 纠结这个没什么必要。

    这种复位是CCS的操作,不是硬件的复位。  就好比从CCS下载程序后,自动从_c_int00开始运行是一个道理。 

  • 这是自动加载的。如果你在debugger选项里设置go to main,就会自动跳到main函数。

  • @Shine Zhang
    @Tony Tang

    谢谢 热情解释和答复!

    DSP程序复位后入口程序:c_int00  初始化SP,DP等
    用户应用入口程序:main

    CCS V5.4 在 Run - Deubug Configurations - Target - Auto Run Options - Run to symbol
    里,可以填写 一个程序名称,默认是 main(),你甚至可以改为你的的一个任意子程序。
    然后,你点 Debug 界面下的 Restart,调试界面就运行到 你制定的 程序停下来。
    在 c_int00 和 你制定的程序之间如果有你打的 断点,则会在断点处停止。

    疑问:
    1、这种复位是CCS的操作,不是硬件的复位。
    也就是说在CCS下,simulator的时候,
    PC初始指针不是硬件复位的芯片起始地址。
    而是由CCS环境直接设置为 c_int00 的地址?

    2、当生成烧入到FLASH的程序的时候,
    是不是应该把 c_int00链接在 芯片复位地址处?
    (C6455 EMIFA 8-bit ROM boot 在 0xB000 0000,共计8M空间)
    这个过程,是在 哪个环节完成?
    是在 LINK环节?还是在把obj文件转换为 hex文件的环节?

    如果是在Link环节,simulator的时候,为何不是预期的?还是说,需要通过 Options 来设置?

    3、另外一个问题,C6455的 L2RAM 是2M,如果程序编译后,数据空间和程序空间的总和大于2M,
    CCS 会怎么支持simulator?

  • 首先感谢各位大佬!

    1、关于 simulator 的复位地址问题,答案已经明确,也找到了出处。

         文件《spruec6g-C645xC647x Bootloader User's Guide》- 3.3.1 No Boot Mode

    No-boot mode is usually selected when the user wants to download the application using an emulator
    in conjunction with Code Composer Studio (CCStudio). In this usage case, when CCStudio connects to
    the DSP, it brings the DSP out of the sleep state and PC execution is halted. CCStudio downloads the
    application image in DSP memory and the start address for execution is set to the application entry
    point (CCStudio uses the default entry point _c_int00). Application code execution starts when the user
    invokes the CCStudio Run command.

    造成原来疑惑的来源:

    文件《tms320c6455-Fixed-Point Digital Signal Processor》 - 2.4.1 Boot Modes Supported

    No boot (BOOTMODE[3:0] = 0000b)
    With no boot, the CPU executes directly from the internal L2 SRAM located at address 0x80 0000.
    Note: device operations is undefined if invalid code is located at address 0x80 0000. This boot mode is
    a hardware boot mode.

    地址0x80 0000 是修饰L2 SRAM的,确实没有说是从这个地址开始执行。应该是自己按照历史经验误解。

    不过,误解也是情有可原,确实也有的方式是从 0x80 0000开始的。参考信息如下:

    文件《spruec6g-C645xC647x Bootloader User's Guide》- 3.3.1 No Boot Mode

    The other usage option is a host that downloads the application to L2 (using an emulation protocol like
    RTDX) and provides an NMI to the DSP so that the application execution can start. The entry point to
    the application is always the L2 base. The application must be linked so that the entry point for the
    application is the L2 base (_cint_00 should be mapped to 0x0080000).

    另外,

    文件《spruec6g-C645xC647x Bootloader User's Guide》- 3.3.4 HPI Boot Mode

    Direct HPI bootloading mode involves the host making direct write accesses to DSP memory. The DSP
    de-asserts the HINT line to indicate that it is ready and then enters the sleep state. The host then
    starts to make direct writes of the application code and data sections to DSP memory. The host can
    also modify the default entry point of the application (default entry point is 0x800000) by writing to the
    boot exit address in scratch memory (for details, see Table 10). When the host is finished writing the
    application to DSP memory, it asserts the DSPINT event. This brings the DSP out of the sleep state
    and starts execution at the address specified in the boot exit address. Since the HPI can only make
    32-bit aligned accesses, the application data and code sections need to be 32-bit aligned.

    总结下来,把代码复制到 内部L2SRAM 后运行的时候,默认入口地址确实是0x80 0000,

    但是在装载用户程序过程中,可以通过约定方式修改 这个入口地址(修改为 c_int00 的链接后的地址)。

    尤其非常明确了,CCStudio uses the default entry point _c_int00。