[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] ASM Label address problem

From: Steven Bromley
Subject: [avr-gcc-list] ASM Label address problem
Date: Sat, 18 Sep 2004 16:41:29 +1200

Hey all,


Here is a small piece of code I’m having trouble with:


  subi ZL,pm_lo8(-.Last+6)

  sbci ZH,pm_hi8(-.Last+6)


  ... more code here ...




  ... more code here ...



My intention is to add (.Last-6) to Z (where .Last is a just a label in the
code).  Since the AVR instruction set doesn’t provide us with "addi"/"adci"
I must use subi/sbci instead.  No problems there.


The trouble arises when I attempt to subtract from .Last producing a
negative address, to which the compiler generates:


  Error: can't resolve `0' {.text section} - `.Last' {.text section}


I realise I could expand the code so I don’t need the subtraction, but at
the cost of more cycles and ROM.  Eg:


  ldi YL,pm_lo8(.Last-6)

  add ZL,YL

  ldi YL,pm_hi8(.Last-6)

  adc ZH,YL


I would much prefer just to use first block of code though.  Does anyone
have a solution to this?

BTW, I’m using WinAVR-20040720.



Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.760 / Virus Database: 509 - Release Date: 10/09/2004

reply via email to

[Prev in Thread] Current Thread [Next in Thread]