Thanks Helmut. I used your snips, but could not get my program to work (it 
compiles and links without error). Following are the entire effective contents 
of my IAR linker file (LNK430.xcl):
-------------LNK430.xcl------------------
(-cmsp430 -Z(CODE)INTVEC=FFE0-FFFF              
-Z(CODE)CODE,CDATA0,CONST,CSTR,CCSTR#2A00-FFDF  
-Z(DATA)IDATA0,UDATA0,ECSTR,CSTACK+200=0200-6FFF
-Z(DATA)NO_INIT=2A00-7FFF                       
-e_medium_read=_formatted_read -C cl430)        
------------LNK430.xcl-------------------

Following are the segment addresses from the IAR-generated .map file:
-----------SEGMENTS IN ADDRESS ORDER----------------
SEGMENT              SPACE   START ADDRESS    END ADDRESS      SIZE  TYPE  ALIGN
=======              =====   =============    ===========      ====  ====  =====
IDATA0                                0200 - 0282                83   rel    1
UDATA0                                0284 - 06BF               43C   rel    1
ECSTR                                    06C0                         dse    0
CSTACK                                06C0 - 08BF               200   rel    1
NO_INIT                                  2A00                         dse    0
CCSTR                                    2A8E                         dse    0
CSTR                                  2A8E - 2D1A               28D   rel    1
CONST                                 2D1C - 2DE9                CE   rel    1
CDATA0                                2DEA - 2E6C                83   rel    1
CODE                                  2E6E - FFDF              D172   rel    1
INTVEC                                FFE0 - FFFF                20   com    1
-----------SEGMENTS IN ADDRESS ORDER-----------------

This is how my mspgcc linker file looks (note the modified "__stack" address as 
per IAR's .map file):
-----------------msp430x449.x-------------------
[...]
MEMORY
{
  IAR_GDATA(rw)         : ORIGIN = 0x1200,  LENGTH = 0x0400
  text   (rx)           : ORIGIN = 0x2A00,  LENGTH = 0xD5DF
  data   (rwx)          : ORIGIN = 0x0200,      LENGTH = 0x6dff
  vectors (rw)          : ORIGIN = 0xffe0,      LENGTH = 0x20
  bootloader(rx)        : ORIGIN = 0x0c00,      LENGTH = 1K
  infomem(rx)           : ORIGIN = 0x1000,      LENGTH = 256
  infomemnobits(rx)     : ORIGIN = 0x1000,      LENGTH = 256
}
[...]
SECTIONS
{
[...]
  .rel.plt       : { *(.rel.plt)          }
  .rela.plt      : { *(.rela.plt)         }
  .IAR_GDATA  :
  {
    *(.IAR_GDATA)
    . = ALIGN(2);
    *(.IAR_GDATA.*)
  }  > IAR_GDATA
  /* Internal text space.  */
  .text :
  {
    . = ALIGN(2);
    *(.init)
[...]
  PROVIDE (__stack = 0x08bf) ;
[...]
}
-----------------msp430x449.x-------------------

I used the compiler option "-minit-stack" to set the stack address to 0x08bf, 
but the program won't work.

In my program, the startup procedure (cstartup.s43) has been modified - all it 
does is call main(), everything else is commented. Also, in main() RAM address 
range 0x200 to 0x800 is initialized to 0. I have redefined the startup 
procedure for mspgcc:

----------redefined startup--------------
#ifdef __GNUC__
NAKED(_reset_vector__)
{
/* place your startup code here */

/* Make shure, the branch to main (or to your start
routine) is the last line in the function */
__asm__ __volatile__("br #main"::);
}
#endif
----------redefined startup--------------

I think I need to set the stack size (0x200), but not sure where/how. Can you 
please let me know what I am missing/doing wrong?

Thanks.
Amol

>>> [email protected] 03/03/05 02:22PM >>>
--__--__--

Message: 1
Date: Wed, 02 Mar 2005 19:19:47 +0530
From: "Amol Khiste" <[email protected]>
To: <[email protected]>
Subject: [Mspgcc-users] Setting code location
Reply-To: [email protected] 

mspgcc provides a variable - _etext - to mark the end of .text section. Is 
=
there any way to set the beginning of this section? I am porting code =
written with IAR to mspgcc. The code has following statement in the =
LNK430.xcl file:
-Z(CODE)CODE,CDATA0,CONST,CSTR,CCSTR#2A00-FFDF
which gives a different code location.

--__--__--

Hi Amol,


for porting IAR code to mspgcc i use the following snips

In my own linker file: 
-------8<---------
MEMORY
{
[..]
  IAR_GDATA(rw)         : ORIGIN = 0x1200,  LENGTH = 0x0400
  text   (rx)           : ORIGIN = 0x1600,  LENGTH = 0xCA00
[..]
}
-------8<---------


and further down in the SECTIONS area:
-------8<---------
  .IAR_GDATA  :
  {
    *(.IAR_GDATA)
    . = ALIGN(2);
    *(.IAR_GDATA.*)
  }  > IAR_GDATA
-------8<---------


in my code this looks like:
-------8<---------
#ifndef __GNUC__
   #pragma memory = constseg ( GDATA )
#endif

#ifdef __GNUC__
   __attribute__((section(".IAR_GDATA")))
#endif

const gDefaults gDefCh1 = {
[...]
-------8<---------


The line in the MEMORY area
        text   (rx)           : ORIGIN = 0x2A00,  LENGTH = 0xD5E0
would match to your
        -Z(CODE)CODE,CDATA0,CONST,CSTR,CCSTR#2A00-FFDF



Ciao,
          Helmut




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click 
_______________________________________________
Mspgcc-users mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to