asm macro error

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

Hi,

I wrote a program that should create an square wave using an assembly macro (just to see how it worked), using the asm keyword in C. I am using 64 "NOPs" at 16MHz.
It works just fine, but if I call several times the same macro I get the following error:

/tmp/ccQo9mux.o: In function `main':
/home/luis/project.c:103: relocation truncated to fit: R_AVR_7_PCREL against `no symbol'
make: *** [project.hex] Error 1

What does this mean?

Thanks!

Last Edited: Fri. Feb 12, 2010 - 07:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Line 47 of your code is wrong.

Regards,
Steve A.

The Board helps those that help themselves.

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

lcruz007 wrote:
What does this mean?
It means that you have too much code between the relative jump/branch and the destination. If you're using rjmp, change it to jmp. If you're using a conditional branch, use the opposite sense of the branch to branch over a jmp back to the top of the loop.

It would help, of course, if you could show some actual code. That way, we don't have to guess what may be happening.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

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

Alright, this is the code I am using:

           PORTB &= ~(1<<PB3);
               asm("Delay4");
               asm("Delay4");
               asm("Delay4");
               asm("Delay4");
               asm("Delay4");
               asm("Delay4");
               PORTB |= (1<<PB3);
               asm("Delay4");
               asm("Delay4");
               asm("Delay4");
               PORTB &= ~(1<<PB3);

The Delay4 macro are just 64 NOPs...

asm(".MACRO Delay4\n\t"
"NOP\n\t ; NO Operation"
...
//64 NOPs
".ENDM\n\t");

This code works just fine, but if I call the macro more times, I get that error. I am not using jmp or rjmp to go back to the macro, I just call it.

@Koshchi : Line 47 is one of the macros I am calling.

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

Admins please ban the clown's account.

[I coudn't do that - though if he appears again I'll ask eivind to do it but I have removed the 5 posts that the idiot from the Honduras (190.53.73.3) made to this thread - Cliff]

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.