Pages: [1]   Go Down
Author Topic: Attempting to use software serial anywhere in code causes freeze on startup.  (Read 488 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm wondering if this might be toolchain problems again, as I've had a similar freezing issue before, and it turned out to be toolchain problems. Does anyone have an exact version number of toolchain to give me that definitely works?


Anyway, as for the actual problem - basically, when I attempt to use the software serial library in my project, no matter where I use it/how much delay I have beforehand, it always freezes as soon as the Arduino starts up. I tried literally modifying a working hardware serial example to use software serial and changing nothing else, among many other things. I'm using avr-gcc (Gentoo 4.5.3-r1 p1.0, pie-0.4.5) 4.5.3 on 32-bit Gentoo. Any ideas?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Welcome to the club smiley-grin
In my case it's the ethernet which is not working. I think in your case it might be the wrong version of binutils. Try binutils < 2.20.1 and see if that solves your problem.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah - verified, definitely works on Windows. So, I got someone to tell me the versions of GCC, Binutils and libc used in the Windows version, so I set those to install last night and will test it when I get back from college. Thanks smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm very curious if you will be able to get it working. I tried many combinations and still no luck on linux smiley-cry
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Firstly, I'd like to say that whatever the font is in the post reply box, I hate it - os look like 0s in normal fonts, and 0s and Os both look like Os with very little difference...

Anyway, ontopic: this is crazy. I tried as close to the Windows version as I could get with my distro's packages. Nothing. Still freezing.

muzer@muzer-netbook ~/arduino-1.0 $ avr-gcc --version
avr-gcc (Gentoo 4.3.6-r1 p1.0, pie-10.1.5) 4.3.6
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

muzer@muzer-netbook ~/arduino-1.0 $ avr-ld --version
GNU ld (GNU Binutils) 2.19.1
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
muzer@muzer-netbook ~/arduino-1.0 $


avr-libc 1.6.4

Here's the compilation log, there is a rather suspect warning relating to SoftwareSerial there that I wonder if it's causing the problem:

http://pastebin.com/uC51u7Tt

Going to continue trying various things...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An older verison of gcc doesn't work. An older version of binutils is impossible because any older than that and it doesn't support the necessary processor. There's one last thing I can try - grab the sources, manually apply every patch from the Windows distribution, give that a try. That's what I am going to do, starting with binutils as it's quickest to compile and I think most likely to be the problem.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SUCCESS! Here's what I did:

* I used these instructions as a guide: http://www.nongnu.org/avr-libc/user-manual/install_tools.html

* I found the exact versions used in the Windows version - these are binutils 2.19 (not 2.19.1), gcc 4.3.2, and avr-libc 1.6.4

* I patched these versions with most of the patches found in the Windows version of the libraries. The patches can be found in the source directory in this Windows package (can be extracted with 7z): http://sourceforge.net/projects/winavr/files/WinAVR/20081205/WinAVR-20081205-install.exe/download (note that if you're extracting with 7z and also building in the same tree, you should rename the $HWNDPARENT directory as the dollar caused me a LOT of problems with gcc compilation). Note how I said "most of the patches" - some patches actually made the build fail. The ones I remember in particular that did this were binutils patches 50 and 51, but there might have been more that I've forgotten. If you don't know how to patch files, it's something along these lines:
** Extract the archive for the package you're patching (tar -xvf package-name-version.tar.bz2)
** Change into the resulting directory (cd package-name-version)
** Use the patch utility to patch the files - most of these patches need -p0 (patch -Np0 -i path/to/file.patch). One of the patches (31-binutils-2.19-avr-coff.patch), however, needed -p1 instead of -p0, and also needed telling where one of the files was as the filename was wrong (had .orig after it in the patch). This should be pretty self-explanatory (just type out the filename it gives you minus the .orig)

* I first installed binutils using the guide. This didn't fix the problem.

* I then installed gcc using the guide. This then caused lots of compilation errors about missing libraries. So:

* I finally installed avr-libc using the guide, compiled my test project, uploaded it... IT WORKS!!!
Logged

Pages: [1]   Go Up
Jump to: