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.

[参考译文] AM6442:无法从 TCM 存储器运行代码

Guru**** 2553450 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1290246/am6442-failed-to-run-code-from-tcm-memory

器件型号:AM6442

您好、Champs:

SW:C:\ti\mcu_plus_sdk_am64x_09_00_00_31\examples\drivers\udma\udma_memcpy_polling

客户希望 从 TCM 存储器中运行 udma_memcpy_polling 示例、因此修改了.cmd 文件、将.bss 段从 MSRAM 更改为 R5F_TCMB0 或 R5F_TCMA 。 但代码无法成功运行。

日志:

断言:0.8870:../uDMA_memcpy_Polling.c:uDMA_memcpy_Polling_main:112:CSL_UDMAP_TR_RESPONSE _STATUS_COMPLETE = trRespStatus 失败!!





谢谢
此致
闪耀

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你好,Shin-san

    当我在`linker.cmd`文件中进行同样的更改时、构建可能不成功、这是因为分配给 R5F_TCMB0的段太大、无法容纳在32KB TCMB 中。 构建错误显示如下

    Scrubing: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling ...
    Generating SysConfig files ...
    Running script...
    Validating...
    info: /kernel/dpl/debug_log uartLog.baudRate: Actual Baudrate Possible: 115385 (0 % error)
    Generating Code (example.syscfg)...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_dpl_config.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_dpl_config.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_drivers_config.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_drivers_config.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_drivers_open_close.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_drivers_open_close.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_pinmux_config.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_power_clock_config.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_board_config.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_board_config.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_board_open_close.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_board_open_close.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_enet_config.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_enet_config.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_enet_open_close.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_enet_open_close.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_enet_soc.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_enet_lwipif.c...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_enet_lwipif.h...
    Writing /home/p-shivhare/ti/mcu_plus_sdk/am64x/examples/drivers/udma/udma_memcpy_polling/am64x-evm/r5fss0-0_nortos/ti-arm-clang/generated/ti_pru_io_config.inc...
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: ../../../udma_memcpy_polling.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: ../main.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: generated/ti_drivers_config.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: generated/ti_drivers_open_close.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: generated/ti_board_config.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: generated/ti_board_open_close.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: generated/ti_dpl_config.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: generated/ti_pinmux_config.c
    Compiling: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out: generated/ti_power_clock_config.c
    .
    Linking: am64x:r5fss0-0:nortos:ti-arm-clang udma_memcpy_polling.debug.out ...
    "linker.cmd", line 64: error: program will not fit into available memory, or
       the section contains a call site that requires a trampoline that can't be
       generated for this section. run placement with alignment fails for section
       "GROUP_4" size 0xab3d.  Available memory ranges:
       R5F_TCMB0    size: 0x8000       unused: 0x8000       max hole: 0x8000
    error: errors encountered during linking; "udma_memcpy_polling.debug.out" not
       built
    tiarmclang: error: tiarmlnk command failed with exit code 1 (use -v to see invocation)
    make: *** [makefile:168: udma_memcpy_polling.debug.out] Error 1

    您能否让客户分享实现成功构建的具体步骤。

    此致、

    普拉桑特

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

     Prashant 您好!

    非常感谢您的大力支持。  

    客户仅修改了 --stack_size 和--heap_size、请参阅以下快照。




    谢谢
    此致
    闪耀

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Shine-San:

    感谢您提供确切的更改。 我现在可以构建该示例、发现使用与客户共享的日志相同的日志确实失败了。

    在实验中、我可以说失败仅在于将`.bss`段分配到 TCM 存储器。 `我将`.sysmem `和`.stack `分配给 TCM、同时保持…BSS`至 MSRAM、如下应用程序成功运行所示。

    /* This is rest of uninitialized data. This can be placed in DDR if DDR is available and needed */
    GROUP {
        .bss:    {} palign(8)   /* This is where uninitialized globals go */
        RUN_START(__BSS_START)
        RUN_END(__BSS_END)
    } > MSRAM
    
    .sysmem: {} palign(8) > R5F_TCMB0  /* This is where the malloc heap goes */
    .stack:  {} palign(8) > R5F_TCMB0  /* This is where the main() stack goes */

    现在、 当同时保留`.bss`到 TCM 时应用程序失败的一个可能原因是 TCMB 地址 0x41010000不是 SoC 地址、而是 R5F 内核的本地地址。 任何其他第三方实体无法访问本地地址为0x41010000的 TCMB。 这正是问题所在。 uDMA 示例涉及 DMA 外设、该外设是第三个实体、需要不同存储器的 SoC 地址才能访问它们。 因此、DMA 只能通过其 SoC 地址0x78100000而不是通过本地地址0x41010000访问 TCMB。

    在 udma_memcpy_polling 示例中、我们使用分配给`.bss`并由 DMA 使用的以下变量。  要写入这些变量、DMA 需要其 SoC 等效地址、但我们只需将这些地址的本地地址传递给 DMA、从而产生问题。

    /* UDMA TRPD Memory */
    uint8_t gUdmaTestTrpdMem[UDMA_TEST_TRPD_SIZE] __attribute__((aligned(UDMA_CACHELINE_ALIGNMENT)));
    
    /* Application Buffers */
    uint8_t gUdmaTestSrcBuf[UDMA_ALIGN_SIZE(UDMA_TEST_NUM_BYTES)] __attribute__((aligned(UDMA_CACHELINE_ALIGNMENT)));
    uint8_t gUdmaTestDestBuf[UDMA_ALIGN_SIZE(UDMA_TEST_NUM_BYTES)] __attribute__((aligned(UDMA_CACHELINE_ALIGNMENT)));

    因此、要在这些示例中使用 TCM 存储器、我建议仅将`.bss`保留为 MSRAM、如果需要、其他段如`.data`可分配至 TCMB 存储器、如下所示

    /* This is rest of initialized data. This can be placed in DDR if DDR is available and needed */
    GROUP {
        .data:   {} palign(8)   /* This is where initialized globals and static go */
    } > R5F_TCMB0
    
    /* This is rest of uninitialized data. This can be placed in DDR if DDR is available and needed */
    GROUP {
        .bss:    {} palign(8)   /* This is where uninitialized globals go */
        RUN_START(__BSS_START)
        RUN_END(__BSS_END)
    } > MSRAM
    
    .sysmem: {} palign(8) > R5F_TCMB0  /* This is where the malloc heap goes */
    .stack:  {} palign(8) > R5F_TCMB0  /* This is where the main() stack goes */

    此致、

    普拉桑特