Shop OBEX P1 Docs P2 Docs Learn Events
propgcc running on OS X Lion — Parallax Forums

propgcc running on OS X Lion

YodaYoda Posts: 132
edited 2012-05-21 13:23 in Propeller 1
I was able to build from source on Lion and it appears to be working.

Next I plan to integrate with Eclipse and see how that goes. I assume it will be like any other integration of C/C++ environment with Eclipse? I would also assume the different boards will become runtime targets that can be selected as well?

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2011-11-04 11:01
    Congratulations on getting PropGCC working under Lion! What version of Xcode are you using? I couldn't get it to work with Xcode 4.1 but 4.2 seems to be fine.
  • YodaYoda Posts: 132
    edited 2011-11-04 12:14
    I am using 4.2 of Xcode - did not seem to be a problem - had some issues with permissions initially as the directory I had created on a firewire disk did not have the permissions I thought it did but a chown -R fixed that.
  • David BetzDavid Betz Posts: 14,516
    edited 2011-11-04 12:18
    Yoda wrote: »
    I am using 4.2 of Xcode - did not seem to be a problem - had some issues with permissions initially as the directory I had created on a firewire disk did not have the permissions I thought it did but a chown -R fixed that.
    I haven't had any trouble with Xcode 4.2 either. I guess we're on the same page now. :-)
  • jazzedjazzed Posts: 11,803
    edited 2011-11-04 13:01
    Yoda wrote: »
    I was able to build from source on Lion and it appears to be working.

    Next I plan to integrate with Eclipse and see how that goes. I assume it will be like any other integration of C/C++ environment with Eclipse? I would also assume the different boards will become runtime targets that can be selected as well?

    Hi Yoda, Congrats.

    I've used Propeller-GCC manually with Eclipse CDT and NetBeans C/C++.

    I've been able to configure Eclipse and Netbeans to "run" the application on Propeller. I haven't had much luck controlling the terminal with Eclipse other than kill -9 :< Presumably this is because we use ESC only or Ctrl-C to stop the terminal. NetBeans passes ESC to the program and has a "stop" button. I guess a stop button could be added to Eclipse or the terminal ESC command changed to something else.

    The short answer for board types is:

    The loader chooses the board type to boot. The application selects the library devices with a driver struct (fopen, fread, fwrite, fclose, etc...). The application can define other devices to be used independent of the C library.

    In summary, we want to have GUI elements for Serial port select, Board type select, and device configurations. A "sketch" of GUI interface plans can be found in this propgcc wiki page.
  • YodaYoda Posts: 132
    edited 2011-11-04 18:34
    I guess I was thinking of a different way of doing this with Eclipse. I thought we take advantage of build and run targets. That way you could select a target of xmm and it would set the appropriate compile, load and run flags for that environment. Then if you wanted to use lmm for example it would set the appropriate flags and options for the lmm environment. I don't think you would have to write the plugin you are suggesting in your link?
  • jazzedjazzed Posts: 11,803
    edited 2011-11-04 19:58
    Yoda wrote: »
    I guess I was thinking of a different way of doing this with Eclipse. I thought we take advantage of build and run targets. That way you could select a target of xmm and it would set the appropriate compile, load and run flags for that environment. Then if you wanted to use lmm for example it would set the appropriate flags and options for the lmm environment. I don't think you would have to write the plugin you are suggesting in your link?
    I would love to see your concept. I'm very happy to test what you make.
  • dgatelydgately Posts: 1,633
    edited 2011-11-22 19:45
    Curious how you are building in XCode... Are you creating a project and importing the propgcc sources? If so, can the project file(s) i.e. ".xcodeproj" files, be checked-into the propgcc sources?

    I built, basically using the linux build instructions with some Mac-specific changes at the command line. It would be nice to build future release versions with Xcode.

    Thanks!
  • jazzedjazzed Posts: 11,803
    edited 2011-11-22 21:28
    dgately wrote: »
    I built, basically using the linux build instructions with some Mac-specific changes at the command line. It would be nice to build future release versions with Xcode.
    Hi. Welcome to the forums.

    If you can describe mac build instructions, we could put them on the Wiki.
    One of our developers uses Xcode. Maybe he can chime in on that.

    Like your C6. Makes me want to trade my C5.

    Thanks.
    --Steve
  • David BetzDavid Betz Posts: 14,516
    edited 2011-11-23 04:18
    jazzed wrote: »
    Hi. Welcome to the forums.

    If you can describe mac build instructions, we could put them on the Wiki.
    One of our developers uses Xcode. Maybe he can chime in on that.

    Like your C6. Makes me want to trade my C5.

    Thanks.
    --Steve
    PropGCC builds out of the box under the Xcode 4.2 command line tools as do the demos. I think dgately must be talking about using the Xcode IDE. I'm not even sure if it is possible to get Xcode to make use of a different toolchain but the effort would probably be similar to the effort required to make Eclipse work.
  • dgatelydgately Posts: 1,633
    edited 2011-11-23 07:52
    jazzed wrote: »

    If you can describe mac build instructions, we could put them on the Wiki.
    One of our developers uses Xcode. Maybe he can chime in on that.

    Like your C6. Makes me want to trade my C5.

    --Steve

    I'll write-up the steps that I take to build from source and post (to this thread?)...

    The C5 was definitely the Vette that got me thinking about buying one!

    dgately
  • dgatelydgately Posts: 1,633
    edited 2011-11-23 08:10
    David Betz wrote: »
    PropGCC builds out of the box under the Xcode 4.2 command line tools as do the demos. I think dgately must be talking about using the Xcode IDE. I'm not even sure if it is possible to get Xcode to make use of a different toolchain but the effort would probably be similar to the effort required to make Eclipse work.

    Ah, never thought of OS X's build tools as being considered "XCode"...

    From my view, XCode is actually just the IDE that uses the build tools inherent in OS X's Unix base (Darwin), but I can see how it appears as a unit. It does get installed as one big package! And, yes, XCode "the IDE" could be taught to build anything that can be built on the command line. That's how XCode is able to move to new build and source repository methods, quickly (clang, llvm, git, etc.).

    Having said all that, I'm not an XCode 4.2 wiz by any means. I'll stay with the command line for now.

    dgately
  • David BetzDavid Betz Posts: 14,516
    edited 2011-11-23 08:40
    dgately wrote: »
    Ah, never thought of OS X's build tools as being considered "XCode"...

    From my view, XCode is actually just the IDE that uses the build tools inherent in OS X's Unix base (Darwin), but I can see how it appears as a unit. It does get installed as one big package! And, yes, XCode "the IDE" could be taught to build anything that can be built on the command line. That's how XCode is able to move to new build and source repository methods, quickly (clang, llvm, git, etc.).

    Having said all that, I'm not an XCode 4.2 wiz by any means. I'll stay with the command line for now.

    dgately
    Yes, I guess I should have said that propgcc would build out of the box with the Xcode package. It certainly can't be built with the Xcode IDE. I wonder if Apple even builds LLVM using the Xcode IDE?
  • dgatelydgately Posts: 1,633
    edited 2011-11-23 11:58
    Building propgcc on OS X Lion 10.7:

    Prerequisite:

    Mercurial, the free distributed source control management tool from: http://mercurial.selenic.com/downloads/. This is needed to download and maintain the propgcc sources. Mercurial is not available in OS X as a default and must be downloaded and installed as a package. Download Mercurial's ".mpkg" (meta-package) file and double-click on it to install.


    Note: Executing the "hg clone" command on my 10.7.2 system failed with "AttributeError: 'module' object has no attribute 'setbinary'". If this happens, you'll need to edit the file: "/usr/local/bin/hg", according to instructions on this web page: http://groups.google.com/group/thg-dev/browse_thread/thread/dbbce627480a5a13


    Steps (Mac OS X Lion 10.7 addendum to: PropGccBuild - propgcc - Describes how to build Propeller GCC. - GCC for the Parallax Propeller Microcontroller - Google Project Hosting):


    1. Make a new directory for the propgcc sources, in a known location (your home directory is a good place).
    $ cd $HOME <== go to your home directory
    $ mkdir propSrc <== create a new directory for your cloned propgcc sources
    $ cd propSrc <== go into the new source directory

    2. You'll need to add the following lines to your ".profile" file in your home directory. Use nano, vi, emacs or a GUI editor you like.
    # propgcc Programming PATH
    export PATH=${PATH}:/usr/local/propeller/bin


    # Set up Python to help mercurial
    export PYTHONPATH=${HOME}/lib/python
    export PATH=${HOME}/bin:$PATH

    Be sure to "source" .profile before continuing...
    $ source .profile

    3. To download the propgcc sources, you'll need to use Mercurial's 'clone' command: "hg clone". If the command fails, see the above note for instructions on repairing the failure.
    $ hg clone https://code.google.com/p/propgcc/ <== clone propgcc sources into your source directory (3-5 minutes)
    $ cd propgcc <== go into the cloned propgcc directory
    $ ls <== list the directory content
    LICENSE.txt dejagnu gcc jbuild.sh loader release
    README.txt demos gdb ldscripts newlib tools
    binutils doc gnu-oids.texi lib rebuild.sh

    Build propgcc on OS X Lion


    1. $ export GROUP="wheel" <== I just use the "wheel" group as I'm sure that I'll have access to it, later
    2. $ sudo rm -rf /usr/local/propeller <== work as root user without being too dangerous (requires admin password)
    3. $ sudo mkdir /usr/local/propeller
    4. $ sudo chown ${USER}.${GROUP} /usr/local/propeller <== makes the new directory accessible to you
    5. $ cd $HOME/propsource/propgcc <== in case you've moved to another directory since the hg clone
    6. $ ./rebuild.sh
    7. Go have a cup of espresso (you'll need the caffeine)


    Example Build of the c3files program:


    On OS X, the USB to Serial connection will show up like this: "/dev/cu.usbserial-0000nnaa", where "nn" will be a two-digit number and "aa" will be a two character alpha. With the USB cable plugged into the CPU and the C3, executing "ls /dev|grep cu.usbserial" will display the correct name. You'll need to re-export if you plug the cable into a different USB port.
    $ ls /dev|grep cu.usbserial <== find out what OS X is calling your USB to Serial connection
    cu.usbserial-000013FD <== export this as PROPELLER_LOAD_PORT (will change
    1. $ export PROPELLER_LOAD_PORT=/dev/cu.usbserial-000013FD
    2. $ cd $HOME/propsource/propgcc/demos/c3files/lmm
    3. $ make
    4. $ make run
    propeller-load -b c3 c3files.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-000013FD
    Writing 30756 bytes to Propeller RAM.
    Verifying ... Upload OK!
    [ Entering terminal mode. Type ESC or Control-C to exit. ]


    Commands are help, cat, rm, ls, ll, echo, cd, pwd, mkdir and rmdir
    >



    I hope this is "Wiki-worthy". It works for me :-)
  • jazzedjazzed Posts: 11,803
    edited 2011-11-23 12:54
    @dgately,

    Thanks for the instructions. I've put them on the wiki here: http://code.google.com/p/propgcc/wiki/PropGccBuildMacOSX.
    Please review and offer suggestions.

    --Steve
  • dgatelydgately Posts: 1,633
    edited 2011-11-23 13:03
    Just thought of one more detail...

    I had to create a soft-link (symbolic link) in /usr/local/propeller/bin/ for bstc, to get compile/load to work. I used:

    sudo ln -s /usr/local/propeller/bin/bstc /usr/local/propeller/bin/bstc.osx


    dgately
  • Albus DumbledoreAlbus Dumbledore Posts: 6
    edited 2012-05-18 17:38
    dgately wrote: »
    Building propgcc on OS X Lion 10.7:
    I'm attempting to install to a MacBook running OS X Leopard 10.5.8

    dgately wrote: »
    Mercurial, the free distributed source control management tool from: http://mercurial.selenic.com/downloads/.
    I've just installed the Mercurial 2.0.0 without problems.
    dgately wrote: »
    1. Make a new directory for the propgcc sources, in a known location (your home directory is a good place).
    $ cd $HOME <== go to your home directory
    $ mkdir propSrc <== create a new directory for your cloned propgcc sources
    $ cd propSrc <== go into the new source directory

    2. You'll need to add the following lines to your ".profile" file in your home directory. Use nano, vi, emacs or a GUI editor you like.
    # propgcc Programming PATH
    export PATH=${PATH}:/usr/local/propeller/bin


    # Set up Python to help mercurial
    export PYTHONPATH=${HOME}/lib/python
    export PATH=${HOME}/bin:$PATH

    Be sure to "source" .profile before continuing...
    $ source .profile
    Wouldn't it be easier to change to your home directory, edit/create the .profile, then make and change to the propSrc directory?
    dgately wrote: »
    3. To download the propgcc sources, you'll need to use Mercurial's 'clone' command: "hg clone". If the command fails, see the above note for instructions on repairing the failure.
    $ hg clone https://code.google.com/p/propgcc/ <== clone propgcc sources into your source directory (3-5 minutes)
    It took about ten times running this to finally get it to work. I dropped the S from https, which seemed to help it go faster. It's taken more like 30 minutes to fetch everything. Seven PM on a Friday after work seems to be a busy time for Google's servers for some reason. Btw, it's a little over 72,000 files in total.
    dgately wrote: »
    Build propgcc on OS X Lion

    1. $ export GROUP="wheel" <== I just use the "wheel" group as I'm sure that I'll have access to it, later
    2. $ sudo rm -rf /usr/local/propeller <== work as root user without being too dangerous (requires admin password)
    3. $ sudo mkdir /usr/local/propeller
    4. $ sudo chown ${USER}.${GROUP} /usr/local/propeller <== makes the new directory accessible to you
    This form of the chown command fails on 10.5.8. The man page suggests that the dotted notation for referring to groups is no longer supported, that the correct method presumably would be:

    sudo chown ${USER} :${GROUP} /usr/local/propeller

    ...however when I tried this it informed me...

    chown: :wheel: No such file or directory

    ...so I don't really know. I ran the "groups" command and I don't see a wheel group. Under System Preferences -> Accounts I tried to create a wheel group and it said that it exists. I decided to just run this as:

    sudo chown ${USER} /usr/local/propeller

    ...and it seemed to run without an error at least.
    dgately wrote: »
    5. $ cd $HOME/propsource/propgcc <== in case you've moved to another directory since the hg clone
    6. $ ./rebuild.sh
    7. Go have a cup of espresso (you'll need the caffeine)
    Pretty sure that you wanted to say "cd $HOME/propSrc/propgcc" there in #5.

    Wow, that's some build script. I might just have to make some more coffee to let this thing finish. At least it seems to be running.

    Bummer, got the following error after a long run of that build batch...

    make[4]: *** [ldlang.o] Error 1
    make[3]: *** [all-recursive] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [all-ld] Error 2
    make: *** [all] Error 2
    binutils make failed.
    dgately wrote: »
    Example Build of the c3files program:

    On OS X, the USB to Serial connection will show up like this: "/dev/cu.usbserial-0000nnaa", where "nn" will be a two-digit number and "aa" will be a two character alpha. With the USB cable plugged into the CPU and the C3, executing "ls /dev|grep cu.usbserial" will display the correct name. You'll need to re-export if you plug the cable into a different USB port.
    $ ls /dev|grep cu.usbserial <== find out what OS X is calling your USB to Serial connection
    cu.usbserial-000013FD <== export this as PROPELLER_LOAD_PORT (will change
    1. $ export PROPELLER_LOAD_PORT=/dev/cu.usbserial-000013FD
    2. $ cd $HOME/propsource/propgcc/demos/c3files/lmm
    3. $ make
    4. $ make run
    propeller-load -b c3 c3files.elf -r -t
    Propeller Version 1 on /dev/cu.usbserial-000013FD
    Writing 30756 bytes to Propeller RAM.
    Verifying ... Upload OK!
    [ Entering terminal mode. Type ESC or Control-C to exit. ]


    Commands are help, cat, rm, ls, ll, echo, cd, pwd, mkdir and rmdir
    >
    Hm... not sure what the state of my build is but I assume it's incomplete at this point.
  • jazzedjazzed Posts: 11,803
    edited 2012-05-18 18:09
    Hello and welcome to the forum.

    Looks like more documentation to update.

    The /usr/local/propeller path is no longer being used. Set it to /opt/parallax instead.

    You can use jbuild.sh N to speed up the build. N = number of cores for make.

    --Steve

    I'm attempting to install to a MacBook running OS X Leopard 10.5.8 ...

    Bummer, got the following error after a long run of that build batch...

    make[4]: *** [ldlang.o] Error 1
    make[3]: *** [all-recursive] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [all-ld] Error 2
    make: *** [all] Error 2
    binutils make failed.


    Hm... not sure what the state of my build is but I assume it's incomplete at this point.
  • dgatelydgately Posts: 1,633
    edited 2012-05-19 11:23
    jazzed wrote: »
    Hello and welcome to the forum.

    Looks like more documentation to update.

    The /usr/local/propeller path is no longer being used. Set it to /opt/parallax instead.

    You can use jbuild.sh N to speed up the build. N = number of cores for make.

    --Steve

    Steve, If you can add me as a propgcc member, I can edit the Mac OS X build doc...

    (you have my email address)

    dgately
  • jazzedjazzed Posts: 11,803
    edited 2012-05-19 11:26
    Done. Thanks Dennis.
    dgately wrote: »
    Steve, If you can add me as a propgcc member, I can edit the Mac OS X build doc...

    (you have my email address)

    dgately
  • dgatelydgately Posts: 1,633
    edited 2012-05-21 13:23
    I'm attempting to install to a MacBook running OS X Leopard 10.5.8

    I've just installed the Mercurial 2.0.0 without problems.
    Wouldn't it be easier to change to your home directory, edit/create the .profile, then make and change to the propSrc directory?
    It took about ten times running this to finally get it to work. I dropped the S from https, which seemed to help it go faster. It's taken more like 30 minutes to fetch everything. Seven PM on a Friday after work seems to be a busy time for Google's servers for some reason. Btw, it's a little over 72,000 files in total.

    This form of the chown command fails on 10.5.8. The man page suggests that the dotted notation for referring to groups is no longer supported, that the correct method presumably would be:

    sudo chown ${USER} :${GROUP} /usr/local/propeller

    ...however when I tried this it informed me...

    chown: :wheel: No such file or directory

    ...so I don't really know. I ran the "groups" command and I don't see a wheel group. Under System Preferences -> Accounts I tried to create a wheel group and it said that it exists. I decided to just run this as:

    sudo chown ${USER} /usr/local/propeller

    ...and it seemed to run without an error at least.

    Pretty sure that you wanted to say "cd $HOME/propSrc/propgcc" there in #5.

    Wow, that's some build script. I might just have to make some more coffee to let this thing finish. At least it seems to be running.

    Bummer, got the following error after a long run of that build batch...

    make[4]: *** [ldlang.o] Error 1
    make[3]: *** [all-recursive] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [all-ld] Error 2
    make: *** [all] Error 2
    binutils make failed.


    Hm... not sure what the state of my build is but I assume it's incomplete at this point.

    Albus,

    I got the same result on one of my Macs... On the other Mac, no problem...

    Appears to be something about linking with the libbbfd.a archive, created during the binutils build process. Something about that archive not having symbols for x86_64. My MacBook Pro has MacPorts installed and that may be the issue. My iMac is a more clean configuration and is able to build propgcc, directly.

    To build on my MacBook Pro, I booted-up in 32-bit mode, which allowed a full build of propgcc (but needed to delete the previous build directory and run "make -distclean" in the binutils directory before rebuilding)...

    You can try that...

    dgately
Sign In or Register to comment.