IAR怎么在启动程序里面添加关闭看门狗代码
看网上的资料教这么做:
解决办法:
方法一 将一些变量(主要是大全局数组)定义成 no init类型
方法二 修改IAR的cstartup.s43程序,具体方法如下:(iar310a为例)
1 将cstartup.s43程序加载到用户自己的项目中,cstartup.s43在iar310a的路径如下$TOOLKIT_DIR$\src\LIB\
2 修改cstartup.s43中的__program_start子程序,加入关闭看门狗的命令 MOV #0x5A80,&0x0120
3 在Project->Options->Linker->Config页中选择Override default programe ,并将Entry lib 设置成 __program_start
按照上面的指示:我在文件中加入:MOV.W #WDTPW+WDTHOLD , &WDTCTL
(也尝试过,在我的工程中添加#define DISABLE_WATCHDOG 语句,均无效果;也尝试过,直接注释掉调件编译,让其直接编译,也没有效果:
//#ifdef DISABLE_WATCHDOG
MOV #WDTPW + WDTHOLD, &WDTCTL
//#endif
但是我的IAR 是6.0版的,我用的是MSP430,没有看到Entry lib ,取而代之的是Entry symb 所以我选择了 Entry symb :__program_start
但是没有任何效果,什么原因??
cstartup.s43文件内容:
/**************************************************
*
* System initialization code for the MSP430 IAR C/EC++ Compiler.
*
* Copyright ?2002-2008 IAR Systems AB.
*
* $Revision: 5271 $
*
**************************************************/
//
// There are two libraries provided with compilers from IAR Systems,
// CLib and DLib. This file is designed to work with both libraries.
// Some parts of it is DLib-specific. However, those parts will not
// be included when building an application using CLib.
//
//
// Please define one of the following preprocessor symbols in order to
// customize the system initialization process.
//
// IGNORE_SEG_INIT -- To remove segment initialization
// IGNORE_DATA16_DATA -- To remove segment initialization of DATA16 data
// IGNORE_DATA20_DATA -- To remove segment initialization of DATA20 data
// IGNORE_RAMFUNC_INIT -- To remove segment initialization of ramfunc code
// DISABLE_WATCHDOG -- To disable the watchdog
//
// Note: In the current version the symbols "IGNORE_SEG_INIT" and
// "IGNORE_DATA16_DATA" will perform the same task. However, both are
// supported in order to be compatible with other IAR Compilers.
//
// Note: To disable the watchdog, a device-specific header file will
// be included.
//
#include "macros.m43"
#include "cfi.m43"
#ifdef DISABLE_WATCHDOG
#include "msp430.h"
#endif
#define XRSEGCSTART RSEG CSTART:CODE:NOROOT(1)
XCFI_NAMES libNames
XCFI_COMMON libCommon, libNames
// ---------------------
// The cstartup code -- call __low_level_init, perform initialization,
// call constructors and call main. If main returns the exit system
// is started.
//
MODULE ?cstart
//
// Ensure that this is build with the same "positions independent
// code" settings as the compiler uses.
//
XPICRTMODEL
//
// Forward declarations of segments.
//
RSEG HEAP:DATA:NOROOT(1)
RSEG CSTACK:DATA:NOROOT
RSEG DATA16_Z:DATA:NOROOT
RSEG DATA16_I:DATA:NOROOT
RSEG DATA16_ID:CONST:NOROOT
RSEG CODE_I:DATA:NOROOT
RSEG CODE_ID:CONST:NOROOT
#if __CORE__==__430X_CORE__
RSEG DATA20_Z:DATA:NOROOT
RSEG DATA20_I:DATA:NOROOT
RSEG DATA20_ID:CONST:NOROOT
#endif
// ---------------------
// System initialization.
//
XRSEGCSTART
PUBLIC __program_start
EXTERN ?reset_vector
REQUIRE ?reset_vector