|mspgcc: A port of the GNU tools to the Texas Instruments MSP430 microcontrollers|
|<<< Previous||MSP430 specific extensions to the GNU toolchain||Next >>>|
MSP430 architecture processors use a single address space to map data and code. The registers and memory are 16 bits wide, and the CPU can only read and write 16 bit data at even addresses. If you attempt to read or write a 16 bit value at an odd address, the CPU behaves as if the LSB is not set. The processor has no exception handling. The MSP430 can read and write 8 bit data at any address.
The C compiler supports the following basic data types
char - 1 byte (8 bits)
int - 2 bytes (16 bits)
long - 4 bytes (32 bits)
long long - 8 bytes (64 bits)
float - 4 bytes
All global variables with the "const" attribute are allocated in the main ROM space. They are normally placed in the .text section. Accessing "const" variable is no different than accessing to any other type of variable. If the device uses flash memory and the flash memory is enabled for writing, you can write to the flash. You can place "const" variables to RAM, using the attribute "section(".data"))" as follows:
const char __attribute__ ((section(".data"))) foo = 1;
Variables larger than one byte are always located at an even address. Single byte variables can be located at any address.