Reply by Paul Curtis May 14, 20032003-05-14
Hi Klaus,

> thanks very much for your support.

No problem.  That's what we're here for.

> This works perfectly.

Good.  :-)

> I did not know that the ORG directive
> behaves that way and that i have to use the .ROOT
> directive also.

This is all documented in the help system.  I'm currently working on a
PDF version of our help system generated from the XHTML, so perhaps
users will find this better for looking through, and then we'll also
offer the option of printed manuals.

> Took me hours. I never will 
> forget that ;)

Sorry it took hours; if you'd asked earlier, then perhaps we could have
saved you some time.  :-(

-- Paul.

Beginning Microcontrollers with the MSP430

Reply by kbox2003 May 14, 20032003-05-14
Hello Paul,

thanks very much for your support. This works 
perfectly. I did not know that the ORG directive
behaves that way and that i have to use the .ROOT
directive also. Took me hours. I never will 
forget that ;)

regards,
Klaus

--- In msp430@msp4..., "Paul Curtis" <plc@r...> wrote:

> Hi Klaus,
> 
> Try this:
> 
>         INCLUDE <msp430x14x.h>
>         .DATA        
>  
> VZC     DS.W      2       ; last captured value in CCR2
> 
>         .CODE   
>         .ROOT
>  
> RESET   mov.w   #0A00h,SP               ; Initialize 'F149 
> stackpointer
> StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
>         bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt
>  
>         ; ...more code
>         mov.w VZC, r4
> 
>         .VECTORS
>         .ROOT
>         ORG     0x1e
>  
>         DW      RESET                   ; 
>         END     
> 
> ORG statements do *not* set the absolute position of a segment, but for
> relocatable section they set an offset from the beginning of the section
> (this is incorrectly documented in some places of the IAR
> documentation...)
> 
> You just need to use the standard .DATA, .VECTORS, .CODE, and .ROOT
> directives, along with the F149 memory map file.
> 
> If you open up the Symbol Browser and select Group By Section from the
> dropdown tool button, you'll see the appropriate section details are
all
> correct.
> 
> -- Paul.
> 


Reply by Paul Curtis May 14, 20032003-05-14
Hi Klaus,

Try this:

        INCLUDE <msp430x14x.h>
        .DATA        
 
VZC     DS.W      2       ; last captured value in CCR2

        .CODE   
        .ROOT
 
RESET   mov.w   #0A00h,SP               ; Initialize 'F149 
stackpointer
StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
        bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt
 
        ; ...more code
        mov.w VZC, r4

        .VECTORS
        .ROOT
        ORG     0x1e
 
        DW      RESET                   ; 
        END     

ORG statements do *not* set the absolute position of a segment, but for
relocatable section they set an offset from the beginning of the section
(this is incorrectly documented in some places of the IAR
documentation...)

You just need to use the standard .DATA, .VECTORS, .CODE, and .ROOT
directives, along with the F149 memory map file.

If you open up the Symbol Browser and select Group By Section from the
dropdown tool button, you'll see the appropriate section details are all
correct.

-- Paul.

> -----Original Message-----
> From: kbox2003 [mailto:kbo@kbo@...] 
> Sent: 13 May 2003 21:11
> To: msp430@msp4...
> Subject: [msp430] CrossWorks ASM, defining sections?
> 
> 
> Hi all,
> 
> I want to define variables in Crossworks assembler using the
> DS directive. But always I get an error. I did several 
> attempts to define the sections, but none works as expected. 
> 
> What am i doing wrong? Please have a look at my attempts...
> 
> ///////////////////////////////////////////////////////////////
> // this compiles & links, but i get amessage box when 
> // trying to upload: "section .abs is too big for target"
> // The same happens when i omit all "ASEG" directives. When
> // i remove the line
> // "VZC     DS.W      2       ; last captured value in CCR2"
> // everything works 
> ///////////////////////////////////////////////////////////////
>         ASEG 0200h       
> 
>         ORG 0200h
> VZC     DS.W      2       ; last captured value in CCR2
>   
>         ASEG 01100h
> 
>         ORG     01100h                  
> 
> RESET   mov.w   #0A00h,SP               ; Initialize 'F149 
> stackpointer
> StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
>         bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt
> 
>         ; ...more code
> 
>         ASEG 0fffeh
> 
>         ORG     0FFFEh                  ; MSP430 RESET Vector
>         DW      RESET                   ; 
>         END     
> 
> ///////////////////////////////////////////////////////////////
> // this produces a linker error:
> // 1.0.0/bin/hld: can't find an entry symbol (start or _main) 
> ///////////////////////////////////////////////////////////////
>         .DSECT "IDATA0"        
> 
>         ORG 0200h
> VZC     DS.W      2       ; last captured value in CCR2
>   
> ;------------------------ 
>         .PSECT "CODE"
>         ORG     01100h                  
> ;------------------------ 
> RESET   mov.w   #0A00h,SP               ; Initialize 'F149 
> stackpointer
> StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
>         bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt
> 
>         ; ...more code
> 
>         .PSECT "INTVEC"
> 
>         ORG     0FFFEh                  ; MSP430 RESET Vector
>         DW      RESET                   ; 
>         END     
> /////////////////////////////////////////////////////////////////
> 
> 
> ///////////////////////////////////////////////////////////////
> // this also produces a linker error:
> // 1.0.0/bin/hld: can't find an entry symbol (start or _main) 
> ///////////////////////////////////////////////////////////////
>         .DATA        
> 
>         ORG 0200h
> VZC     DS.W      2       ; last captured value in CCR2
>   
>         .CODE
>          ORG     01100h                  
> 
> RESET   mov.w   #0A00h,SP               ; Initialize 'F149 
> stackpointer
> StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
>         bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt
> 
>         ; ...more code
> 
>         .VECTOR
> 
>         ORG     0FFFEh                  ; MSP430 RESET Vector
>         DW      RESET                   ; 
>         END     
> /////////////////////////////////////////////////////////////////
> 
> ///////////////////////////////////////////////////////////////
> // and this produces another linker error:
> // "1.0.0/bin/hld: warning: IDATA0 overflows group--data ends 
> at 0x1462 // and group end" 
////////////////////////////////////////////////> ///////////////
>         .DATA        
> 
>         ORG 0200h
> VZC     DS.W      2       ; last captured value in CCR2
>   
>         .ROOT
>          ORG     01100h                  
> 
> RESET   mov.w   #0A00h,SP               ; Initialize 'F149 
> stackpointer
> StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
>         bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt
> 
>         ; ...more code
> 
>         .VECTOR
> 
>         ORG     0FFFEh                  ; MSP430 RESET Vector
>         DW      RESET                   ; 
>         END     
> /////////////////////////////////////////////////////////////////
> 
> Thanks for your help.
> 
> regards,
> Klaus
> 
> 
> 
> 
> ------------------------ Yahoo! Groups Sponsor 
> ---------------------~--> Rent DVDs Online - Over 14,500 
> titles. No Late Fees & Free Shipping. Try Netflix for FREE! 
> http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA> /CFFolB/TM
> 
> 
> --------------------------
> -------~->
> 
> .
> 
>  
> 
> ">http://docs.yahoo.com/info/terms/ 
> 
> 
> 

Reply by kbox2003 May 13, 20032003-05-13
Hi all,

I want to define variables in Crossworks assembler using the
DS directive. But always I get an error. I did several attempts
to define the sections, but none works as expected. 

What am i doing wrong? Please have a look at my attempts...

///////////////////////////////////////////////////////////////
// this compiles & links, but i get amessage box when 
// trying to upload: "section .abs is too big for target"
// The same happens when i omit all "ASEG" directives. When
// i remove the line
// "VZC     DS.W      2       ; last captured value in CCR2"
// everything works
///////////////////////////////////////////////////////////////
        ASEG 0200h       

        ORG 0200h
VZC     DS.W      2       ; last captured value in CCR2
  
        ASEG 01100h

        ORG     01100h                  

RESET   mov.w   #0A00h,SP               ; Initialize 'F149 stackpointer
StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
        bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt

        ; ...more code

        ASEG 0fffeh

        ORG     0FFFEh                  ; MSP430 RESET Vector
        DW      RESET                   ; 
        END     

///////////////////////////////////////////////////////////////
// this produces a linker error:
// 1.0.0/bin/hld: can't find an entry symbol (start or _main)
///////////////////////////////////////////////////////////////
        .DSECT "IDATA0"        

        ORG 0200h
VZC     DS.W      2       ; last captured value in CCR2
  
;------------------------ 
        .PSECT "CODE"
        ORG     01100h                  
;------------------------ 
RESET   mov.w   #0A00h,SP               ; Initialize 'F149 stackpointer
StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
        bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt

        ; ...more code

        .PSECT "INTVEC"

        ORG     0FFFEh                  ; MSP430 RESET Vector
        DW      RESET                   ; 
        END     
/////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////
// this also produces a linker error:
// 1.0.0/bin/hld: can't find an entry symbol (start or _main)
///////////////////////////////////////////////////////////////
        .DATA        

        ORG 0200h
VZC     DS.W      2       ; last captured value in CCR2
  
        .CODE
         ORG     01100h                  

RESET   mov.w   #0A00h,SP               ; Initialize 'F149 stackpointer
StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
        bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt

        ; ...more code

        .VECTOR

        ORG     0FFFEh                  ; MSP430 RESET Vector
        DW      RESET                   ; 
        END     
/////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////
// and this produces another linker error:
// "1.0.0/bin/hld: warning: IDATA0 overflows group--data ends at
0x1462 // and group end"
///////////////////////////////////////////////////////////////
        .DATA        

        ORG 0200h
VZC     DS.W      2       ; last captured value in CCR2
  
        .ROOT
         ORG     01100h                  

RESET   mov.w   #0A00h,SP               ; Initialize 'F149 stackpointer
StopWDT mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
        bic.b   #WDTIFG,&IFG1           ; clear WDT interrupt

        ; ...more code

        .VECTOR

        ORG     0FFFEh                  ; MSP430 RESET Vector
        DW      RESET                   ; 
        END     
/////////////////////////////////////////////////////////////////

Thanks for your help.

regards,
Klaus