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.

A question about the pointer that would point to the address greater than two bytes.

Other Parts Discussed in Thread: MSP430F5438

Hi all,

Currently, I would like to store the data into an array, and I have allocated that array into flash whose address is 0x10200 (I use MSP430F5438).

However, I cannot get the address of that array correctly because compiler always converts 0x10200 into 0x00200, which obviously will give me a incorrect writing or reading.

My code is shown below:


#pragma DATA_SECTION (array, "memory section starts at 0x10200");    // Allocate array into the flash whose address is 0x10200
UBYTE array[size];

void main(void)
{
   char *ptr;
   
    ptr = (char *)(array);                           // Read the address of the array - here ptr will be set to 0x00200 rather than 0x10200
    FLASH_WriteByte(ptr, 0xAA);           // Write 0xAA to the array - I cannot successfully write 0xAA to that array
}

 

By the way, if I set the value of array size to 0x10000 (64K), the compiler would give me an "array size is too large" error.

how do I avoid this problem?

 

So, is anyone able to give me some help about thoes problems?

Thanks!

Liu

**Attention** This is a public forum