Using NetBeans to compile C/C++ code for Omega



  • @Boken-Lin Of course you can :-) I was thinking of suggesting that I put together a document or something to go on the Wiki so it would be easier to find in case people wanted it.



  • @Kit-Bishop Thanks!



  • @Boken-Lin FYI: I can confirm that all the above works well.
    I have used it to produce an alternative GPIO C++ library and associated test program because I wanted some additional/different features. It is all working well :-)
    I still have some work to do on it to tidy it up and add some additional features, but will post it here when I'm done in case it is of use to others.

    Specific features I still want to add are:

    1. PWM output using threads rather than forking processes
    2. Ability to attach an interrupt service routine that gets called when an input pin changes state


  • @Kit-Bishop Yeah, #2 would be really handy. Have you had a chance to take a look at this: https://github.com/OnionIoT/gpio-irq? This sends an IRQ when the pin changes state. What we want to do is to wrap that into the edge fs interface like how it is on the raspberry pi.



  • @Boken-Lin With reference to #2 - yes, have seen the gpio-irq code and will be incorporating something like it in to my new GPIO code. May be a few days a way yet before the work is done.



  • @Kit-Bishop Looking forward to it!!



  • @Boken-Lin I have a small question in relation to the code I am developing.
    I want to ensure that the code does not permit GPIO operations on pin numbers that are not usable GPIO pins.
    I think I have deduced that GPIO operations should only be performed on the following set of pins and no others:

    0, 1, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 19, 23, 26

    Can you confirm or correct me. Thanks :-)



  • NOTE: Edit original posting because I found an oddity with NetBeans when using a Dynamic Library
    What I find to be a useful update to the NetBeans set up for Omega:
    I am lazy and don't like to have to do additional work and prefer to automate things where I can.
    Consequently, I have found a way to get NetBeans to transfer the result of building an Omega project to the Omega. This works so long as you have access to your Omega from your host system:

    1. Ensure that you have pscp installed on your host system. pscp is a variant of scp that allows you to specify the password for the scp connection - in general not highly recommended for security reasons but assume that it won't cause any issues here
    2. In NetBeans, right click on your project and select Properties
    3. Go to Run under Categories and click on the ... button against Run Command
    4. Enter the following with appropriate substitutions:
      For a standard program use:
      pscp -scp -pw "<omega_password>" ${OUTPUT_PATH} root@<omega_ip_address>:<dest_dir>/.
      And for a Dynamic Library use:
      pscp -scp -pw "<omega_password>" ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/* root@<omega_ip_address>:<dest_dir>/.
      Where:
      • <omega_password> is the pass word for your Omega - default is onioneer but you may have changed it
      • <omega_ip_address> is the IP address used to access your Omega - probably 192.168.3.1
      • <dest_dir> is the destination directory for the file on your Omega - you may omit <dest_dir>/ if you want and the file will be placed in the /root directory.
        For a Dynamic Library, I normally use /lib for <dest_dir> to put the library directly to the required directory
    5. Having build your project, right click on your project in NetBeans and select Run - the built file will be transferred to your Omega.

    @Boken-Lin You may want to add this to the Wiki entry if considered useful.



  • @Kit-Bishop The GPIO ports looks right :)



  • @Boken-Lin Thanks - I'll go with that then



  • PLEASE NOTE
    I have edited my original instructions above for getting NetBeans to transfer your built file to your Omega because of an oddity I found in how NetBeans deals with Dynamic Libraries


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.