EmbeddedRelated.com
Forums

Upper Flash Access, MSP430F5437A

Started by louistran30 January 19, 2011
Hi All,

IDE: CrossStudio
Part: MSP430F5437A

I am trying to write to a flash segment above 64K. I placed the variables to 0x10600 in the section placement file. However, when this address get passed into the "write_flash()" method below, the *dest pointer gets truncated to 0x0600 even though it is 0x10600 when passed in.

I compiled to 430X and set memory size to 1M (from 64K). But the pointer still get truncated to 16-bit.

Thanks in advance for your help.

Louis

void
write_flash(
unsigned char * dest,
unsigned char * source,
unsigned char size)
{
unsigned state;
state = _DINT(); // Run with interrupts disabled
FCTL3 = FWKEY; // Clear LOCK & LOCKA bit
FCTL1 = FWKEY+WRT; // Enable byte/word write mode
while (FCTL3 & BUSY); // test busy
memcpy(dest,source,size);
FCTL1 = FWKEY; // Clear write bit
FCTL3 = FWKEY+LOCK; // Set LOCK bit
if (state & GIE) _EINT();// Restore entry interrupt state
}

Beginning Microcontrollers with the MSP430

On 20.01.2011 03:42, louistran30 wrote:
:
> void
> write_flash(
> unsigned char * dest,
> unsigned char * source,
> unsigned char size)
> {
> unsigned state;
> state = _DINT(); // Run with interrupts disabled
> FCTL3 = FWKEY; // Clear LOCK & LOCKA bit
> FCTL1 = FWKEY+WRT; // Enable byte/word write mode
> while (FCTL3 & BUSY); // test busy
> memcpy(dest,source,size);
> FCTL1 = FWKEY; // Clear write bit
> FCTL3 = FWKEY+LOCK; // Set LOCK bit
> if (state & GIE) _EINT();// Restore entry interrupt state
> }
:

instead of memcpy() use a small loop and write to memory with
_data20_write_char()

Hardy
Hardy,
Thanks for your response.
-Louis
--- In m..., Hardy Griech wrote:
>
> On 20.01.2011 03:42, louistran30 wrote:
> :
> > void
> > write_flash(
> > unsigned char * dest,
> > unsigned char * source,
> > unsigned char size)
> > {
> > unsigned state;
> > state = _DINT(); // Run with interrupts disabled
> > FCTL3 = FWKEY; // Clear LOCK & LOCKA bit
> > FCTL1 = FWKEY+WRT; // Enable byte/word write mode
> > while (FCTL3 & BUSY); // test busy
> > memcpy(dest,source,size);
> > FCTL1 = FWKEY; // Clear write bit
> > FCTL3 = FWKEY+LOCK; // Set LOCK bit
> > if (state & GIE) _EINT();// Restore entry interrupt state
> > }
> :
>
> instead of memcpy() use a small loop and write to memory with
> _data20_write_char()
>
> Hardy
>