打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
MSP430定义大数组后无法正常启动的问题
在MSP430编程过程中遇到这样一个问题:程序中数组较多,用IAR仿真时好像程序自动开始运行了,而且程序一直在执行固定的几条语句。造成这种现象的原因是程序开始执行时需要初始化全局变量,全局数组过多导致初始化时间过长引起看门狗溢出。解决这个问题有两种方法。

1、https://www.iar.com/support/tech-notes/general/my-msp430-does-not-start-up/

Introduction

This Technical Note discusses cases where an MSP430 device does not start, or does not reach the main function.

Some different symptoms

The hardware never starts up.

The MSP430 device resets without reaching the "main()" function.

The watchdog timer times out during initialization.

The cause

If the application has much (over 4k) of global initialized data, then the initialization within cstartup will not be finished before the watchdog times out (and the device is reset).

Affected derivatives

The MSP430 derivatives MSP430F1610, F1611 and F1612 have large RAM, but this Technical Note applies to any device with large RAM.

The solution

The Watchdog timer must be turned off before the initialization phase. This should preferably be done in __low_level_init.


Steps (for MSP430F1610, 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;
  • Finally you should consider (if needed) where in your application the Watchdog should be activated. In such a case add the appropriate C source at that place.

2、将大数组放在RAM的不初始化区域

       既然已经知道是初始化时间过长导致这个问题,我们可以把大数组定义在RAM的不初始化区域就行了。
       在IAR编译器中,在定义变量之前,加上__no_initm命令即可,如__no_init char a; 即把a这个字符型变量放在RAM的不初始化区域。
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
MSP430定义超大数组的问题
STM32库函数编程学习心得:结构体,枚举的使用
IAR for MSP430的安装
MSP430开发注意事项
IAR编译器一个警告信息-Warning[Pe550]: variable "变量" was set ...
IAR常见段名含义
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服