Pages: [1]   Go Down
Author Topic: Getting OneWire and DallasTemperature to work with ATtiny core  (Read 542 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a feeling there's something basic I'm missing... I'm trying to get OneWire.h and DallasTemperature.h to compile when, in the Arduino software, I set the board to any of the ATtiny84 and ATtiny85 choices.  It works fine when putting projects together on the Uno, but transferring those projects to the ATtiny chips isn't working.

Platform: Mac OSX 10.6.8
Software: Arduino 1.0.4
ATtiny core is from http://code.google.com/p/arduino-tiny/.  (the only one I saw is for Arduino 1.0.1, so that's what I'm using)

Thus far I haven't found any posts on the subject, so I'm wondering if there's an addition to this core I'm missing to make this work.  For example, when running the Simple sketch from the DallasTemperature library, the error I'm getting is this:


Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn84.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25/libgcc.a(_exit.o)

Thanks,
Tom
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe this fix for sketches > 4kb could help?

https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 121
Posts: 4598
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn84.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25/libgcc.a(_exit.o)

That's a linker bug. You need to update your compiler. Download WinAVR and copy the contents of the 'bin' folder to the corresponding folder in your Arduino installation.

Logged

No, I don't answer questions sent in private messages...

Leeds, UK
Online Online
Edison Member
*
Karma: 72
Posts: 1642
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The fix Erni mentions will do the trick smiley
Logged

~Tom~

Seattle, WA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Indeed, that fixed the issue - thanks!

For others needing to do this, the file does come over as extensionless, and that's ok.  When you move it into the intended directory, in the Mac OS it may show up as a TextEdit or a Terminal application, and it may not be recognized as a unix executable file.  The trick is to change the file permission to "user executable".  This is how I did it:

1. Get Info on the ld file in your finder window
2. Copy the file path in the Where: field
3. Open a Terminal Window
4. Type "cd" followed by a space and paste the file path text, then hit return
5. Type "chmod u+x ld" and hit return
6. Restart your Arduino application and the code should compile.
Logged

Seattle, WA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

One more thing... I believe the ATtiny chips (at least the 84 and 85) need to have the 8MHz or higher boards used.  I wasn't able to get it to run on 1MHz but it runs swimmingly on 8MHz.  Thanks to Jack Christensen for helping me with that one!
Logged

Pages: [1]   Go Up
Jump to: