rcall "out of range" problem

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all AVR users

The problem is as follows (AVR Studio 4.08 @ mega64/128) :
When using "rcall" to call a subroutine you will get a problem when program gets larger and larger and flash adress locations of subroutine and rcall instruction has a larger distance than 4k. If this happens, rcall is out of range (must use call instead) BUT : AVR assembler does not give any error message or warning !!!!!
The result is that the out of range rcall jumps to a unknown (or msb bits just cleared) location and program unusally hangs og do strange things.
When debugging this have given me hours of search for fail since you often work with caode that (undebugged) may give simular result....

I have asked for a solution bouth from Atmel in Trondheim and Atmel main support center and have got no understanding at all for this problem, Atmel in US didnt see this as a problem at all !! Then, why did ass. give error mess. on rjmp out of range ???

I wonder if anyone have heard of a solution to the out of range rcall instructions. .
When programming I try to create routines as objects that I can use in later designs and that makes this problem bigger.
And, please do not tell me to use a C compiler ;)

Sorry 4 writing this much :)

BR
Morten Bogevik @ Megacon AS

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AStudio 3.56 does not give an error message, so if you don't need any new version 4 features, use 3.56! 4 has lots of bugs.

Christoph

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In Studio 4.8 click 'Project' then 'AVR Assembler setup' then clear the 'Wrap relative jumps' box.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not just
rcall flipper
flipper:
jmp rcalladdress
... ; In a galaxy far far away
rcalladdress:
code ...
ret

It uses only a single extra line of code. "ret" should react normally, don't see any reason why not.

-Curiosity may have killed the cat
-But that's why they have nine lives

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But then why not use call instead of rcall in the first place?

When I program, I usually use rcall for local calls within the same includefile, and call for all external calls.