Tuesday, October 09, 2007

Avr32 Studio and .d files

Has been some time since I wrote this, so it's high time for publishing it ...!
There seems to be a problem with the Atmel AVR32 studio. It is based on eclipse, to develop C/C++ software for the embedded AVR32 chips.
The following error message is (often) given, when a project is recompiled:
make -k all
src/main.d:1: *** multiple target patterns. Stop.
Build complete for project aixC-BoxFirmware
This usually happens when the previous build was not successful, b/c one ore more files could not be compiled.
The reason seems to be the following line in the automatically generated Debug/src/*.d files:
src/main.d src/main.o: ../src/main.cpp ...
It seems, make is not really able to cope with the multiple main.d main.o: statement ...?
The .d files are responsible for checking all file dependencies, i.e., which files need to be recompiled if one header has been changed.
After a clean, which deletes *.d, a full build works.
avr32-linux-gcc is called with the parameters
-MMD -MP -MF"src/main.d" -MT"src/main.d"
which means:
Generated src/main.d (-MF) with the target src/main.d (-MT), for all user include files, and compile the source (-MMD), and generate phony targets for depended files (-MP).
So, theoretically, only
src/main.d: ...
should appear in the src/main.d file ...
1. Delete all .d files before recompiling
not nice ... looses all dependency information
2. Fix the generated .d files
The following, a bit obscure sed command can be run inside Project/Debug to fix the .d files.
find . -name '*.d'|xargs sed -ie 's#\.d src/[^/]\+/[^ /\.]\+\.o:#.d:#g'
// do I need .d or .o?
The real problem seems to be s.th. else ... the makefile itself (src/subdir.mk) has a rule for building src/main.o from src/main.cpp, and the .d file contains another rule ... strange version of make ...?
The real problem is the inclusion of C:/home/Projekte/Avr32/aix-AVR32-libs/libserial-0.5.2/src/
which gives the other ":" that raises the error ...
1. use a relative path
2. use make 3.80 ...
This error is usually encountered in other situations:
1. a file name contains spaces (windows makes, mostly)
2. a file name contains : (windows again ;-)
Have fun,
See also
You've run into one of our known issues:
Bug #5452
Referencing external folders in managed make projects when using GNU make 3.81 causes build failures. This is caused by GNU make no longer supporting Windows-style path names. GNU make 3.80 works as expected.
The known issues are described in the release notes, which are available on atmel.com. They are also included in the AVR32 Studio Help.
Note that the release notes were not available on the website until quite recently, and the links in the Welcome page appear to be buggy, so I'm not blaming you for not reading them. This will be addressed for the 1.0 release.
Run the cygwin setup.exe and try to downgrade Make to 3.80, that should help.

No comments: