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.

__no init_如何定义数组及Cstartup.s43文件中关闭WDT的疑问

Other Parts Discussed in Thread: MSP430F5438A

芯片用MSP430F5438A,程序下载到板子后,一直在_data 16_memzero里死循环。网上查了下,可能是因为初始化变量时有大数组,导致看门狗不断复位,这个初始化的过程在进入main函数之前,解决方法有:

1、对数组用__no init_定义;

2、修改IAR中的Cstartup.s43文件中的__program_start子程序,增加一个关闭看门狗的设置

问题:1、__no init_如何使用?例如数组unsigned char ABCbuffer[500]; 如何用__no init_定义?

           2、在Cstartup.s43中__program_start关于看门狗的代码如下,在哪儿添加关闭WDT?

        __program_start:

        PUBLIC ?cstart_begin ?cstart_begin:

        // --------------------         // Turn off the watchdog.         //        

       // Note: This is excluded by default. Please define        

       // DISABLE_WATCHDOG to include it.         //           

      #ifdef DISABLE_WATCHDOG

        MOV     #WDTPW + WDTHOLD, &WDTCTL

      #endif

  • 1、__no_init unsigned char ABCbuffer[500];

    2、37行后即可

     

    #include "macros.m43"
    #include "cfi.m43"

    #define DISABLE_WATCHDOG   //关闭狗,2013-08-02

    #ifdef DISABLE_WATCHDOG
    #include "msp430.h"
    #endif

  • 你好,

    MCU在进入main.c函数之前,还有一个引导程序,只是一般情况下我们都把他忽略,类似相机的傻瓜相机,不需要搞得像单反配置很多东西。

    IAR默认会编译初始化你在main.c里面定义的数组,你仿真可以发现,debug指针指向main函数开头时,你在watch窗口可以看到定义的数组都是0,这是需要花时间的,在main.c函数之前完成,如果这个时间长了,IAR隐藏的代码是打开看门狗来初始化数组的。

    所以你有两个解决措施:

    1.找到引导代码,关闭看门狗。

    2.不初始化数组。

  • 按照您的,加了 #define DISABLE_WATCHDOG   //关闭狗 ,还是不行?求解