Hi,
I wrote a program that should create an square wave using an assembly macro, with the asm keyword in C. I am using 64 "NOPs" with a MCU running 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 is this happening? And how can I fix this?
This is the code I am using:
PORTB &= ~(1<<PB3); //Sets pin PB3 LOW asm("Delay4"); asm("Delay4"); asm("Delay4"); asm("Delay4"); asm("Delay4"); asm("Delay4"); PORTB |= (1<<PB3); //Sets pin PB3 HIGH asm("Delay4"); asm("Delay4"); asm("Delay4"); PORTB &= ~(1<<PB3); //LOW
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.
Thank you
NOTE: Please accept my apologizes for double posting the same question. But someone was spamming my other thread, and it suddenly got off-topic. The other thread is probably going to be deleted soon.