Welcome! Log In Create A New Profile

Advanced

Compiling Teacup Firmware, Maybe is a stupid problem...

Posted by alfalover 
Compiling Teacup Firmware, Maybe is a stupid problem...
May 07, 2011 03:51PM
Hello everyone,

I am trying to compile Teacup firmware, after read that it doesn't works on arduino ide, I started my ubuntu
and install avr-libc and gcc-avr.

But...

once I run make command i receive next error :

CC mendel.o
CC dda.o
CC gcode_parse.o
CC gcode_process.o
In file included from gcode_process.c:13:
delay.h:5:27: error: avr/builtins.h: No such file or directory
make: *** [gcode_process.o] Error 1

I'm sure that i miss a step... ,

Really I really sorry to open a topic with this , but I spent 3 hours looking at google... and I didn't found anything

In my /usr/lib/avr/include/avr folder do not exits buitins.h

Any help will be apreciated.
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 07, 2011 04:07PM
I answer myself ...

avr/builtins.h is an WinAvr path over avr-libc

I Just copy this file from a WinAVR installation to /usr/lib/avr/include/avr/builtins.h and it works, now I can compile it.

Is this ok?
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 07, 2011 05:18PM
you may want to reinstall or update your avr-libc which should provide that file. I'm using avr-libc-1.7.0


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 07, 2011 08:13PM
alfalover Wrote:
-------------------------------------------------------
> Hello everyone,
>
> I am trying to compile Teacup firmware, after
> read that it doesn't works on arduino ide,

Where did you read that? It works perfectly with the Arduino IDE. Just make sure the folder matches the .pde file.

The file is called "Teacup_Firmware.pde"
But the folder will be named something like "triffid_Teacup_Firmware_ee48186"
Rename the folder "Teacup_Firmware"
Put the folder in your sketchbook
Open Arduino IDE


FFF Settings Calculator Gcode post processors Geometric Object Deposition Tool Blog
Tantillus.org Mini Printable Lathe How NOT to install a Pololu driver
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 08, 2011 03:36AM
Thanks for yours replies , maybe Ubuntu repository don't have last avr-libc version. I will check it.

I renamed the folder to Teacup_Firrmware but I didn't "put it in my skechbook" I put it at C:\Teacup_Firmware\ , when i try to compile it i receive an error like C99 for loop ..

I should say that I never use Arduino Ide before...

I check these two things and report some just if another found problems like these.

Best Regards
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 08, 2011 09:40AM
Nop , I move my Teacup_Firmware folder to /arduino_0022/examples/Teacup_Firmware and I receive the same error :

C99 mode
/delay.h: In function 'delay_ms':
delay.h:71: error: 'for' loop initial declaration used outside C99 mode

meanwhile on my ubuntu the avr-libc version is 1.6.8 , I downloaded and updated to 1.7.1, and it works perfectly , thanks Triffid
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 08, 2011 12:39PM
I'm afraid the C99 mode error is my fault. I submitted a patch that did not compiler under the Arduino compiler (I did not realize that at the time).

I've pushed a patch to fix the problem, which no doubt Triffid will integrate soon (or otherwise fix it). In the meantime you can replace the contents of the delay.h file with the following:

#ifndef	_DELAY_H
#define	_DELAY_H

#include	
#include 	
#include	"watchdog.h"
#include	

// WAITING_DELAY is expressed in microseconds
#define		WAITING_DELAY		10000

// Force delay functions to be inlined. 
// Otherwise they will not work correctly. 
static inline void delay_us(uint16_t us) __attribute__((always_inline));
static inline void delay(uint32_t delay) __attribute__((always_inline));
static inline void delay_ms( uint16_t delay ) __attribute__((always_inline));

// Delay for a minimum of us microseconds. 
// The parameter us MUST be a compile time constant.
// A compiler error will be issued in the case that 
// it is not.

void delay_us(uint16_t us)
{
	// The floating point calculation will 
	// be completed during compilation, so
	// there is no runtime floating point
	// code generated.
    uint32_t cycles = ceil( (double)F_CPU * us / 1000000.0 );
    __builtin_avr_delay_cycles(cycles);
}

// Delay for a minimum of us microseconds.
// If the watchdog functionality is enabled
// this function will reset the timer before
// and after the delay (and at least once every
// 65536 microseconds).
//
// This function is forced (see declaration above) to be inlined.
// The parameter us MUST be a compile time constant.
// A compiler error will be issued in the case that 
// it is not.
void delay(uint32_t us)
{
    wd_reset();
    int i;
    for( i = 0; i < us/65536; i++ )
    {
        delay_us(65535);
        delay_us(1);
        wd_reset();
    }
    if( us%65536 )
    {
        delay_us(us%65536);
        wd_reset();
    }
}

// Delay for a minimum of ms milliseconds.
// If the watchdog functionality is enabled
// this function will reset the timer before
// and after the delay (and at least once every
// 65000 microseconds).
//
// This function is forced (see declaration above) to be inlined.
// The parameter us MUST be a compile time constant.
// A compiler error will be issued in the case that 
// it is not.
void delay_ms( uint16_t ms )
{
    wd_reset();
    uint16_t i;
    for( i = 0; i < ms/65; i++ )
    {
        delay_us(65000);
        wd_reset();
    }
    
    if( ms%65 )
    {
        delay_us((ms%65536)*1000);
        wd_reset();
    }
}

#endif	/* _DELAY_H */

I've verified that the above compiles under Arduino0022. Sorry about that.

Edited 1 time(s). Last edit at 05/08/2011 12:48PM by madscifi.
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 09, 2011 02:46AM
Quote

I'm afraid the C99 mode error is my fault. I submitted a patch that did not compiler under the Arduino compiler (I did not realize that at the time).

Applied that patch yesterday, so things should compile now. Please update your sources.

However, I get a linking error:
Teacup_Firmware/delay.h:30: undefined reference to `__builtin_avr_delay_cycles'


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 09, 2011 03:28AM
... and yes, relying on builtins.h breaks compatibility with Ubuntu's avr-libc, which is 1.6.8. Not good.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 09, 2011 10:21PM
In hope that I can avoid submitting patches that break the firmware in the future I have the following question:

What environments and versions are people using to compile Teacup?

WinAVR-20100110
Arduino-0018 (windows) with avr-libc 1.6.4
Arduino-0022 (windows) with avr-libc 1.6.4
GCC-AVR (ubuntu/linux) with avr-libc 1.6.8

Is anyone using anything else? Specifically, is anyone using a version of avr-libc that is older than 1.6.4? Is anyone using an older version of the Arduino environment?

Thanks,
--Jim
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 10, 2011 03:03AM
Assuming the Arduino IDEs with the same release number but for different platforms use the same avr-lic version, you're probably on the right track. And thanks for making things more compatible. smiling smiley


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 12, 2011 04:15PM
Hello Again...

I finally flash succesfully with the next command :

avrdude -v -c stk500v2 -p m644 -b 115200 -U flash:w:mendel.hex

but once I start reprap it seems that don't found board (Gen7 board).


C:\Program Files\RepRap>java -cp ".\reprap.jar;.\RXTXcomm.jar;.\j
d-org-java3d-all.jar;.\j3dutils.jar;.\swing-layout-1.0.3.jar;.\ve
mx1024M org/reprap/Main
DEBUG: The distribution preferences file and yours match. This i
/-1305235902383ms]
DEBUG: GCode opening port COM6 [0,062s/62ms]
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
DEBUG: Attempting to initialize Arduino/Sanguino [1,811s/1749ms]
comms: G-code: N0 M110 *3 dequeued and sent [3,839s/2028ms]

any hint ?


Many thanks....
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 12, 2011 07:30PM
try with a serial terminal. what baud rate are you using? does it match the one in your config.h?


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 13, 2011 12:46AM
I trying Arduino IDE serial terminal, at 115200, In theory the baudrate of Teacup Firmware.

I'dont have a USB-TTL board but i have a MAX232N board from other project , I think it works ok because I am able to upload firmware and verify it.

This morning I enable #define DEBUG at firmware and when i write M104 I receive something unreadable like {x{x{x{x{ (where x are caracters upper than 128 at ascii table.

Next thing i want to try is print "hello" or "hola" from firmware to ensure the correct baudrate....
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 13, 2011 01:23AM
firmware already sends "start" when it begins, and is probably trying to say 'unrecognised command' or something like that in response to your messages.

you could try setting the baud to a lower value and see if it works better.. in theory, 76800 baud should work best with a 16MHz crystal, see the atmega datasheet for a table of clock frequencies and baud rates


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 13, 2011 05:21AM
Ok, My Atmega is running at 20 MHz, i will check baud rate generator settings on Atmega 644 datasheet and see what is already setted...

Thank you
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 13, 2011 03:55PM
Make sure you have F_CPU set right in config.h. Also in the Makefile, if you use that.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: Compiling Teacup Firmware, Maybe is a stupid problem...
May 19, 2011 07:53AM
You were right, my F_CPU setting was wrong .
Sorry, only registered users may post in this forum.

Click here to login