Other Parts Discussed in Thread: MSP430F5418
Hi,
below is a small sample program which I will use to ask a question. It is for MSP430F5418 with large data memory model enabled.
Because I don't know the real answer to this question (see http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/p/66903/242754.aspx#242754) and was only able to present a solution I'd like to have this question asked here.
#include "msp430f5418.h"
int test[7680] = { 1 };
#pragma DATA_SECTION(testByte, ".testObjSeg") ;
unsigned char testByte [50];
unsigned char *pointer;
void main( void )
{
// disable watchdog timer
//------------------------
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
pointer = &testByte[4];
test[3] = *pointer;
test[7678] = 0xaa;
test[7679] = 0xa0;
test[0] = test[7679] - test[7678];
}
with an user-defined-segment (TEST_OBJ_SEG) at the end of flash memory:
MEMORY
{
...
FLASH : origin = 0x5C00, length = 0xA380
FLASH2 : origin = 0x10000,length = 0x0DC00 /* keep in mind to reduce the size of FLASH2 because of TEST_OBJ_SEG !*/
TEST_OBJ_SEG : origin = 0x1DC00,length = 0x08000
INT00 : origin = 0xFF80, length = 0x0002
...
The code above is the solution for the problem with the code below.
void main( void )
// disable watchdog timer
//------------------------
WDTCTL = WDTPW + WDTHOLD;
// Stop WDT
test[3] = testByte[4]; // problem with this line!
test[7678] = 0xaa;
test[7679] = 0xa0;
test[0] = test[7679] - test[7678];
}
The question is: Why does the compiler uses a 16-bit pointer for acessing testByte[4] (test[3] = testByte[4];) instead of using a 20-bit ones (as I already mentioned large data memory model is enabled)?
Thanks for your help, kind regards
aBUGSworstnightmare