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.

Flash里的程序如何执行?



C6205通过EMIF接口CE1外接Flash,那Flash里的程序是如何执行的?是DSP通过EMIF不断从Flash里读取数据吗?读取的速度是怎么控制的?

  • NOR FLASH支持片上执行,读取速度是有芯片内部固件决定的

  • 我现在用的是nor flash,发现EMIF接口有信号,片选信号每次使能(拉低)时间大约16us,禁能(拉高)时间很短,说明DSP和FLASH有通信吧?这个通信速度是DSP内部固件决定的?

    现在的现象是:一样的程序,烧写在FLASH运行速度和直接在线仿真速度相差很多,比在线慢很多,这大概是什么原因呢?

  • Yujing Wang 说:
    C6205通过EMIF接口CE1外接Flash,那Flash里的程序是如何执行的?是DSP通过EMIF不断从Flash里读取数据吗?读取的速度是怎么控制的?

    C6205是一款很老的DSP,还不支持XIP,NOR flash boot即文档spru642里描述的ROM boot process,不是从flash运行,而是从flash copy到address 0再运行。

    4 Boot Processes
    The boot process is determined by the boot configuration selected, as described
    in section 5. Up to three types of boot processes are available:
    No boot process: The CPU begins direct execution from the memory
    located at address 0. If SDRAM is used in the system, the CPU is held until
    SDRAM initialization is complete. Operation is undefined if invalid code is
    located at address 0.
    ROM boot process: The program located in external ROM is copied to
    address 0 by the DMA controller. Although the boot process begins when
    the device is released from external reset, this transfer occurs while the
    CPU is internally stalled. For the C620x/C670x DSP, these values are
    expected to be stored in little-endian format in the external memory,
    typically a ROM device.
    The transfer is automatically done by the DMA controller as a single-frame
    block transfer from the ROM to address 0. The DMA copies 64K bytes
    from CE1 to address 0, using default ROM timings. After completion of the
    block transfer, the CPU is unstalled and allowed to run from address 0.
    Host boot process: The CPU is internally stalled while the remainder of
    the device is released. During this period, an external host can initialize
    the CPU memory space as necessary through the host interface, including
    internal configuration registers, such as those that control the EMIF or
    other peripherals. Once the host is finished with all necessary initialization,
    it must set the DSPINT to complete the boot process. This transition
    causes the boot configuration logic to unstall the CPU. The CPU then
    begins execution from address 0. The DSPINT condition is not latched by
    the CPU, because it occurs while the CPU is stalled. Also, DSPINT
    unstalls the CPU only if the host boot process is selected. All memory may
    be written to and read by the host. This allows for the host to verify what
    it sends to the processor, if required. After the CPU is unstalled, the CPU
    needs to clear the DSPINT bit; otherwise, no more DSPINTs can be received.

    关于boot的配置,见文档的5.4节。

    5.4 C6205 DSP Boot and Device Configuration

  • Yujing Wang 说:
    我现在用的是nor flash,发现EMIF接口有信号,片选信号每次使能(拉低)时间大约16us,禁能(拉高)时间很短,说明DSP和FLASH有通信吧?这个通信速度是DSP内部固件决定的?

    这是芯片的bootloader通过DMA在从flash搬代码到adress 0. DMA访问是连续的,所以你看到CS拉低很长时间。这是DSP内部固件决定的。

    Yujing Wang 说:
    现在的现象是:一样的程序,烧写在FLASH运行速度和直接在线仿真速度相差很多,比在线慢很多,这大概是什么原因呢?

    这个你是怎么判断的?同样的代码速度有区别,那就看一下PLL的配置是不是一样了。还是参考spru642的5.4节.

  • 我的代码是点LED的,两种方式下LED闪烁的频率不同,用示波器查看高低电平持续的时间差很多

    PLL就是硬件配置的,就是PLLCONF[0:2],程序里没有

    DMA会一直搬代码吗?还是搬固定大小的代码就不搬了?现在是一直有信号

  • 我又看了一下绿色部分,是搬64K就不搬了是吧?现在是一直有信号啊

    还有如果程序超过64K怎么办呢?

    还有那个XIP是什么意思啊?

  • Yujing Wang 说:
    还有如果程序超过64K怎么办呢?

    超过则需要采用二级boot方式,由二级boot代码配置好片外内存接口时序参数,再把应用代码搬过去,跳转到应用代码的入口地址。

    XIP: execute in peripheral, 即直接在外设上运行,也就并行nor flash支持这种方式,当然前提是ROM bootloader要支持。C6205 ROM bootloader不支持。

  • Yujing Wang 说:
    DMA会一直搬代码吗?还是搬固定大小的代码就不搬了?现在是一直有信号

    固定64Kbyte,且只搬这一次,这64K应该不是一个CS低就能完成的,中间应该有分割。

    你说的一直是多久,代码跑起来后CE1还是低吗?不可能吧。

    Yujing Wang 说:
    我的代码是点LED的,两种方式下LED闪烁的频率不同,用示波器查看高低电平持续的时间差很多

    只听说仿真器可能比boot跑起来慢,而你的情况是反的,这~~~确定是同一个程序吗?

  • 二级boot也是搬64K吗?还是二级boot就没有限制了呢?

  • 一直是LED已经闪烁了,我随时测还是有拉低。或者我是什么地方配置错了导致的?

    是一个程序,我刚又比较了一下代码

  • Yujing Wang 说:
    二级boot也是搬64K吗?还是二级boot就没有限制了呢?

    所谓的二级boot是你用户代码,由用户决定,芯片对C6205的二级boot的唯一要求是小于64Kbyte

  • 如果我的代码是64K的很多倍,而C6205也不支持XIP,那我的程序想跑起来要怎么办呢?

  • Yujing Wang 说:
    我随时测还是有拉低。

    是有拉低,还是一直拉低?如果是一直拉低,那么肯定是硬件短路了,没有什么访问能把CE能一直拉低的。

    如果是有时拉低,检查一下代码里是不是把这个CE配置成SDRAM了,SDRAM使能后会有刷新周期,刷新周期里CE是会拉低的。

  • Yujing Wang 说:
    如果我的代码是64K的很多倍,而C6205也不支持XIP,那我的程序想跑起来要怎么办呢?

    看看这个文档:

    http://www.ti.com/dsp/docs/litabsmultiplefilelist.tsp?sectionId=3&tabId=409&literatureNumber=spra999a&docCategoryId=1&familyId=114&keyMatch=how%20to%20create%20a%20second%20bootloader&tisearch=Search-EN-Everything

    通道支持XIP的话,你就让代码一直在NOR flash里慢慢跑吗?nor flash很慢的,所以二级boot是很必要的。

    你做什么东西,非得要用C6205这么老的芯片?

  • 是比较有规律的周期拉低拉高,每次拉低的时间比拉高的长很多,我再看看代码

  • 我现在没看到在nor flash跑的速度,所以不太清楚这一点

    二级boot能解决就好

    我需要32位EMIF和PCIE,价格最好低点,选来选去最后还是选的6205...

  • 二级boot能解决就好

    我需要32位EMIF和PCIE,价格最好低点,就选了6205

    初次接触DSP,基础知识很欠缺。。。

  • 没有配置成SDRAM,配置的异步的,但是CE1还是有拉低

    还可能有哪方面原因呢?

    我查看了FLASH里的数据,确实与生成的.hex文件是一致的,但是执行起来闪烁速度就是比在线慢很多