![](/img/trans.png)
[英]Has anyone implemented __getzone() for IAR Embedded Workbench for MSP430?
[英]My embedded application never finishes init to get to main() due to watchdog (IAR/MSP430)
我正在使用带有10K RAM的MSP430芯片。 如果我超过5k的RAM使用量,它永远不能进入main()。 init代码调用__data20_memzero
来清除已用RAM空间。
它看起来像是通过内存递增并清除字节直到R14 = R12。 R14是0x34B4。 但是在重新启动并重新开始之前,R12的最大值为0x2c86。 我通过调试器手动关闭了看门狗,它开始运行就好了。 我不能认为这是正常的。 知道如何解决这个问题吗?
发布之后,我发现了这个应用笔记
http://supp.iar.com/Support/?note=37778&from=search+result
如果应用程序有大量(超过4k)的全局初始化数据,则在看门狗超时(并且器件复位)之前,cstartup中的初始化将不会完成。
和
The solution
The Watchdog timer must be turned off before the initialization phase. This should preferably be done in __low_level_init.
The steps (for F1610, F1611 or F1612)
Copy of the file "low_level_init.c" (from ...\430\src\lib\) to your project directory.
Add the copied "low_level_init.c" file to your project.
Edit your copy of the "low_level_init.c" file
In the file you need to add, either...
#include <msp430x16x.h>
...or add...
#include <io430x16x.h>
You should add, in the __low_level_init() function.
WDTCTL = WDTPW + WDTHOLD;
正如您所发现的,根本问题是初始化全局内存只需要太长时间。 虽然在启动时禁用看门狗确实可以解决问题,但如果您担心WD被关闭(甚至是暂时关闭),可能存在缩短初始化时间的替代方案。
IAR支持扩展__no_init
。 这告诉编译器它不需要在初始化例程中包含这些变量。 它对于例如初始值不添加任何值的RTOS堆栈或通信缓冲区非常有用。
举个例子:
__no_init int8_t timerStack[TIMER_STACK_SIZE];
__no_init int8_t displayStack[DISPLAY_STACK_SIZE];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.