Updated C30 build script for Ubuntu 10.04
by matt on May.03, 2010, under News
Ubuntu 10.04 is hot off the press, so I have uploaded an update to the C30 build script to run on it. Apparently the dos2unix command is no longer supported in 10.04 so the script now uses fromdos (thanks to Nicolas for the info).
Latest version of the script can be found here: http://www.electricrock.co.nz/blog/microchip-c30/
May 20th, 2010 on 8:57 am
The compiler tosses a boat load of error messages with the simple test.c – below is the output from the gcc with a -v. Anyone know what I missed? Thanks
mlucia@sloop:~/pic/c30-compiler$ pic30-coff-gcc-4.0.3 -v -S -o test.s -mcpu=30f4013 test.c
Using built-in specs.
Target: pic30-coff
Configured with: ../gcc-4.0.2/gcc-4.0.2/configure –prefix=/usr/local –target=pic30-coff –enable-languages=c
Thread model: single
gcc version 4.0.3 (dsPIC30, Microchip v3.23-Debian) Build date: May 13 2010
/usr/local/bin/../libexec/gcc/pic30-coff/4.0.3/pic30-coff-cc1 -quiet -v -iprefix /usr/local/bin/../lib/gcc/pic30-coff/4.0.3/ test.c -mresource=/usr/local/bin/../lib/gcc/c30_device.info -quiet -dumpbase test.c -mcpu=30f4013 -auxbase-strip test.s -version -o test.s
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/sys-include”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/include”
ignoring duplicate directory “/usr/local/lib/gcc/pic30-coff/4.0.3/include”
ignoring nonexistent directory “/usr/local/lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/sys-include”
ignoring nonexistent directory “/usr/local/lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/include”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/include”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/support/generic/h”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/support/dsPIC30F/h”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/support/peripheral_30F_24H_33F”
#include “…” search starts here:
#include search starts here:
/usr/local/bin/../lib/gcc/pic30-coff/4.0.3/include
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/include
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/generic/h
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/dsPIC30F/h
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/peripheral_30F_24H_33F
End of search list.
GNU C version 4.0.3 (dsPIC30, Microchip v3.23-Debian) (0) Build date: May 13 2010 (pic30-coff)
compiled by GNU C version 4.4.3.
GGC heuristics: –param ggc-min-expand=100 –param ggc-min-heapsize=131072
In file included from test.c:1:
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/dsPIC30F/h/p30f4013.h:71: error: syntax error before ‘__attribute__’
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/dsPIC30F/h/p30f4013.h:72: error: syntax error before ‘__attribute__’
May 21st, 2010 on 8:45 am
Hi Mark,
This seems to be the same problem encountered by Peter here. As far as I can surmise, it is related to the toolchain building the compiler. Which distro are you using? If nothing else, upgrading to a clean install of Ubuntu 10.04 and rebuilding the compiler should help.
~ Matt
May 22nd, 2010 on 12:45 pm
Yep – That is with Ubuntu 10.04 – and it is a fresh install, not an upgrade
Thanks for the reply
May 24th, 2010 on 8:57 am
Hmm… strange, it should just work then. Which architecture are you using, i386 or amd64?
June 29th, 2010 on 6:09 pm
Hey matt,
I seem to be having the exact same issue as Mark.
I am using Ubuntu 10.04
$ pic30-coff-gcc –version
pic30-coff-gcc (GCC) 4.0.3 (dsPIC30, Microchip v3.23-Debian) Build date: Jun 29 2010
__C30_VERSION__ == 323
Copyright (C) 2005 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.
$ gcc –version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 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.
$ uname -a
Linux indiana 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 i686 GNU/Linux
Using built-in specs.
Target: pic30-coff
Configured with: ../gcc-4.0.2/gcc-4.0.2/configure –prefix=/usr/local –target=pic30-coff –enable-languages=c
Thread model: single
gcc version 4.0.3 (dsPIC30, Microchip v3.23-Debian) Build date: Jun 29 2010
/usr/local/bin/../libexec/gcc/pic30-coff/4.0.3/pic30-coff-cc1 -quiet -v -iprefix /usr/local/bin/../lib/gcc/pic30-coff/4.0.3/ test.c -mresource=/usr/local/bin/../lib/gcc/c30_device.info -quiet -dumpbase test.c -mcpu=30f4013 -auxbase test -version -o /tmp/ccnNzez4.s
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/sys-include”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/include”
ignoring duplicate directory “/usr/local/lib/gcc/pic30-coff/4.0.3/include”
ignoring nonexistent directory “/usr/local/lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/sys-include”
ignoring nonexistent directory “/usr/local/lib/gcc/pic30-coff/4.0.3/../../../../pic30-coff/include”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/include”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/support/generic/h”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/support/dsPIC30F/h”
ignoring nonexistent directory “/usr/local/bin/../lib/gcc/../../pic30-nonfree/support/peripheral_30F_24H_33F”
#include “…” search starts here:
#include search starts here:
/usr/local/bin/../lib/gcc/pic30-coff/4.0.3/include
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/include
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/generic/h
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/dsPIC30F/h
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/peripheral_30F_24H_33F
End of search list.
GNU C version 4.0.3 (dsPIC30, Microchip v3.23-Debian) (b) Build date: Jun 29 2010 (pic30-coff)
compiled by GNU C version 4.4.3.
GGC heuristics: –param ggc-min-expand=98 –param ggc-min-heapsize=128098
In file included from test.c:1:
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/dsPIC30F/h/p30f4013.h:71: error: syntax error before ‘__attribute__’
…..
/usr/local/bin/../lib/gcc/../../share/pic30-nonfree/support/dsPIC30F/h/p30f4013.h:2121: error: syntax error before ‘__attribute__’
test.c: In function ‘main’:
test.c:6: error: syntax error before ‘{’ token
July 8th, 2010 on 8:33 am
You might need to update your script slightly? they are now on v3.23B, and some of the files aren’t available (unless I just can’t find them).
Distribute binaries … please? The Windows C30 compiler is so unbearably slow.
July 8th, 2010 on 9:27 am
Yeah, sorry for the lack of updates recently, it’s been a busy time for me. Anyway, I have updated the install script… see here.
July 8th, 2010 on 9:32 am
Paul, I built C30 v3.23b on Ubuntu 10.04 i386 and tried running the test script. However, I haven’t yet been able to replicate this error. I intend to put up some binaries when I have time to make them, which should hopefully mitigate the problem.
July 8th, 2010 on 8:32 pm
Wow, you already fixed it. I don’t use the term “hero” often … but here …
Anyhow, I was installing it to /opt/pic30/ as a regular user on Ubuntu 10.04 x86 32bit. It only seemed to work if I commented out the SUDO line and started with a completely empty /tmp/c30, though.
Now to port all the absolute paths of the MPLAB outputted Makefile into relative paths, and see if it works. Unless you can recommend sort of clever automake setup?
July 9th, 2010 on 10:06 am
Cheers Andrew. I will look into your issue with using alternative directories.
I don’t know if MPLAB does anything special in its makefiles, but I have tended to use piklab which has taken care of the build stages automatically. I have quickly thrown together a generic Makefile (http://www.electricrock.co.nz/blog/microchip-c30/#makefile), which you could give a shot. I have briefly tested it with an old project I had lying around and it complied successfully.
In terms of automake, I have little experience with it but I think it’s overkill because you don’t really need automated installing or to deal with building on lots of different systems.
August 9th, 2010 on 9:46 am
I’m getting the same error as Paul, lots of “syntax error before __attribute__” lines. It looks like the C30 V3.23b as compiled by your latest script somehow doesn’t know about __attribute__ directives. I haven’t been successful in working out why
January 21st, 2011 on 12:49 am
Hi,
first of all thanks a lot for all the work you did to make the C30 work with Linux!
I had the same \syntax error before __attribute__\ and found a solution to fix it (that works at least for me). I used versions 3.23, 3.23b and 3.25 and always got the same problem.
The error is in file gcc/c-parse.y. Instead of using the tofrodos utilities, I defined my own dos2unix function as
tr -d ‘
‘ outfile
but this is not enough with c-parse.y. In fact, apart from the wrong DOS line endings, c-parse.y also has some ^L characters that should not be there because they seem to confuse bison. If you remove them, the error disappears.
I hope someone will find this useful. Thanks a lot again for all the info you published. You helped me a lot in these days. Keep up the good work!
January 21st, 2011 on 8:50 am
Thanks ilPincy. I have yet to try out your solution to the __attribute__ problem, but if it works then this will make a lot of people happy as it was a common problem.
April 13th, 2011 on 4:30 am
Works here, there were a few 0xff in the file (c-parse.y), I removed them by hand and also ran dos2unix (for safety).
Thanks ilPincy! I think I have a working pic24/30 toolchain by now.