Shop OBEX P1 Docs P2 Docs Learn Events
Convert Fuzzy Library for Arduino to the Propeller - Page 2 — Parallax Forums

Convert Fuzzy Library for Arduino to the Propeller

2

Comments

  • ASAS Posts: 149
    I will install everythin again! :P
  • I'm sorry to hear this. I think it is related to the cmake issue you were facing though. I'll wait to hear back on how things are going after the reinstall. Hopefully that helps
  • ASAS Posts: 149
    I hope to give news soon!

    Thanks a lot for your help
  • ASAS Posts: 149
    Hi DavisZemon,

    I try everything to make it work in my pc but for some reason it freezes at 88% when is building.

    As you have told me, to make it in a Raspberry it needs to make the binaries for CMake.
    I already have my RB working with the simpleIDE, I already try and is working fine, we'll see if it can handle with. :P
    I hope you can help me!

    About 3 years ago I use the RB for the last time, it was not easy to put it working without hdmi monitor, but I find great tutorials
    <http://www.circuitbasics.com/raspberry-pi-basics-setup-without-monitor-keyboard-headless-mode/>, now is working conected with the router or wifi antena.
    I don´t installed NOOBS because I only see after the installation the sugestion from parallax, I intalled RASPBIAN.

    Thanks,




  • ASAS Posts: 149
    My question is:
    How I shoul to do to RB make the CMake binaries?
  • DavidZemonDavidZemon Posts: 2,973
    edited 2016-01-25 01:29
    Run the following from your pi:
    wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
    tar -xf cmake-3.3.2.tar.gz
    cd cmake-3.3.2
    ./bootstrap --parallel=5
    make -j5
    wget http://david.zemon.name/downloads/Modules.zip
    unzip Modules.zip
    find . -name FindPropWare.cmake
    

    That last line should return "./Modules/FindPropWare.cmake"

    This assumes you have a Raspberry Pi 2, with the quad-core processor. If you have the single-core version, drop the "--parallel=5" from the bootstrap command and the "-j5" from the make command.

    Mine is building right now, so I'll let you know when (if) it finishes. After approximately 3 years and 14 days and 15 hours, we should both have cmake binaries :)
  • I updated the instructions above. I saw bootstrap compiling a lot of sources and therefore assumed it automatilly ran make. It didn't - make is still required after bootstrap. This is going to take a very long time lol
  • ASAS Posts: 149
    edited 2016-01-24 22:31
    DavidZemon wrote: »
    wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
    tar -xf cmake-3.3.2.tar.gz
    cd cmake-3.3.2
    ./bootstrap --parallel=5
    make -j5
    

    This assumes you have a Raspberry Pi 2, with the quad-core processor. If you have the single-core version, drop the "--parallel=5" from the bootstrap command and the "-j5" from the make command.

    My is Model B. It´s single core right?
    I shoul write:
    wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
    tar -xf cmake-3.3.2.tar.gz
    cd cmake-3.3.2
    ./bootstrap 
    make
    

    Thanks a lot
  • AS wrote: »
    DavidZemon wrote: »
    wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
    tar -xf cmake-3.3.2.tar.gz
    cd cmake-3.3.2
    ./bootstrap --parallel=5
    make -j5
    

    This assumes you have a Raspberry Pi 2, with the quad-core processor. If you have the single-core version, drop the "--parallel=5" from the bootstrap command and the "-j5" from the make command.

    My is Model B. It´s single core right?
    I shoul write:
    wget https://cmake.org/files/v3.3/cmake-3.3.2.tar.gz
    tar -xf cmake-3.3.2.tar.gz
    cd cmake-3.3.2
    ./bootstrap 
    make
    

    Thanks a lot

    That's perfect, yes. Model B is single core. This is totally off topic, but I'd recommend you upgrade to the Pi 2 whenever you get a chance. The performance jump is wonderful.

    I've uploaded a zip with the necessary CMake files used by PropWare and then also modified my previous post with the extra instructions for downloading and installing that zip. It's quite simple - just two extra commands. The final command ("find ...") ensures that it was downloaded and extracted correctly.
  • ASAS Posts: 149
    edited 2016-01-25 16:39
    After the command "make", I let Raspberry working all night and day :P
    1st try: Raspberry gets a "memory exhausted" at 95% (see attached) :)

    (I typed "make" again)
    2nd try: It had some problems (see attached) :(

    So it will not work, does it?

    Solutions:
    - The new Raspberry like you sugest;
    R: I like this solution.
    - Oracle Virtual Machine, which OS you advise to install SimpleIDE?
    R: At the moment, It seems to me the best option.

    Thank you
  • Wow! I wouldn't expect that. Model B should have 512 MB of RAM right? If you have an X server running (the GUI login) you might try shutting that down. As well as anything else at all running in the background. 512 MB should be enough... odd that it isn't.

    This link says your second error is also connected to memory - that the "signal 9" means LD ran out of memory :(.

    So, first try, kill everything else running on your Pi, including any graphical applications (I see you're already using PuTTY to login and execute these commands, so hopefully closing any graphical programs is not a problem).

    If that still doesn't work, than a virtual machine has potential. Since your computer is pretty old, I might recommend you look into cloud-hosted virtual machines. Amazon offers 12 months free of their micro EC2 instances (https://aws.amazon.com/free/).

    You can try running something in a VM on your machine, but I worry about performance. You'd definitely want to use something headless - a Debian instance without an X server might run alright. The good news about going the VM + Linux route is that installation is easy - just use my .deb package. But... then you're wrestling with a VM.
  • ASAS Posts: 149
    Everything ok!

    Like you said, using only PuTTY it finishes (after the comand "make"), the 512MB deal with that. :-D

    I already find FindPropWare.cmake like you said:
    "./Modules/FindPropWare.cmake"

    Next step is to copy the files <https://github.com/zerokol/eFLL&gt; to the Raspberry?

    next steps please!

    thanks a lot
  • Wonderful! That's a big step.

    You'll need to make sure CMake is in your PATH, so open ~/.bashrc with your favorite text editor and add a line like this:
    export PATH=$HOME/cmake-3.3.2/bin:$PATH
    

    This assumes that cmake was downloaded into your home directory. After saving .bashrc and exiting the editor, run the following to reload .bashrc and ensure it was typed correctly:
    source ~/.bashrc
    which cmake
    

    With any luck, that will tell you the directory to your CMake executable, proving that it is now ready to use.

    Once this far, it's time to download PropGCC.

    Option 1: Download standalone PropGCC binaries
    wget http://david.zemon.name:8111/repository/download/PropGCC5_Gcc5rpi/lastSuccessful/propellergcc-alpha_v1_9_0-gcc5-rpi.tar.gz?guest=1 -O propgcc5.tar.gz
    cd /opt
    sudo tar -xf ~/propgcc5.tar.gz
    

    This should create a directory "/opt/parallax". You can place it anywhere you'd like if you prefer to stay away from sudo, but PropWare knows to look for it this way and that means less configuration on your part.

    Option 2: Install SimpleIDE, which comes with PropGCC
    Follow instructions here: http://learn.parallax.com/propeller-c-set-simpleide/raspberrypi

    ........

    Okay! With CMake running and PropGCC installed, time for a simple test. Back to your home directory
    cd ~
    mkdir PropellerProjects
    cd PropellerProjects
    wget http://david.zemon.name:8111/repository/download/PropWare_Release20/lastSuccessful/PropWare-2.0.0-Generic-examples.zip?guest=1 -O examples.zip
    unzip examples.zip
    cd PropWare/Examples/GettingStarted
    mkdir bin
    cd bin
    cmake ..
    make
    

    Whew! So that's going to create a directory to house all your Propeller projects (of course, name that whatever you want) and then download all of PropWare's examples. This ensures your environment is functional before diving into eFFL. From there, the most basic example project will be compiled. If all that goes well, and you see something that looks like this:
    david@balrog:~/tmp/PropWare/Examples/GettingStarted/bin$ make
    Scanning dependencies of target GettingStarted
    [ 50%] Building CXX object CMakeFiles/GettingStarted.dir/GettingStarted.cpp.obj
    [100%] Linking C executable GettingStarted.elf
    [100%] Built target GettingStarted
    

    Then try plugging in your Propeller and running one more command:
    make debug
    

    HOPEFULLY that works!!! I'm crossing my fingers for you!
  • ASAS Posts: 149
    CMake is in the directory cmake-3.3.2?
    When I write:
    sudo nano .bashrc
    
    it creat a new file?
    Is this what I should to do? (see attached file)
  • ASAS Posts: 149
    I´m asking this because when I following your 2nd option RB says cmake not found.

    Thanks a lot for your great help
  • try
    nano ~/.bashrc
    

    No sudo, and add the ~/ to the front. ~ is a shortcut for "/home/pi", or whatever your user's home directory is. It's handy :)
    The file should already exist, and you should only need to append that line to the end.
  • ASAS Posts: 149
    edited 2016-01-26 02:53
    ok, problem resolved, I find the file .bashrc (that already exist) and add at the end
    export PATH=$HOME/cmake-3.3.2/bin:$PATH
    

    But when you write:
    DavidZemon wrote: »
    source ~/.bashrc
    which cmake
    

    With any luck, that will tell you the directory to your CMake executable, proving that it is now ready to use.

    The Raspberry don´t give any feedback and still saying (when I follow the 2nd option) CMake not found.

    step by step :P

  • what is the output of "ls $HOME/cmake-3.3.2/bin"

    When I type that, I see three words printed on the line:
    pi@raspberrypi:~ $ ls $HOME/software/cmake-3.3.2/bin
    cmake  cpack  ctest
    pi@raspberrypi:~ $
    

    The only difference of course being that I dropped my cmake installation into a directory called "software".
  • ASAS Posts: 149
    ok! problem resolved

    I wrote:
    nano ~/.bashrc
    

    in the end of the file I changed:
    export PATH=$HOME/Downloads/cmake-3.3.2/bin:$PATH
    
    I save it!

    I wrote:
    source ~/.bashrc
    which cmake
    
    and I know the location of CMake, perfect!

    When I do the 2nd option and type
    cmake ..
    
    It gives me this error (see attached)

    thanks
  • Looks like I gave bad instructions regarding unzipping the Modules zip.

    Try this:
    cd ~/Downloads/cmake-3.3.2/share/cmake-3.3
    unzip ../../Modules.zip
    

    This will extract the special PropWare CMake config files (again) into the correct directory. Once that's done, try building the example project again.
  • ASAS Posts: 149
    edited 2016-01-27 01:00
    I will make a state of play!

    But I´m not lost yet. (I think so) :P

    When I´m in the directory "cmake-3.3.2", there is no "share" directory. I created "/share/cmake-3.3", unzip the files from Modules.zip to there but didn´t work.

    I have already a Modules directory created from CMake in the "cmake-3.3.2" directory I joint the files of Modules from Propware to inside the existing Modules from CMake, only 1 file in Platform directory (inside Modules) of Propware, I copy to the Platform directory (inside Modules) alredy creted from CMake.
    Don´t teel me that I need to delete each file. :P

    At this moment when try:
    pi@raspberrypi:~/PropellerProjects/PropWare/Examples/GettingStarted/bin $ cmake ..
    
    it gives me the error attached.

    I understand that is not easy for you, understand what I´m doing here, this is a error of path, we will see where is the problem. (I hope so!)

    Thank you
  • Okay, sorry for providing bad instructions. I was foolishly guessing that it would work without trying. I'm giving this all a go on my own Pi right now and will report back once I've run the GettingStarted example on my own Quickstart board. Hopefully that only takes a few minutes
  • DavidZemonDavidZemon Posts: 2,973
    edited 2016-01-27 01:33
    Alrighty! That was more painful than I would have liked.
    cd ~/Downloads/cmake-3.3.2
    make DESTDIR=$HOME install
    cd
    wget http://david.zemon.name:8111/repository/download/PropWare_Release20/809:id/PropWare-2.0.0-Generic-propware.zip?guest=1 -O propware.zip
    unzip propware.zip
    

    Edit ~/.bashrc again, and add the following line:
    export PROPWARE_PATH=$HOME/PropWare
    

    If you installed PropGCC from my build server, it may not work. Before going through the hassle of downloading SimpleIDE, let's check it:
    source ~/.bashrc
    cd ~/PropellerProjects/PropWare/Examples/GettingStarted/bin
    rm -rf *
    cmake ..
    

    Now, ideally you'll see something like this:
    pi@raspberrypi:~/PropProjects/PropWare/Examples/GettingStarted/bin $ rm -rf * && cmake ..
    -- Found PropWare: /home/pi/PropWare (found version "2.0.0") 
    -- The C compiler identification is GNU 4.6.1
    -- The CXX compiler identification is GNU 4.6.1
    -- LOADED: Generic-gcc-Propeller.cmake
    -- Check for working C compiler: /opt/parallax/bin/propeller-elf-gcc
    -- Check for working C compiler: /opt/parallax/bin/propeller-elf-gcc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /opt/parallax/bin/propeller-elf-gcc
    -- Check for working CXX compiler: /opt/parallax/bin/propeller-elf-gcc -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - failed
    -- Detecting CXX compile features
    -- Detecting CXX compile features - failed
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/pi/PropProjects/PropWare/Examples/GettingStarted/bin
    

    But if instead, you see an error that starts like so...
    pi@raspberrypi:~/PropProjects/PropWare/Examples/GettingStarted/bin $ rm -rf * && cmake ..
    -- Found PropWare: /home/pi/PropWare (found version "2.0.0") 
    -- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    -- Check for working C compiler: /opt/parallax/bin/propeller-elf-gcc
    -- Check for working C compiler: /opt/parallax/bin/propeller-elf-gcc -- broken
    CMake Error at /home/pi/usr/local/share/cmake-3.3/Modules/CMakeTestCCompiler.cmake:61 (message):
      The C compiler "/opt/parallax/bin/propeller-elf-gcc" is not able to compile
      a simple test program.
    
      It fails with the following output:
    
      ...
    ...
    ....
    

    Then you'll need to delete PropGCC and install via SimpleIDE. I had to do this. However, the Pi2 is still pretty new, and that may be why PropGCC from my build server doesn't work on it.

    To remove PropGCC, run the following two commands. Double check them for typos before running the second one because "sudo" and "rm -rf" are a dangerous combination and you don't want to have to re-install Raspbian!
    cd /opt
    sudo rm -rf parallax
    

    Finally, install SimpleIDE. Again, instructions here.

    With all that done, I was able to run the following from GettingStarted's bin directory and see "Hello, world!" printed on the screen:
    rm -rf *
    cmake ..
    make
    make debug
    

    The "rm -rf *" just clears out the old cmake stuff. You won't need to run that normally - only when you're getting an environment set up for the first time.
  • ASAS Posts: 149
    edited 2016-01-27 02:20
    ok! everything working like you said!

    I already had the SimpleIDE installed and don´t needed to reinstall again. Only after edit ~/.bashrc I need to reboot and than it work. (I think that was the reason)

    I already see the example "Hello world!" working 100%

    next step please! :P

    thanks a lot
  • Yaaayyy!!!!! Thanks for sticking with me!

    At this point, let's go back to my much much earlier post, where I copied the root CMakeLists.txt file. If you paste that text into a file named "CMakeLists.txt" in the root directory of eFFL, you should then be able to run:
    mkdir bin
    cd bin
    cmake ..
    make
    ls
    

    And you should see libeFFL.a in there :)

    Hopefully that works well. Assuming it does, take a look at how I structured the CMakeLists.txt files in my forked version of eFFL: https://github.com/DavidZemon/eFLL. Notice how I created a subdirectory "models" and then 6 directories underneath that, one for each of the 6 different memory models. This is the only way to create a static library for each memory model (you can't do it in a single config file).

    You ought to learn a lot about CMake and PropWare by looking at the commit history in my forked version:
    https://github.com/DavidZemon/eFLL/commits/master

    Particularly, here's the commit where I converted one of the examples from the Arduino libraries to PropWare.
  • ASAS Posts: 149
    Everything working very good.

    I should change "CMakeLists.txt" for the new one, in your forked version of eFFL?

    you will tell me how run a example.

    thanks a lot
    you have here a great work

  • It depends if you want to learn about CMake/PropWare, or just create the static libraries. I'm guessing - since you went through all this trouble despite having the ZIP available already - you want to learn. The best way to learn would be to write CMakeLists.txt files for yourself. Experiment with the different commands and use my forked version as example code. CMake has pretty good documentation on their website, and the PropWare modifications are documented here.

    As for running an example, you already have :). When you saw "Hello, world", that was actually coming from your Propeller board. You can open up GettingStarted.cpp and modify the code, then re-run "make debug" to see your changes implemented on the Propeller.

    To run the examples from eFFL, check out the CMakeLists.txt files from my forked version of eFFL in the "examples" subdirectory.
  • ASAS Posts: 149
    edited 2016-01-27 18:01
    Thanks a lot for your time, you done a great work.

    I want to learn, of course. This procedure fulfilled with "eFLL" can be done with other objects from Arduino. Right?

    I thought that, to run the examples from eFFL, I need to do more something, that´s why I asked for another example :P

    I try to understand everything you tell me here, is not easy due to my lack of knowledge in these programming areas.

    At this moment I want to do:
    - Do with the Propeller the same I already do with Arduino, simulating in LabView and controling with the microncontroller.
    - Make a tutorial with everything step by step of what has been done here to make it in the Raspberry.

    I will have a lot of questions, but at this moment I need to look of what has been done, try to understand some details and to make some experiments.

    At this moment I only have one more question:
    - The only diference to do this with the Raspberry quad-core processor or the single-core version is this one that thou hast spoken previously?
    DavidZemon wrote: »
    This assumes you have a Raspberry Pi 2, with the quad-core processor. If you have the single-core version, drop the "--parallel=5" from the bootstrap command and the "-j5" from the make command.

    Thanks
  • AS wrote: »
    At this moment I only have one more question:
    - The only diference to do this with the Raspberry quad-core processor or the single-core version is this one that thou hast spoken previously?
    DavidZemon wrote: »
    This assumes you have a Raspberry Pi 2, with the quad-core processor. If you have the single-core version, drop the "--parallel=5" from the bootstrap command and the "-j5" from the make command.

    Correct. Nothing else needs to change if you upgrade to the newer Pi 2.

    As for converting Arduino code, most of the time this won't be too difficult. The biggest problem is that "Arduino" means a lot of things, but primarily three:

    1) An IDE (the text editor and build system)
    2) A suite of libraries
    3) A development board (most commonly, the Uno)

    So to convert an Arduino project to the Propeller, you need to walk through each of the three pieces.

    The first part can be replaced with lots of different things. Personally, I use a paid product called CLion. Others just use vim, nano, Notepad++, or Eclipse combined with PropGCC. Others use SimpleIDE.

    The second part is harder. This involves code changes. Hopefully PropWare provides enough library components to make this easy - it has a way to deal with pins and serial output and lots of other stuff. But even easy work is work. For every library used in the Arduino project, you'll need to find an equivalent library for the Propeller. For instance, you'll have to replace references to Arduino's "Serial" library with something else. I recommend the "Printer" interface in PropWare, easily accessible via "pwOut". Myself and many other forum members can help you with this conversion task. For simple Arduino projects, it might take a few minutes (like the examples in eFFL). For bigger projects, it could take months (like an attempt at converting grbl, which was never completed).

    The third part I'm sure you already have: a Quickstart, an Activity Board, an ASC+... anything with a Propeller on it.
  • ASAS Posts: 149
    Hi DavidZemon,

    I attached a word file with all the necessary steps to install CMake and PropWare in the Raspberry.

    Propeller already debug any example from PropWare.

    I download from here (https://github.com/DavidZemon/eFLL) the zip file, and try to understand as are made the CMakeLists.txt from your forked version of eFFL. I see that I already have everything I need to debug to the propeller the general_simple_sample, but there are some information that I don´t understand yet, and I can´t do it.
    I try some different situations with CMakeLists.txt, I put this file inside the directory general_simple_sample, with the file general_simple_sample.cpp, make the directory bin, and do the same procedure as the examples of PropWare and I can´t debug to the propeller, I have allways some errors :P

    I need some help please.

Sign In or Register to comment.