Is there a way to get wdt time greater then 10 seconds.
I use 32768 oscillator to get 8 mHz clock.
Right, seriously I don't mean to be abusive and please don't take it personal BUT:
ephraim ovedIs there a way to get wdt time greater then 10 seconds.
Unfortunately the quality of information you've given doesn't lend itself to any better advise.
Arturs Elksnis8mHz ??? Is that 8 milli Herz??? So 8 oscillations in thousand seconds??? Really??? I don't think that you can divide 32kHz that far with an MSP430 clock system;
Other possible intervals with 32kHz source are 1:08:16, 4:16, 16 or 1s. Or 250, 15,6 or 1,95ms.About three times as much when using the VLO clock. (but then the outcome is somewhat uncertain as VLOclock has a large drift and tolerance.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.
Ok, point taken. I've got lots to learn myself. :)
Arturs ElksnisI've got lots to learn myself.
Jens-Michael GrossThat's IMHO why CCS does not clear uninitialized variables/arrays on startup, which is not necessary by the C standard but done by almost all other C compilers.
All documented arguments I've seen note that, since C90, this is required by the C standard. See http://lwip.wikia.com/wiki/Why_are_global_variables_not_initialized_to_zero%3F and http://stackoverflow.com/questions/2617196/c-static-variables-and-intialization
Section 4.9 "Initialization" in the 1978 edition of "The C Programming Language" by Kernighan and Ritchie also states that initialization to zero is done at compile time. So CCS may have had a reason for failing to do so, but it's never been consistent with the contemporaneous C standard (unless that was broken somewhere between K&R and the first ANSI standard, which I'm willing to assume didn't happen).
I don't think the reason is good either; CCS could very well have reset the watchdog as necessary while initializing memory.
Peter BigotAll documented arguments I've seen note that, since C90, this is required by the C standard.
Peter BigotI don't think the reason is good either; CCS could very well have reset the watchdog as necessary while initializing memory.
Also, this 'feature' is well documented in the CCS compiler manual. It's only that nobody reads manuals these days - It is assume that things are as one expects them, and if not, a forum post is thrown out.
Peter BigotKernighan and Ritchie also states that initialization to zero is done at compile time
Jens-Michael GrossThe described reason was only a guess.
The proposed explanation of CCS behavior was stated as an opinion; the statement that its failure to present global variables as though they had been initialized to zero was not required by the C standard was presented as fact. It is false.
Jens-Michael GrossPeter BigotKernighan and Ritchie also states that initialization to zero is done at compile timeThis means that variables explicitely initialized to zero (by adding "=0" to the definition) are put into initialized data segment and have their zero value stored in flash like any other initialization value.
I apologize; I mis-summarized. The actual source document states:
K&R1e sect 4.9In the absence of explicit initialization, external and static variables are guaranteed to be initialized to zero; automatic and register variables have undefined (i.e., garbage) values. ... For external and static variables, the initialization is done once, conceptually at compile time.
Thus a run-time initialization prior to transferring control to main() is perfectly acceptable.
There is no "improvement" here; CCS' behavior is strictly contrary to the language as it has existed since 1978. It's good that the improper behavior is documented in the manual, but there's no reason to suggest that developers should be blamed for assuming that the default behavior of a language implementation conforms to the language specification, especially in something so fundamental.
AFAIK if you compile to EABI using CCS5 the toolchain does clear BSS segment by default; I recall that it caused quite a bit of grief for ppl upgrading from previous versions relying on the non-standard behaviour, since it caused the watchdog to reset indefinitely during initialization. Not sure if this was solved or not, but yeah I could understand why they made the non-standard behaviour the default.
Peter Bigotthe statement that its failure to present global variables as though they had been initialized to zero was not required by the C standard was presented as fact. It is false.
Your citation is correct, yet I doubt it applies at all to this case.
According to K&R, "int data;" is an incomplete definition. As such, if done on global scope, it has to be initialized to default value, which is 0 for this data type.However, since it is a definition, it may only appear once in a project. You cannot e.g. include it by a header file into several compilation units. Doing so would lead to a linker error since the same variable is defined multiple times in the project.So if 'data' has been defined in one compilation unit, it may only be declared in others by using 'extern' declaration.Now current compilers are smart neough to allow multiple incomplete definitions wihtout throwing an error, creating the storage location only once. This behavior effectively turns the incomplete global definition into an auto storage type. Whose initial value is undefined.This is logical too. Since the global variable defined with an incomplete definition is not associated wiht a specific compilation unit, it's initial value is equally undefined for any compilation unit that uses it.
Peter Bigotthe language as it has existed since 1978
However, the non-initialization of variables with incomplete definition is surprising for those who are accustomed to have them initialized. But if someones code relies on a variable being zero at the beginning, he should invest those additional two bytes in the source code and explicitely initialize them.BTW: some compilers produce debug compilations without, and only release compilations with auto-zeroing of incompletely defined variables.
"Faced with the choice between changing one's mind and proving there is no need to do so, almost everyone gets busy on the proof." -- John Kenneth Galbraith
Peter Bigot"Faced with the choice between changing one's mind and proving there is no need to do so, almost everyone gets busy on the proof." -- John Kenneth Galbraith
But for normal people, this citation is wrong. Most people will change their mind easily if someone just offers a different opinion with at least a minimum of persuasion. In the face of a different opinion, checking the own one (or its source) against independent sources, rather than to obliterate without questioning, is the only reason why whe don't still think the earth is flat.
However, I did the checking and came up with the conclusion that here is no right or wrong but that this case is simply not covered in the original K&R due to other differences. And CSS never stated to be fully compliant to K&R or any other standard.
I totally agree to your opinion that clearing uninitialized variables at startup should be done (as long as there isa way to intentionally leave some dataspace uninitialized, which is vital for some microcontroller applications). I just disagreed that it is a neccessity by a standard the compiler never claims to comply to. (And I figured out that it is not truly the case anyway)
If following a standard for its own sake is such a high goal, why are there ever multiple, not even always backwards compatible standards for a single topic? Or with Microsofts words: why should we follow our own yesterday standard if a different way seems more profitable today?
At the end, this whole discussion is pointless. CCS works as it works, it is documented how it works and if you don't like it you can use a different compiler. (Well, I guess you're using MSPGCC anyway :) )The most important information form this thread is that seemingly CCS has changed its former behavior with the switch to ELF (EABI) output format. I wonder whether this is documented. It already caused havoc for many people whose old projects suddenly stop working. Operation successful, patient dead.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.