Hi,
Whilst trying to do some assembly-only coding I ran into an (probably PEBKAC)
issue. I have this simple file called foo.S:
-----8<-----
#include <msp430.h>
;------------------------------------------------------------------------------
; Main Code
;------------------------------------------------------------------------------
.text ; program start
.global _main ; define entry point
_main: mov.w #0280h,SP ; initialize stack pointer
mov.w #WDTPW|WDTHOLD,&WDTCTL ; stop watchdog timer
bis.b #01000001b,&P1DIR ; make P1.0 and P1.6 output
; all others are inputs by default
Mainloop: bit.b #00001000b,&P1IN ; read switch at P1.3
jc Off ; if P1.3 open branch to Off label
On: bic.b #00000001b,&P1OUT ; clear P1.0 (red off)
bis.b #01000000b,&P1OUT ; set P1.6 (green on)
jmp Wait ; branch to a delay routine
Off: bis.b #00000001b,&P1OUT ; set P1.0 (red on)
bic.b #01000000b,&P1OUT ; clear P1.6 (green off)
Wait: mov.w #1834,R15 ; load R15 with value for delay
L1: dec.w R15 ; decrement R15
jnz L1 ; if R15 is not zero jump to L1
jmp Mainloop ; jump to the Mainloop label
;------------------------------------------------------------------------------
; Interrupt Vectors
;------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short _main
.end
-----8<-----
Afaics this code is correct, though gcc disagrees:
$ msp430-gcc -g -Os -mmcu=msp430g2213 cstack.S -o cstack.o
cstack.S: Assembler messages:
cstack.S:13: Error: backward ref to unknown label "262145:"
cstack.S:16: Error: backward ref to unknown label "512:"
cstack.S:19: Error: backward ref to unknown label "1:"
cstack.S:20: Error: backward ref to unknown label "262144:"
cstack.S:23: Error: backward ref to unknown label "1:"
cstack.S:24: Error: backward ref to unknown label "262144:"
$
Anyone with a cluebat?
Also, is the explicit stack pointer initialization needed with gcc or will it
do this automagically?
--
Cheers,
Jasper
"Capable, generous men do not create victims, they nurture them."
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users