Howdy.
On some MSP430 chips (I'm using the f235), the word below the interrupt
vectors is the "BSLSKEY." According to the f235's data sheet (Table 7, note
9), when the value stored here is 0, an incorrect BSL password will *not*
trigger a mass erase (and when 0xAA55 is here, the BSL is disabled
entirely). I'd like to take advantage of this to make it slightly harder to
wipe out the DCO/ADC calibration data in information memory by accident.
I tried to initialize this to 0 in my platform.h file (following the
example in msp430f235.h) with:
#define BSLSKEY_ 0xFFDE
sfrw(BSLSKEY, BSLSKEY_);
BSLSKEY = 0;
But I get the following error:
/home/carlson/local/src/tinyos-2.x/tos/platforms/toast/platform.h:6: syntax
error before `0xFFDE'
/home/carlson/local/src/tinyos-2.x/tos/platforms/toast/platform.h:6:
warning: return-type defaults to `int'
/home/carlson/local/src/tinyos-2.x/tos/platforms/toast/platform.h:6:
warning: data definition has no type or storage class
/home/carlson/local/src/tinyos-2.x/tos/platforms/toast/platform.h:7:
warning: type defaults to `int' in declaration of `BSLSKEY'
/home/carlson/local/src/tinyos-2.x/tos/platforms/toast/platform.h:7:
warning: data definition has no type or storage class
(line 6 is the sfrw line, line 7 is the assignment).
This seems to follow the method used in /usr/msp430/include/msp430f235.h
for the SFRs. For reference, this is an entry in msp430f235.h:
#define ADC12CTL0_ 0x01A0 /* ADC12 Control 0 */
sfrw(ADC12CTL0, ADC12CTL0_);
which gets expanded in app.c to
extern volatile unsigned int ADC12CTL0 __asm ("__""ADC12CTL0");
Any thoughts? Is this even the correct way to do this? The other option
seems to involve telling the linker to make a new section at 0xffde that's
two bytes long, then using the section __attribute__ directive to put the
variable there, but this seems kind of roundabout (adapted from this post
on e2e:
http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/30995.aspx
).
Thanks,
Doug Carlson
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help