AVRASM problem: addresses used in CSEG don't match DSEG

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

I've got a pretty frustrating problem with AVRSTUDIO 3.56 / AVRASM 1.56. Though the label addresses in data segment are absolutely correct, when instructions reference these labels, addresses in the resulting assembled code do not match. Not all of them, only labels above $200 seem to be offset. In the example below, PKTLEV is correctly assigned address $237 when parsing data segment, but instruction LDS TEMP,PKTLEV translates to LDS TEMP,$202. It seems that the first label with address above $200 (pktstm: $235) becomes $200 when parsing code segment, subsequent labels offset by the same value.

Anyone seen behavior like this before? What's wrong with the thing? Any workaround?

Mark

------------ DSEG

txhdrbuf:
0001b5 .byte 128
pktstm:
000235 .byte 1
pkthdr:
pktcmd:
000236 .byte 1
pktlev:
000237 .byte 1
pktpin:
000238 .byte 6
pktlen:
00023e .byte 2
pktcrch:
000240 .byte 1
pkthdrend:
.equ HDR_LEN=(pkthdrend-pkthdr+1)
sysflags:
000241 .byte 1
sysmode:
000242 .byte 1
databuf:
000243 .byte 128

------------ CSEG

0004ec 9100 0202 lds temp,pktlev
0004ee 3003 cpi temp,LEV_FCT
0004ef f499 brne _EndFlashLevel
0004f0 9100 020d lds temp,sysmode
0004f2 3005 cpi temp,MOD_FLASH
0004f3 f489 brne _EndFlashCRCBad