I’m trying to compile grbl (using avr-gcc 4.5.3 and avr-libc 1.7.1) but when I try to make the files from the repositories, I always get this error. It happens on every version of grbl.
avr-gcc -Wall -Os -DFCPU=16000000 -mmcu=atmega328p -I. -ffunction-sections -c motioncontrol.c -o motion_control.o
In file included from motion_control.c:26:0:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h: In function ‘mc_dwell’:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:153:28: error: _builtinavrdelaycycles expects an integer constant.
make: *\ [motion_control.o] Error 1
Any suggestions?
评论 (9)
#2 – chamnit 于 2011-12-08
Take a look at my grbl fork. I’ve effectively picked up the torch, as Simen has been busy with other things. A lot of lingering bugs have been fixed and improvements have been made to v0.7, which is now master status.
FYI, a new v0.8 version with run-time commands (decelerating feedhold, resume, reset, jogging(TBD)) will be released later tonight. This is an alpha release.
#3 – TheExtraPiece 于 2011-12-08
I just checked out your fork, but it seems to have the same problem. I looked into it a bit more, and it seems that it is due to a change in avr-libc. As of v1.7.1 it is not possible to use variables with the delay functions. Apparently you weren’t supposed to do this with previous versions anyways, but now it is being enforced due to a change in how delays are implemented.
You’re probably using an older version of the library, so you don’t get this error. It’s really quite trivial to fix, I just added a couple of inline functions to nutsbolts to mimic the old functionality of delayms() and delay_us(). The function that Identy suggested above does the trick, and it seems to be what most people are using.
#4 – identy 于 2011-12-10
#5 – chamnit 于 2011-12-10
Good to know! I haven’t run into this problem, as I pretty much exclusively use the avrdude compiler that comes the Arduino software. It sounds like it still supports the variable in the delay. I’ll try to work a fix in when I get some time.
#6 – jes1510 于 2012-02-04
I am having the exact same problem with the latest versions in Master and Edge.
avr-gcc -Wall -Os -DFCPU=16000000 -mmcu=atmega328p -I. -ffunction-sections -c motioncontrol.c -o motion_control.o
avr-gcc -Wall -Os -DF_CPU=16000000 -mmcu=atmega328p -I. -ffunction-sections -c limits.c -o limits.o
In file included from limits.c:21:0:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h: In function ‘homing_cycle’:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:230:28: error: _builtinavrdelaycycles expects an integer constant.
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:230:28: error: _builtinavrdelaycycles expects an integer constant.
make: *\ [limits.o] Error 1
#7 – chamnit 于 2012-02-04
Thanks! Looks like I missed the delayus() calls when I had fixed it for the delayms(). I’ll issue a fix for this later today. If you want to fix it immediately, look in nutbolts.c and repeat the same procedure as did with delay_ms().
#8 – jes1510 于 2012-02-09
Thanks that fixed it. For completeness I changed it to this in limits.c:
delayus(settings.pulsemicroseconds);
STEPPINGPORT ^= outbits & STEP_MASK;
delayus(stepdelay);
and I added this function to nuts_bolts.h:
void delayus(uint16t us)
{
while (us–) { delayus(1);}
}
#9 – chamnit 于 2012-02-09
Good to hear. Sorry that I didn’t post the fix when I stated. I’ve been sidetracked with other things. When I finally get this next edge push out, I’ll make sure to update the master branch with this fix.
#1 – identy 于 2011-12-07
edit included file motion_control.c
void mcdwell(uint32t milliseconds)
{
st_synchronize();
delay_ms(milliseconds);
}
/\ function for long delay /
void delayms(uint32t ms) {
while ( ms )
{
delayms(1);
ms–;
}
}
I Think, probe :-/