EmbeddedRelated.com
Forums

uninitialised variable

Started by Kamil September 29, 2006
Is it possible to have uninitialsed variable which after reset was
not covered by 0?
I see that uninicialised data is set to 0. My programm from time to
time must reset, but i want to have unchanged some variables after
reset and i mustn't write those into flash.
Is it possible to declare e.g. short int to have that possibility in
crossworks? if yes how to do that?
in MSP manual there is nothing about RAM after system reset or
watchdog reset and crossworks says nothing about it:(

Beginning Microcontrollers with the MSP430

Create a new section called NOINIT and put it in your section placement
file under the RAM group.

Then have:

int x @ "NOINIT".

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

> -----Original Message-----
> From: Kamil [mailto:k...@tlen.pl]
> Sent: 29 September 2006 13:26
> To: m...
> Subject: [msp430] uninitialised variable
>
> Is it possible to have uninitialsed variable which after
> reset was not covered by 0?
> I see that uninicialised data is set to 0. My programm from
> time to time must reset, but i want to have unchanged some
> variables after reset and i mustn't write those into flash.
> Is it possible to declare e.g. short int to have that
> possibility in crossworks? if yes how to do that?
> in MSP manual there is nothing about RAM after system reset
> or watchdog reset and crossworks says nothing about it:(
>
>
>
--- In m..., "Paul Curtis" wrote:
>
> Create a new section called NOINIT and put it in your section
placement
> file under the RAM group.
>
> Then have:
>
> int x @ "NOINIT".
>
> --
> Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
> CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

thank you very much!

p.s.off topic :)
is anybody not using swap_nibbles???
in 1.3 and 1.4 still have not swap nibbles in 'inmsp.h' defined.

you forgot add in header file:

#pragma intrinsic(__swap_nibbles)
unsigned char __swap_nibbles(unsigned char x);

:)