Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to extend CONST memory size of MSP430F5438 using IAR compiler?

Status
Not open for further replies.

london

Member level 4
Joined
Jun 30, 2006
Messages
79
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,945
Hi All Pls help me,
I am using MSP430F5438 with IAR compiler. For this micro the CONST memory size is define as 5c00 to ff79. (around 41K) but I need more CONST memory size. The another code memory is 10000 to 45bff,
So If I want to extend the constant memory size, how to do it?
The lnkXMSF5438.xlc file,


//*****************************************************************
//
// XLINK command file for IAR Embedded Workbench for MSP430.
//
// This file should be used with the XMS430F5438 microprocessor.
//
// Copyright 1996-2007 IAR Systems. All rights reserved.
//
// Usage: xlink your_file(s) -f lnkxms430f5438 library
//
// $Revision: 4455 $
//
//*****************************************************************

//*****************************************************************
//
// The memory areas of the XMS430F5438 microprocessor:
//
// Peripheral units: 0 - 01FF
//
// Information memory (FLASH): 1800 - 19FF
//
// Read-write memory (RAM): 1C00 - 5BFF
//
// Read-only memory (FLASH): 5C00 - FF79
// 10000-45BFF
//
//*****************************************************************

//*****************************************************************
//
// The following segments are defined in this linker command file:
//
// Data read/write segments (RAM)
// ==============================
//
// segment Restrictions Usage
// ------- ------------ --------------------------
// DATA16_I < 10000 Data16 initialized variables
// DATA16_Z < 10000 Data16 zero initialized variables
// DATA16_N < 10000 Data16 uninitialized variables
// DATA16_HEAP < 10000 Data16 heap used by malloc and free
// DATA20_I Data20 initialized variables
// DATA20_Z Data20 zero initialized variables
// DATA20_N Data20 uninitialized variables
// DATA20_HEAP Data20 heap used by malloc and free
// CSTACK < 10000 Runtime stack
//
//
// Program and data read-only segments (FLASH)
// ===========================================
//
// segment Restrictions Usage
// ------- ------------ --------------------------
// INFO Information memory
// CSTART < 10000 Program startup code
// CODE Program code
// ISR_CODE < 10000 Program code for interrupt service routines
// DATA16_C < 10000 Data16 constant data and string literals
// DATA16_ID < 10000 Data16 initializers for DATA16_I
// DATA20_C Data20 constant data and string literals
// DATA20_ID Data20 initializers for DATA20_I
// DIFUNCT < 10000 Dynamic initialization vector used by C++
// CHECKSUM Checksum byte(s) generated by the -J option
// INTVEC FF80-FFFF Interrupt vectors
// RESET FFFE-FFFF The reset vector
//
//*****************************************************************


// ---------------------------------------------------------
// Stack and heap sizes.
// ---------------------------------------------------------

// Uncomment for command line use
//-D_STACK_SIZE=80
//-D_DATA16_HEAP_SIZE=80
//-D_DATA20_HEAP_SIZE=80


// ---------------------------------------------------------
// Define cpu.
// ---------------------------------------------------------

-cmsp430


// ---------------------------------------------------------
// Read-write memory.
// ---------------------------------------------------------

-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,DATA16_HEAP+_DATA16_HEAP_SIZE=1C00-5BFF
-Z(DATA)DATA20_I,DATA20_Z,DATA20_N,DATA20_HEAP+_DATA20_HEAP_SIZE
-Z(DATA)CSTACK+_STACK_SIZE#


// ---------------------------------------------------------
// Read only memory


// ---------------------------------------------------------
// Information memory
// ---------------------------------------------------------

-Z(CODE)INFO=1800-19FF
-Z(CODE)INFOA=1980-19FF
-Z(CODE)INFOB=1900-197F
-Z(CODE)INFOC=1880-18FF
-Z(CODE)INFOD=1800-187F



// ---------------------------------------------------------
// Low memory 0 - 0xFFFF
// ---------------------------------------------------------

// ---------------------------------------------------------
// Code

-Z(CODE)CSTART,ISR_CODE=5C00-FF79

// ---------------------------------------------------------
// Constant data

-Z(CONST)DATA16_C,DATA16_ID,DIFUNCT=5C00-FF79

// ---------------------------------------------------------
// All memory 0 - 0xFFFFF
// ---------------------------------------------------------

// ---------------------------------------------------------
// Code

-P(CODE)CODE=5C00-FF79,10000-45BFF

// ---------------------------------------------------------
// Constant data

-Z(CONST)DATA20_C,DATA20_ID=5C00-FF79,10000-45BFF


// ---------------------------------------------------------
// Interrupt vectors
// ---------------------------------------------------------

-Z(CODE)INTVEC=FF80-FFFF
-Z(CODE)RESET=FFFE-FFFF


// ---------------------------------------------------------
// The end
// ---------------------------------------------------------
 

msp430x heap

To check **broken link removed** if you use IAR v3.42.
The IAR v4.xx supports full extended memory access (1MB).
You can use large data model or memory attribute '__data20' with or without pragma directive 'constseg'.
All of them are described in IAR's compiler reference guide.

FYR
 

    london

    Points: 2
    Helpful Answer Positive Rating
data16_i iar

yager said:
To check **broken link removed** if you use IAR v3.42.
The IAR v4.xx supports full extended memory access (1MB).
You can use large data model or memory attribute '__data20' with or without pragma directive 'constseg'.
All of them are described in IAR's compiler reference guide.

FYR

Thanks for your info. Now I am using easyGUI software tool to generate the GUI screens and interfacing with MSP430F5438. The easyGUI is creating the code as 16 bit / 32 bit (including pointers). That code is not working in larhe data model mode. Pls any idea?
 

xlink msp430

london said:
Thanks for your info. Now I am using easyGUI software tool to generate the GUI screens and interfacing with MSP430F5438. The easyGUI is creating the code as 16 bit / 32 bit (including pointers). That code is not working in larhe data model mode. Pls any idea?
If the generated code can working in 64K, you can select medium data model and use '__data20' to declare the other constants.
If not, you have to fine tune it by hand.
It seems to me that it is not a good portability.

The data model is like as implicit rule, '__data16' & '__data20' as explicit.
medium: all data will be '__data16' and 16-bit pointer size if not assign with '__data20'
large: all data will be '__data20' and 32-bit pointer size if not assign with '__data16'
The compiler will use MSP430X extended instructions to translate code for '__data20' type.

FYR
 

    london

    Points: 2
    Helpful Answer Positive Rating
data16_heap

yager said:
If the generated code can working in 64K, you can select medium data model and use '__data20' to declare the other constants.
If not, you have to fine tune it by hand.
It seems to me that it is not a good portability.

The data model is like as implicit rule, '__data16' & '__data20' as explicit.
medium: all data will be '__data16' and 16-bit pointer size if not assign with '__data20'
large: all data will be '__data20' and 32-bit pointer size if not assign with '__data16'
The compiler will use MSP430X extended instructions to translate code for '__data20' type.

FYR

Thanks for the advice. In my case the IAR MSP430X compiler data pointer is 16bits and function pointer is 32bit (if I use __data20), But my easyGUI software code generate 16bit pointer in both. So how to fine tune the function points as 20bit / 32bit. I think the __data20 module addressing is 20bit.
Thanks again
 

iar compiler string literals

london said:
In my case the IAR MSP430X compiler data pointer is 16bits and function pointer is 32bit (if I use __data20), But my easyGUI software code generate 16bit pointer in both. So how to fine tune the function points as 20bit / 32bit. I think the __data20 module addressing is 20bit.
The MSP430X CPU has 20-bit address bus, so it only can address up to 1MB without paging.
IAR use 4 bytes to store in memory for MSP430X's function pointer (20 bits) whatever __data20 is used or not.
The function pointer is always 4 bytes for MSP430X architecture by IAR MSP430 compiler.
In fact, IAR used RETA for all function exit even the function is located in 1st 64K.
Code:
typedef unsigned short int U16;
U16 subroutine1( U16 v ) { return v+1; }
U16 subroutine2( U16 v ) { return v-1; }
U16 subroutine3( U16 v ) { return v*v; }
The 'csubroutines' (12 bytes) in 'DATA16_C' segment:
Code:
U16 (* const __data16 csubroutines[])( U16 )={ subroutine1,subroutine2,subroutine3 };
The 'csubroutines' (12 bytes) in 'DATA20_C' segment:
Code:
U16 (* const __data20 csubroutines[])( U16 )={ subroutine1,subroutine2,subroutine3 };
The size of data pointer can be 2 or 4 bytes which it depends on model and/or memory attribute.
Code:
char const __data16 s1[]="ABBA";
char const __data16 s2[]="BEEF";
char const __data16 * __data20 const dp1[]={ s1,s2 };
The s1,s2 are placed in 'DATA16_C' and dp1 (4 bytes) in 'DATA20_C'.
Code:
char const __data20 s3[]="DEAD";
char const __data20 s4[]="FEED";
char const __data20 * __data16 const dp2[]={ s3,s4 };
The s3,s4 are placed in 'DATA20_C' and dp2 (8 bytes) in 'DATA16_C'.

So you need to let compiler know how to translate them.
 

    london

    Points: 2
    Helpful Answer Positive Rating
iar compiler does cstack get initialized?

yager said:
The MSP430X CPU has 20-bit address bus, so it only can address up to 1MB without paging.
IAR use 4 bytes to store in memory for MSP430X's function pointer (20 bits) whatever __data20 is used or not.
The function pointer is always 4 bytes for MSP430X architecture by IAR MSP430 compiler.
In fact, IAR used RETA for all function exit even the function is located in 1st 64K.
Code:
typedef unsigned short int U16;
U16 subroutine1( U16 v ) { return v+1; }
U16 subroutine2( U16 v ) { return v-1; }
U16 subroutine3( U16 v ) { return v*v; }
The 'csubroutines' (12 bytes) in 'DATA16_C' segment:
Code:
U16 (* const __data16 csubroutines[])( U16 )={ subroutine1,subroutine2,subroutine3 };
The 'csubroutines' (12 bytes) in 'DATA20_C' segment:
Code:
U16 (* const __data20 csubroutines[])( U16 )={ subroutine1,subroutine2,subroutine3 };
The size of data pointer can be 2 or 4 bytes which it depends on model and/or memory attribute.
Code:
char const __data16 s1[]="ABBA";
char const __data16 s2[]="BEEF";
char const __data16 * __data20 const dp1[]={ s1,s2 };
The s1,s2 are placed in 'DATA16_C' and dp1 (4 bytes) in 'DATA20_C'.
Code:
char const __data20 s3[]="DEAD";
char const __data20 s4[]="FEED";
char const __data20 * __data16 const dp2[]={ s3,s4 };
The s3,s4 are placed in 'DATA20_C' and dp2 (8 bytes) in 'DATA16_C'.

So you need to let compiler know how to translate them.

The problem has been solved without any othe code edit. When I just off the WDT before go to the main function, its working fine.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top