TMS320F28379D: CCS/TMS320F28379D: Code hangs at memcpy.c during initialization when copying DELAY_US to RAM (_FLASH defined)

Part Number: TMS320F28379D
Other Parts Discussed in Thread: LAUNCHXL-F28379D, CONTROLSUITE, C2000WARE

Hi TI Experts,

I am encountering an initialization issue with a register-based project on the TMS320F28379D LaunchPad. The code hangs inside the compiler's memcpy.c file during the Flash-to-RAM copy process.

Here are the details of my setup and the troubleshooting steps I've taken:

1. Hardware & Software Environment

  • MCU: TMS320F28379D (on LAUNCHXL-F28379D)

  • IDE: CCS 12.2 (installed on both Desktop and Laptop)

  • Compiler: TI v22.6.0.LTS

  • Desktop PC Packages: C2000Ware_5_04_00_00, C2000Ware_MotorControl_SDK_5_03_00_00, C2000Ware_4_03, controlSUITE 3.49

  • Laptop PC Packages: C2000Ware_4_03

2. Project Details I have two register-based projects, both configured to run from Flash:

  • Old Project: A long-used project. The exact C2000Ware version for its original CMD files is untraceable.

  • New Project: Created today using files provided in C2000Ware 5.04.

  • CMD Files Used: 2837xD_FLASH_lnk_cpu1.cmd and F2837xD_Headers_nonBIOS_cpu1.cmd.

3. Issue Description Because both projects use the DELAY_US() function, I defined the _FLASH macro to copy the time-critical functions to RAM.

During debugging on the Desktop, the initialization code gets stuck in the compiler library file: D:\ti\ccs1220\ccs\tools\compiler\ti-cgt-c2000_22.6.0.LTS\lib\src\memcpy.c Specifically, it hangs at this line: register char *rto = (char *) to; (See attached screenshot)

4. Cross-Testing & Observations To isolate the issue, I ran tests across both PCs and projects:

  • Desktop + New Project: Hangs at memcpy.c.

  • Desktop + Old Project: Was working fine earlier today, but later started exhibiting the exact same memcpy.c hang issue.

  • Laptop + Old Project: Works perfectly without any issues.

  • Laptop + New Project: Hangs at memcpy.c. Even if I replace the New Project's CMD files with the Old Project's CMD files, the issue persists.

  • Optimization Levels: The Old Project uses O2. For the New Project, I tried both O2 and off, but the issue remains.

5. Attachments I have attached the .cmd and .map files of the New Project (from the Desktop) for your reference.

Could you please help me identify why memcpy is failing and how to properly configure the Flash-to-RAM copy for DELAY_US() in the latest C2000Ware? Thank you!

Best regards,
BY Zhang
CAN2SPI_28379dLaunchPad.txt 2837xD_FLASH_lnk_cpu1.txt 

我在使用 TMS320F28379D LaunchPad 运行寄存器版本的工程时遇到了一个代码搬移导致的卡死问题。具体情况和交叉验证测试如下:

1. 软硬件环境

  • 硬件: TMS320F28379D LaunchPad

  • IDE: 两台电脑(台式机和笔记本)均安装 CCS 12.2

  • 编译器版本: TI v22.6.0.LTS

  • 台式机环境: 安装有 C2000Ware_5_04_00_00、MC_SDK_5_03、C2000Ware_4_03、controlSUITE3.49 等。

  • 笔记本环境: 安装有 C2000Ware_4_03 等。

2. 工程说明 手头有两个均运行在 Flash 中的寄存器版本工程:

  • 旧工程: 一直在使用的工程,使用的 CMD 等文件具体版本已不可考。

  • 新工程: 今天新建的工程,使用的是 C2000Ware 5.04 提供的文件。

  • 当前使用的 CMD 文件: 2837xD_FLASH_lnk_cpu1.cmdF2837xD_Headers_nonBIOS_cpu1.cmd

3. 问题现象 因为两个工程中都使用到了 DELAY_US() 函数,为了让其运行在 RAM 中,我全局宏定义了 _FLASH。 但在台式机上调试时发现,代码在初始化阶段会停在以下路径的文件中: D:\ti\ccs1220\ccs\tools\compiler\ti-cgt-c2000_22.6.0.LTS\lib\src\memcpy.c 具体卡死在这一行代码:register char *rto = (char *) to;(见附图)。

4. 交叉验证过程 为了排查问题,我在两台电脑上分别对新旧工程进行了交叉测试:

  • 台式机 + 旧工程: 今天早些时候能正常运行,随后也遇到了和新工程一样的 memcpy 卡死问题。

  • 台式机 + 新工程: 卡死在 memcpy.c

  • 笔记本 + 旧工程: 可以正常运行。

  • 笔记本 + 新工程: 卡死在 memcpy.c。尝试将新工程的 CMD 文件替换为旧工程的 CMD 文件后,问题依旧。

  • 编译器优化等级: 旧工程使用的是 O2;新工程我尝试了关闭优化(off)和开启 O2,问题依然存在。

我已经将台式机上新工程的 .cmd.map 文件作为附件上传。请问这种卡死在 memcpy.c 的现象通常是由什么原因导致的?应该如何修改配置?非常感谢!