Shop OBEX P1 Docs P2 Docs Learn Events
PropGCC on the RPi or other... — Parallax Forums

PropGCC on the RPi or other...

RsadeikaRsadeika Posts: 3,837
edited 2014-06-30 05:41 in Propeller 1
similar systems. I know we have SimpleIDE that is available for that but, ...

Since I am starting to accumulate RPi boards, I would like to try too attach a Propeller board, maybe via ttyUSB0, and try to program it. I am also thinking it should be in the simplest setup possible maybe something a little more powerful than a NANO or VIM editor, but a whole lot simpler than CODE::BLOCKS or even Geany. Then possibly use a bash script to do the actual work to compile, load, and run the code on the Propeller. The important note, the simplest way possible.

Not sure if there is a PropGCC package that you can load to the RPi, do a setup.sh too get the files where they should be and then run it from a command line or the GUI, or possibly an editor that would allow you to run bash script files. It would be nice to cover both areas, command line and GUI. Any ideas?

Ray
«1

Comments

  • Heater.Heater. Posts: 21,230
    edited 2014-06-22 07:32
    Check out Bill Henning's Propeller-raspi thread. He has SimpleIDE for the raspi ready to go.If you only want to use propgcc on the raspi that's OK installing SimpleIDE gives you the propgcc anyway which can be used crom the command line.
  • dgatelydgately Posts: 1,630
    edited 2014-06-22 07:46
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-22 08:19
    Thanks for the ideas, but I want to avoid going the whole loading of SimpleIDE. I thought maybe there is a PropGCC, all by itself, that allows doing a clean install of only PropGCC. The other thing would be an editor that you could run in command line or GUI mode with a way of doing the mentioned script file commands. Not being a heavy user of Linux, there must be an editor that is a little more powerful than NANO or VIM, which could also be used in a GUI?

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-22 12:31
    I decided to go ahead and do the whole SimpleIDE install, it went better than expected, good job for everyone that was involved. The only problem that I see, for me anyway, is it looks like you have to do a "simpleide" from within the LXTerminal to get it started. IIRC that was the same problem on a regular Linux install. I call it a problem because if you are in a GUI I expect to double click on the icon to get the application started.

    Now that I have the whole thing installed, any suggestions as to how you would use a PuTTY session to program the attached Propeller, or at least the best solution for the session?

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-22 13:24
    Well done Ray.

    I'm sure a quick google around will tell you how to set up a desktop icon for whatever desktop you are running.

    But, hey, if you want to use via ssh you don't need an icon right?

    If you can log into your pi via Putty or other ssh client then the propeller tools are under /opt/parallax/bin

    So you can compile stuff with commands like:
    /opt/parallax/bin/propeller-elf-gcc -o myprog myprog.c
    
    And load the Propeller with:
    /opt/parallax/bin/propeller-load bla bla bla
    
    Of course you will need to consult the prop-gcc documentation to get all the right options and params for those.
  • Heater.Heater. Posts: 21,230
    edited 2014-06-22 19:06
    By the way. I'm a bit worried about this lumping of nano and VIM together.

    nano is barely functional as an editor on the other hand there is no editor more powerful than VIM :)

    For example, this is also vim: http://cream.sourceforge.net/features.html
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-23 03:15
    Speaking of vi, the last time I used it, maybe 25 or 30 years ago, how could I possibly forget - Normal mode, Insert mode, and ":" to do anything. But, at the time, it was better than the alternatives that were available. I downloaded a doc file for vim, and of course those three items are still present; I am not sure that I want to go back that far in time to do things that are in the present. But we will see...

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-23 04:14
    Ray,

    I'm not insisting that you take up usage of VIM. Only pointing out that it is far removed from the world of nano. Given that vim has a Turing complete scripting language built in then it is as powerful as any other editor. Vim is still better than the alternatives sometimes, for example when you log into your Rasperry Pi over ssh and want to do some editing of config files or even serious work on source code.

    And now for my dirty little secret: For some months now I have been using Sublime Text: http://www.sublimetext.com/ it's the first editor I have liked for years and works equally well on Linux, Mac and Windows. It's also the first piece of software I have paid money for since the late 1980's !!

    The "dirty" part of all this is that Sublime is closed source thus breaking all my rules about that.

    Of course Sublime does not work on ARM processors so it's back to vim again there:)
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-23 05:33
    OK, so for the time being I will just access the RPi via xrdp, mstsc, and work with SimpleIDE. I just tried some more testing with an Activity Board attached, and I got the P26 LED to flash, so it seems to be working as expected at the moment. That starting SimpleIDE(simpleide) in an LXTerminal still does not feel right, to me, oh well.

    I will leave the topic of using PropGCC via an ssh mode session for another time. Maybe something like an old DOS edit program will appear, and then...

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-23 05:48
    Ray,

    You can easily create an icon on the desktop to to start SimpleIDE. There are instructions all over the place to do that, for example:
    http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/gui/desktop-shortcuts

    If you watch what SimpleIDE does as it builds and loads your program then you will have all the commands needed to build the program manually over a Putty session.

    You could just put those commands into a BASH script.

    Of course the usual thing with C projects is to use a Make file but SimpleIDE does not use them and perhaps it's overkill of little propeller projects where the recompile time is pretty short anyway.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-23 06:11
    I went to the site where it shows you how to link an icon to a program, it is kind of funny about what we call progress. I remember doing the same thing with Windows 3.11 back some 24 years ago, when you wanted to iconize a DOS program, sometimes we go forward and sometimes we go backwards, and we call that progress, depending on what is being pushed. So I digress...

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-23 06:41
    Ray,

    Well, Windows 3.1 was the best version of Windows ever made :)

    The problem here is that there are dozens of different desktop environments you can use on top of Linux/Unix/BSD whatever. I believe some efforts have been made to standardize desktop configurations, icons, menus etc but I've never really looked into it and I'm sure it's a mess that only half works half the time anyway :)

    Then we have the issue that such GUI conveniences are normally installed by the package system of what ever Linux distro you are using. of course there are many of those as well, all different. SimpleIDE is not distributed as an package for any distro.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-24 08:33
    Since my original intent was to have a separate install of PropGCC, and I do have SimpleIDE installed, what would be the steps to create a specific PropGCC install package? I am not sure what the first step for this would be, is there a specific file to look at first? Or what?

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-24 11:48
    I really have no idea how to create .deb installation packages for Debian or Raspbian.

    However, if you have SimpleIDE installed and working then all of propgcc is there in /opt/parallax

    All you have to do is make a tar ball out of that and you have something that can be unpacked into any Raspbian machine.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-24 14:01
    I was thinking, so I extracted setup.sh file from the SimpleIDE tarball, below is a copy. I think what could be done is to insert a way too just request that the PropGCC just be installed, I think? Now I am not sure if that should be done from the command line or you answer a question from within the bash script. I am not to familiar with bash scripting so I could use some ideas as to how that could be done.

    Ray
    #!/bin/sh
    #
    #
    # SimpleIDE user setup for Linux.
    #
    # This script assumes you have root access.
    #
    # To install SimpleIDE and Propeller GCC run: ./setup.sh
    # This will copy Propeller GCC to /opt/parallax and Simple IDE
    # to /opt/simpleide and create a shortcut for the executable
    # /opt/simpleide/SimpleIDE in /usr/bin/simpleide
    #
    # To start SimpleIDE use the command: simpleide
    #
    #
    #

    PROPGCC_DIR=/opt/parallax
    SIMPLEIDE_DIR=/opt/simpleide

    # Show usage
    usage()
    {
    echo "Usage: setup.sh [action [target]]"
    echo "Action:"
    echo " install Install target"
    echo " uninstall Uninstall target"
    echo ""
    echo "Targets:"
    echo " propellergcc Set target to only Propeller GCC"
    echo " simpleide Set target to only SimpleIDE"
    echo ""
    echo "If the target is not given, the default is both Propeller GCC and SimpleIDE"
    }

    # Uninstall Propeller GCC function
    uninstall_propgcc()
    {
    # Is Propeller GCC installed?
    if [ -e $PROPGCC_DIR ]; then
    read -p "Remove previously installed Propeller GCC? [y/N]:" response
    case $response in
    # Does the user really want to uninstall it?
    Y|y|YES|Yes|yes) echo "Removing Propeller GCC"
    rm -r $PROPGCC_DIR
    ;;
    *) echo "Not modifying Propeller GCC"
    esac
    else
    echo "Propeller GCC not installed"
    fi
    }

    # Install Propeller GCC function
    install_propgcc()
    {
    uninstall_propgcc
    if [ -e $PROPGCC_DIR ]; then
    echo "Error: Propeller GCC already installed"
    exit
    fi

    echo "Installing Propeller GCC"
    mkdir -p $PROPGCC_DIR
    cp -R parallax/* $PROPGCC_DIR
    }

    # Uninstall SimpleIDE function
    uninstall_simpleide()
    {
    if [ -e $SIMPLEIDE_DIR ]; then
    read -p "Remove previously installed Simple IDE? [y/N]:" response
    case $response in
    # Does the user really want to uninstall it?
    Y|y|YES|Yes|yes) echo "Removing Simple IDE"
    rm -r $SIMPLEIDE_DIR
    rm /usr/bin/simpleide
    ;;
    *) echo "Not modifying Simple IDE"
    esac
    else
    echo "Simple IDE not installed"
    fi
    }

    # Install SimpleIDE function
    install_simpleide()
    {
    uninstall_simpleide
    if [ -e $SIMPLEIDE_DIR ]; then
    echo "Error: Simple IDE already installed"
    exit
    fi

    echo "Installing SimpleIDE"
    mkdir -p $SIMPLEIDE_DIR
    cp -R bin demos license translations $SIMPLEIDE_DIR
    cp $SIMPLEIDE_DIR/bin/simpleide.sh /usr/bin/simpleide

    # do this if simpleide.sh file permissions don't carry.
    # chmod 755 /usr/bin/simpleide
    }

    # Verify the user is root function
    if [ $(whoami) != root ]; then
    echo This script must be run as root
    echo try: sudo ./setup.sh
    exit
    fi

    # Execution starts here
    # Did the user provide any commands?
    case $1 in
    # Install something
    install)
    case $2 in
    # Install Propeller GCC
    propellergcc)
    install_propgcc
    exit
    ;;
    # Install SimpleIDE
    simpleide)
    install_simpleide
    exit
    ;;
    # Installation instructions unclear, show usage
    ?*)
    echo Target \"$2\" not recognized
    usage
    exit
    esac
    # No specific uninstall instructions, install everything
    install_propgcc
    install_simpleide
    exit
    ;;

    # Uninstall something
    uninstall)
    case $2 in
    # Uninstall Propeller GCC
    propellergcc)
    uninstall_propgcc
    exit
    ;;
    # Uninstall SimpleIDE
    simpleide)
    uninstall_simpleide
    exit
    ;;
    # Uninstallation instructions unclear, show usage
    ?*)
    echo Target \"$2\" not recognized
    usage
    exit
    esac
    # No specific uninstall instructions, uninstall everything
    uninstall_propgcc
    uninstall_simpleide
    exit
    ;;

    # Instructions unclear, show usage
    ?*)
    echo Action \"$1\" not recognized
    usage
    exit
    esac

    # No instructions, install everything
    install_propgcc
    install_simpleide

    exit
  • dgatelydgately Posts: 1,630
    edited 2014-06-25 10:47
    Ray,

    So, I just have to ask...

    Why is it so important that you install propgcc separately from SimpleIDE? It's not like the SimpleIDE portion of the install takes up a lot of disk space, right? I guess you could delete SimpleIDE itself after the install, leaving just the propgcc binaries and example code. Dos the SImpleIDE install also place "Propeller GCC Demos" into a SimpleIDE folder? Those demos include make files that you can use and learn from to create your own.

    Just curious.

    dgately
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-25 12:26
    Their is always that assumption that you will have or at least will need access to the RPi desktop to do an install of the SimpleIDE package. What if you want to run a headless setup where you have a Propeller connected, but you can only get to it via a command line terminal. I know it gets messy because you probably will have to use "wget ..." to get to where the SimpleIDE tarball is. Then I guess it is a lot of added work to remove the SimpleIDE parts to save on space. So, my primary concern was, to be able to setup PropGCC on a headless RPi setup.

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-26 01:25
    Ray,

    If I remember correctly if you unpack the SimpleIDE package you will find that you have a directory "parallax" which contains the propgcc that will be installed to /opt/parallax if you run the setup.
    So all you need to do is mv that directory to /opt/ and perhaps change ownership recusively on it, sudo chown -R yourname:yourname /opt/parallax

    Then add /opt/parallax/bin to your PATH.

    There you have a propgcc install with no SimpleIDE all done from the command line. You can delete the unpacked SimpleIDE if you like.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-26 03:48
    Thanks Heater.
    Then add /opt/parallax/bin to your PATH.
    This has to be a really stupid question, but how and where do set your PATH?

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-26 04:05
    Not stupid at all.

    $ export PATH=$PATH:/opt/parallax/bin

    Will add /opt/parallax/bin to you PATH temporarily, for as long as the current login session.

    To get it set automatically at every log in just add that command to the hidden file .bashrc in your home directory.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-27 04:18
    Yesterday I had an interesting day, it seems that the RPi OS tends to get corrupted very easily. The first time I tried to install SimpleIDE it ran into problems, it seemed to do a good download, but when I got too the setup.sh install it started to run OK but it got to a point, during the install process, where the system locked up, nothing was responsive, I had to pull the plug to shut it down. After shutting it down I started it back up, everything seemed to be back to normal, but when I started the install session again, it seemed to have locked the OS in about the same place of the installation process.

    So, at this point I had to pull the SD card, re-format, and re-install the image, then start the whole procedure again, but this time it seemed that install of SimpleIDE was successful. I am not sure what to make of this whole situation, is the OS version for the RPi still at BETA level, meaning it still has issues that have to be worked out, or because it is on an ARM processor, it is having internal processor difficulties on how it works? This is not the first occurrence of having the OS misbehave, I had it misbehave before, unrelated to SimpleIDE.

    One other note, somewhere in the installation instructions, a note about the user having "dialout" privileges should be noted, that got me a few times all ready.

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-27 06:59
    That's really a question for the RaspberryPi forums.

    I had many similar sounding problems on my two Pis a year or so ago. Then I got a different power supply. And all has been fine. So I don't know if the more recent OS images or the new PS made the difference.

    Never had such problems with building or installing propgcc and SimpleIDE though.

    Make yourself a member of the "dialout" group and you should be good to go.
  • KMyersKMyers Posts: 433
    edited 2014-06-27 08:25
    @Ray

    Had same prob here with corrupting the os, most self inflicted but when I switched to a 1.5 amp power and Noobs the problems went away. Never had any problems installing SimpleIDE. Just followed the instructions posted here. Dont know enough Linux yet to go rogue!
  • dgatelydgately Posts: 1,630
    edited 2014-06-27 23:39
    @Ray,

    I've had the SD-based OS go "wonky" a few times on my RPi's. So, I added a 1TB USB hard drive after partitioning it to 2 500GB drives. I copied an installed system from the SD card to one partition (instructions can be found on the RPi forums. you'll need to re-size the OS to the USB drive partition). As the RPi starts to boot up from the SD, a config file forces the boot up to the USB drive. This gives me lots of space for the RPi. Of course, the Pi is not real portable now, but it's a development system, anyway.

    On the RPi, the SD card seems more prone to corruption than a USB-powered-hub based hard drive.

    dgately
  • Heater.Heater. Posts: 21,230
    edited 2014-06-27 23:50
    Of course the other variable in my situation is that I bought a whole new batch of SD cards. Transcend 8GB class 10. These have worked well in the Pi and in IGEP ARM boards that I use. It has not been just the Pi that gave me problems with SD corruption.

    Now that I think about it I do get some suspicious behaviour from time to time. An "apt-get install..." or "apt-get upgrade..." that has to do a lot of work has been known to freeze the Pi. All has been fine after a reboot and the install could be completed.

    On the other hand, I have used an old 80GB USB hard drive to hold working files whilst rebuilding Qt5 from source. That build takes three or four days! No problems.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-28 05:19
    I am hoping somebody else can verify what I am seeing on my setup. When I run the program below, then wait till the LED turns off on the Activity Board then run the program again, I am getting "No Propeller on ttyUSB0" show up quite a few times, as the program is being run many times, consistently. Yes, I am in dialout, or whatever that designation is officially called. Basically I am trying to figure out if the problem is with SimpleIDE or the RPi or both. If there is an inconsistency with access to the ttyUSB0 port, then their could be a potential problem with how you can communicate with an attached Propeller board. First I hope somebody else can verify.

    Ray
    /*
      test1.c
    
    */
    #include "simpletools.h" 
    
    int main()
    {
      // Add startup code here.
      high(26);
      pause(5000);
      low(26);
     
    //  while(1)
    //  {
        // Add main loop code here.
        
    //  }  
    }
    
    
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-06-29 05:06
    Thanks for all the ideas and help with this project, I am heading in a new direction.

    Ray
  • Heater.Heater. Posts: 21,230
    edited 2014-06-29 10:20
    Ray, what happened?

    What's the new direction?
  • Bill HenningBill Henning Posts: 6,445
    edited 2014-06-29 16:25
    Heater,

    I just installed the SimpleIDE from Jeff's article at learn.parallax.com

    Is there a newer propeller-load, or should I overwrite the supplied one with the old rev3 you made?
  • Heater.Heater. Posts: 21,230
    edited 2014-06-30 00:11
    Bill,

    The last loader that was known to work over ttyAM0, the UART pins, is very old now and I get the feeling enough has changed in propgcc/SimpleIDE that it may not work any more.

    The latest loader code in the default branch of propgcc on google code contains my changes for using ttyAMA0. However it does not use them when compiled out of the box as they have never been tested.

    I'll try and find some time to get this going.
Sign In or Register to comment.