Menu

Getting started on Linux

Help
Jay
2016-08-15
2017-01-20
  • Jay

    Jay - 2016-08-15

    I'm new to programming microcontrollers although I've been using freebasic for some years. The getting started guide is for Windows users so I just wanted to check that I'm not leaving out some vital step. I'm using Debian (32 bit) and have successfully compiled and installed both gcbasic (not without some problems, but with the help of this forum I solved them ;-)) and the download program pk2cmd for pickit2, and have just ordered a pickit2 programmer (clone, I assume) from Ebay.

    Is there anything else I need to program pics on Linux with gcbasic?

    Thanks in advance for any advice!

    p.s. Very glad I came across gcbasic because I was intending to use the picaxe system. However, it seems a bit limited compared to gcbasic (not to mention that the picaxe chips are more expensive than plain pics) and I may as well start as I mean to go on.

     
  • Anobium

    Anobium - 2016-08-15

    Welcome - a great choice!

    Yes we support your configuration. See https://sourceforge.net/p/gcbasic/discussion/579125/thread/764409f8/#7cf3 for lots of information.

    Re pickit2 (pk2). You MUST ensure you select microcontroller is supported by the pk2 not all are supported by pk3 (you would need a pk3). Ask before you buy your microcontrollers - some that you desire may not be supported by a pk2.

    Anobium

     
  • kent_twt4

    kent_twt4 - 2016-08-15

    William Roth has published a revised pk2 dat file which includes many new devices, with noted exceptions. He has fixed a lot of the problems that others previously introduced in the device scripting tool. https://sourceforge.net/p/gcbasic/discussion/629990/thread/d59cd035/

     
    • Anobium

      Anobium - 2016-08-15

      Good point. The latest Linux installer has the latest pk2 dat file, i also publish in the files section of the forum.

       
  • Jay

    Jay - 2016-08-15

    Thanks Anobium for the link, but that thread seems to be mainly about Wine issues whereas I'm using the "native" version of gcbasic. The pickit2 supports all the micros I'll be needing. I did think about using avrs but pics seem to have more documentation and tutorials, plus there's a simulator for Linux (also works on windows I believe) called gpsim although not sure how easy it is to use.

    @ kent_twt4, thanks for the link.

     
  • Jay

    Jay - 2016-09-09

    I guess us Linux folks have a bit more work to do because I thought gcbasic generated a hex file not a .asm file. Do I need to install gpasm to generate the hex file and can I get gcbasic to generate a hex file in one go once I've done this?

    Thanks and sorry for the noob question.

     

    Last edit: Jay 2016-09-09
  • T. Lee Davidson

    T. Lee Davidson - 2016-09-10

    GCBasic does generate hex files on Linux. It's simply a matter of calling the compiler with the "/A" switch specifying the internal assembler, eg. gcbasic /A:GCASM [sourcefile]

    If you installed the LInux build (and so are not running GCBasic through Wine), there should be a 'makehex.sh' script in your /opt/GCBASIC directory. Executing "makehex.sh [sourcefile]" from the command line will place the hex file in your current working directory. You can also use that script, and 'makeasm.sh', from within any editor that provides for custom commands.

     

    Last edit: T. Lee Davidson 2016-09-10
    • T. Lee Davidson

      T. Lee Davidson - 2016-09-10

      Forgot to mention, there's no need to install gpasm.

      Oh, and this:
      http://gcbasic.sourceforge.net/help/_command_line_parameters.html

       

      Last edit: T. Lee Davidson 2016-09-10
  • Jay

    Jay - 2016-09-10

    Thanks! All good now.

     
  • Lakis

    Lakis - 2017-01-02

    Hello and happy New Year to everyone. I need help on this, i cant unrar the file for linux instalation SGB@Syn.rar files because it needs password to unrar them. How you did it?, where is this password or what the pass is? Thanks.

     
  • Lakis

    Lakis - 2017-01-03

    many thanks

     
  • Jim Gregory

    Jim Gregory - 2017-01-15

    I just installed the latest GCB on an Orange Pi Plus 2 (an ARM-based single-board computer similar to a Raspberry Pi) but ran into a couple of issues I thought you should know about:

    1. It would not build unless I commented out line 5 that halts on error:

    # set -e # Halt on error

    1. Once I do that, if I do:

    ~~~
    chmod +x install.sh
    ./install.sh build
    ~~~

    It will build successfully even though I get an '[[: not found' error found on line 66. That's because '[[' is a bash built-in, and the script is called using /bin/sh (see http://stackoverflow.com/questions/12230690/string-comparison-in-bash-not-found). If I call the script instead using:

    bash install.sh build

    then I don't get that error.

    But that workaround still doesn't fix the first error, however--i.e., the script won't build even if there are no visible errors without removing the 'set -e' line.

    But after it builds everything seems to work OK.

     
    • T. Lee Davidson

      T. Lee Davidson - 2017-01-16

      Thank you for that notice, Jim. Good catch on that "sh" vs "bash".

      When you say that, "It would not build," do you happen to recall what it does do? Or where exactly the script aborts?

      @Anobium: The very first line in the 'install.sh' script should be modified from "#!/bin/sh" to "#!/bin/bash".

       
  • Anobium

    Anobium - 2017-01-16

    Excellent. I did wonder what the change was.... I will make the change now.

     
    • T. Lee Davidson

      T. Lee Davidson - 2017-01-17

      BTW, I don't see a link for the Linux version on the Download page (http://gcbasic.sourceforge.net/download.html). Where should one go to find a link to that particular package?

       
      • Anobium

        Anobium - 2017-01-17

        I will add ASAP. Very good point it is missing.

         
        • Anobium

          Anobium - 2017-01-17

          I have revised the download page to include the Linux distribution.

           
  • Lakis

    Lakis - 2017-01-19

    i think the problem is the arch option, compile it without it "fbc -exx -v gcbasic.bas" and it works. And make comment line 5 (#set -e), only that way it works.

     
    • T. Lee Davidson

      T. Lee Davidson - 2017-01-19

      Thank you for chiming in, Lakis.

      I would like to say you found the problem, but that's not it. It would work with "set -e" ("halt on error") commented out even with the "-arch" option left intact.

      The script is set to halt on error to catch any unanticipated errors so the user is not left with an incomplete or corrupt installation and no idea that something had gone wrong. This current issue is with non-critical version tracking. So, it is safe to temporarily comment out "set -e" to accomplish a "build" (preferable uncommenting it for the "install").

      An updated Linux package, that corrects this issue, will be out soon.

      On a related note, the default value for "-arch" is "486". So if your machine is 486-compatible, leaving out the "-arch" option will give you a working GCBASIC compiler. But, it may not be optimized for your processor.

       
  • Lakis

    Lakis - 2017-01-20

    ok. i try to learn.

     

    Last edit: Lakis 2017-01-20
  • Lakis

    Lakis - 2017-01-20

    Also it generate error to me the include line in the assembly file e.g. #include P10F204.inc (the capitals P and F), how do you by pass it? i try the -i option in the gpasm.

     

    Last edit: Lakis 2017-01-20

Log in to post a comment.