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.

[参考译文] TMS320F28P550SJ:全局阵列初始化

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1653421/tms320f28p550sj-global-array-initialization

器件型号: TMS320F28P550SJ

您好:

我在使用 TMS320F28P550SJ9 进行开发时遇到问题、想征询您对如何解决问题的建议。 谢谢你。

问题描述

使用引导加载程序函数升级固件后、应用程序会通过看门狗复位跳回该应用程序。 此时、全局数组的初始值变为异常。

1.当数组声明如下时:

 
int16U wLineADBuffer[CLineADBufferSize]={0};
 

只有的第一个元素 wLineADBuffer 被读取为 0、而所有其他数组元素都是非零的。


2.不过,当我将声明更改为:

 
int16U wLineADBuffer[CLineADBufferSize]=
{
   0、0、0、0、0、0、0、
   0、0、0、0、0、0、0、
   0、0、0、0、0、0、0、
   0、0、0、0、0、0、0
};

的所有元素 wLineADBuffer 均已正确初始化为 0。


在冷上电复位期间不会发生此问题。

似乎第一个声明{0}() 使用“紧凑初始化记录“机制、而显式 32 元素初始化值使用“完整映像初始化“机制。

如果我仍想使用第一个样式声明数组:

int16U wLineADBuffer[CLineADBufferSize]={0};

是否有办法避免阵列在启动后未完全初始化为零的问题?